@@ -23,78 +23,108 @@ jobs:
23
23
uses : actions/checkout@master
24
24
with :
25
25
fetch-depth : 1
26
+
27
+ # 2. Create tmp directory
28
+ - name : Retrieve the current timestamp
29
+ id : work-timestamp
30
+ run : echo "WORK_TIMESTAMP=$(date +"%Y-%m%d-%H%M%S")" >> "$GITHUB_OUTPUT"
26
31
27
- # 2. Setup basic information in test_conf.py
32
+ - name : Set work directory variable
33
+ id : work-directory
34
+ env :
35
+ WORK_TIMESTAMP : ${{ steps.work-timestamp.outputs.WORK_TIMESTAMP }}
36
+ run : echo "WORK_DIRECTORY=$(realpath ${PWD}/..)/FlagPerf-$WORK_TIMESTAMP" >> "$GITHUB_OUTPUT"
37
+
38
+ - name : Create work directory and copy the whole directory
39
+ env :
40
+ WORK_DIRECTORY : ${{ steps.work-directory.outputs.WORK_DIRECTORY }}
41
+ run : |
42
+ mkdir ${WORK_DIRECTORY} &&
43
+ cp -r * ${WORK_DIRECTORY}
44
+
45
+ # 3. Setup basic information in test_conf.py
28
46
- name : Setup test_conf.py
47
+ env :
48
+ WORK_DIRECTORY : ${{ steps.work-directory.outputs.WORK_DIRECTORY }}
29
49
run : |
30
- echo "VENDOR = 'kunlunxin'" >> training/run_benchmarks/config/test_conf.py &&
31
- echo "ACCE_CONTAINER_OPT = '--device=/dev/xpu0 --device=/dev/xpu1 --device=/dev/xpu2 --device=/dev/xpu3 --device=/dev/xpu4 --device=/dev/xpu5 --device=/dev/xpu6 --device=/dev/xpu7 --device=/dev/xpuctrl'" >> training/run_benchmarks/config/test_conf.py &&
32
- echo "ACCE_VISIBLE_DEVICE_ENV_NAME = 'XPU_VISIBLE_DEVICES'" >> training/run_benchmarks/config/test_conf.py &&
50
+ export TEST_CONF_FILEPATH=${WORK_DIRECTORY}/training/run_benchmarks/config/test_conf.py
51
+ echo "VENDOR = 'kunlunxin'" >> ${TEST_CONF_FILEPATH} &&
52
+ echo "ACCE_CONTAINER_OPT = '--device=/dev/xpu0 --device=/dev/xpu1 --device=/dev/xpu2 --device=/dev/xpu3 --device=/dev/xpu4 --device=/dev/xpu5 --device=/dev/xpu6 --device=/dev/xpu7 --device=/dev/xpuctrl'" >> ${TEST_CONF_FILEPATH} &&
53
+ echo "ACCE_VISIBLE_DEVICE_ENV_NAME = 'XPU_VISIBLE_DEVICES'" >> ${TEST_CONF_FILEPATH} &&
33
54
echo "PIP_SOURCE = 'https://pypi.tuna.tsinghua.edu.cn/simple'" &&
34
- echo "FLAGPERF_PATH = '${PWD }/training'" >> training/run_benchmarks/config/test_conf.py &&
35
- echo "FLAGPERF_LOG_PATH = '${PWD }/training/result/'" >> training/run_benchmarks/config/test_conf.py &&
36
- cat training/run_benchmarks/config/test_conf.py
55
+ echo "FLAGPERF_PATH = '${WORK_DIRECTORY }/training'" >> ${TEST_CONF_FILEPATH} &&
56
+ echo "FLAGPERF_LOG_PATH = '${WORK_DIRECTORY }/training/result/'" >> ${TEST_CONF_FILEPATH} &&
57
+ cat ${TEST_CONF_FILEPATH}
37
58
38
- # 3 . Setup cases in test_conf.py
59
+ # 4 . Setup cases in test_conf.py
39
60
- name : Setup 1x1 case and 1x8 case in test_conf.py
40
61
if : ${{ inputs.case1x1 != '' && inputs.case1x8 != '' }}
62
+ env :
63
+ WORK_DIRECTORY : ${{ steps.work-directory.outputs.WORK_DIRECTORY }}
41
64
run : |
42
- echo "CASES = { '${{ inputs.case1x1 }}' : '${{ inputs.dataset_path }}', '${{ inputs.case1x8 }}' : '${{ inputs.dataset_path }}' }" >> training/run_benchmarks/config/test_conf.py &&
43
- cat training/run_benchmarks/config/test_conf.py
65
+ echo "CASES = { '${{ inputs.case1x1 }}' : '${{ inputs.dataset_path }}', '${{ inputs.case1x8 }}' : '${{ inputs.dataset_path }}' }" >> ${WORK_DIRECTORY}/ training/run_benchmarks/config/test_conf.py &&
66
+ cat ${WORK_DIRECTORY}/ training/run_benchmarks/config/test_conf.py
44
67
- name : Setup 1x1 case in test_conf.py
45
68
if : ${{ inputs.case1x1 != '' && inputs.case1x8 == '' }}
69
+ env :
70
+ WORK_DIRECTORY : ${{ steps.work-directory.outputs.WORK_DIRECTORY }}
46
71
run : |
47
- echo "CASES = { '${{ inputs.case1x1 }}' : '${{ inputs.dataset_path }}' }" >> training/run_benchmarks/config/test_conf.py &&
48
- cat training/run_benchmarks/config/test_conf.py
72
+ echo "CASES = { '${{ inputs.case1x1 }}' : '${{ inputs.dataset_path }}' }" >> ${WORK_DIRECTORY}/ training/run_benchmarks/config/test_conf.py &&
73
+ cat ${WORK_DIRECTORY}/ training/run_benchmarks/config/test_conf.py
49
74
- name : Setup 1x8 case in test_conf.py
50
75
if : ${{ inputs.case1x1 == '' && inputs.case1x8 != '' }}
76
+ env :
77
+ WORK_DIRECTORY : ${{ steps.work-directory.outputs.WORK_DIRECTORY }}
51
78
run : |
52
- echo "CASES = { '${{ inputs.case1x1 }}' : '${{ inputs.dataset_path }}' }" >> training/run_benchmarks/config/test_conf.py &&
53
- cat training/run_benchmarks/config/test_conf.py
79
+ echo "CASES = { '${{ inputs.case1x1 }}' : '${{ inputs.dataset_path }}' }" >> ${WORK_DIRECTORY}/ training/run_benchmarks/config/test_conf.py &&
80
+ cat ${WORK_DIRECTORY}/ training/run_benchmarks/config/test_conf.py
54
81
- name : Setup empty cases in test_conf.py
55
82
if : ${{ inputs.case1x1 == '' && inputs.case1x8 == '' }}
83
+ env :
84
+ WORK_DIRECTORY : ${{ steps.work-directory.outputs.WORK_DIRECTORY }}
56
85
run : |
57
86
echo "At least one of case1x1 and case1x8 is not empty!" &&
58
87
ls non_existent_file.txt
59
88
60
- # 4 . Setup cluster_conf.py
89
+ # 5 . Setup cluster_conf.py
61
90
- name : Setup cluster_conf.py
91
+ env :
92
+ WORK_DIRECTORY : ${{ steps.work-directory.outputs.WORK_DIRECTORY }}
62
93
run : |
63
- echo "HOSTS = ['127.0.0.1']" >> training/run_benchmarks/config/cluster_conf.py &&
64
- cat training/run_benchmarks/config/cluster_conf.py
94
+ echo "HOSTS = ['127.0.0.1']" >> ${WORK_DIRECTORY}/ training/run_benchmarks/config/cluster_conf.py &&
95
+ cat ${WORK_DIRECTORY}/ training/run_benchmarks/config/cluster_conf.py
65
96
66
- # 5 . Run test
97
+ # 6 . Run test
67
98
- name : Run test
99
+ env :
100
+ WORK_DIRECTORY : ${{ steps.work-directory.outputs.WORK_DIRECTORY }}
68
101
run : |
69
- pushd training &&
102
+ pushd ${WORK_DIRECTORY}/ training &&
70
103
python3 run_benchmarks/run.py 2>&1 | tee tmp_run.log &&
71
104
popd
72
105
73
- # 6 . Verify test result
106
+ # 7 . Verify test result
74
107
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-output-parameter
75
108
- name : Get run result name
76
109
id : run-result-name
77
- run : echo "RUN_RESULT_NAME=$(cat training/tmp_run.log | grep 'Initialize logger with log path:' | egrep -o 'run[0-9]+')" >> "$GITHUB_OUTPUT"
110
+ env :
111
+ WORK_DIRECTORY : ${{ steps.work-directory.outputs.WORK_DIRECTORY }}
112
+ run : echo "RUN_RESULT_NAME=$(cat ${WORK_DIRECTORY}/training/tmp_run.log | grep 'Initialize logger with log path:' | egrep -o 'run[0-9]+')" >> "$GITHUB_OUTPUT"
78
113
79
114
- name : Verify 1x1 case result
80
115
if : ${{ inputs.case1x1 != '' }}
81
116
env :
117
+ WORK_DIRECTORY : ${{ steps.work-directory.outputs.WORK_DIRECTORY }}
82
118
RUN_RESULT_NAME : ${{ steps.run-result-name.outputs.RUN_RESULT_NAME }}
83
119
run : |
84
- cat training/result/${RUN_RESULT_NAME}/${{ inputs.case1x1 != '' }}/round1/127.0.0.1_noderank0/rank0.out.log
85
- grep "FINISHED" "training/result/${RUN_RESULT_NAME}/${{ inputs.case1x1 != '' }}/round1/127.0.0.1_noderank0/rank0.out.log"
120
+ cat ${WORK_DIRECTORY}/ training/result/${RUN_RESULT_NAME}/${{ inputs.case1x1 }}/round1/127.0.0.1_noderank0/rank0.out.log
121
+ grep "FINISHED" "${WORK_DIRECTORY}/ training/result/${RUN_RESULT_NAME}/${{ inputs.case1x1 }}/round1/127.0.0.1_noderank0/rank0.out.log"
86
122
87
123
- name : Verify 1x8 case result
88
124
if : ${{ inputs.case1x8 != '' }}
89
125
env :
126
+ WORK_DIRECTORY : ${{ steps.work-directory.outputs.WORK_DIRECTORY }}
90
127
RUN_RESULT_NAME : ${{ steps.run-result-name.outputs.RUN_RESULT_NAME }}
91
128
run : |
92
- cat training/result/${RUN_RESULT_NAME}/${{ inputs.case1x8 != '' }}/round1/127.0.0.1_noderank0/rank0.out.log
93
- grep "FINISHED" "training/result/${RUN_RESULT_NAME}/${{ inputs.case1x8 != '' }}/round1/127.0.0.1_noderank0/rank0.out.log"
94
-
95
- # 7. Clean job
96
- - name : Remove tmp_run.log, restore test_conf.py and cluster_conf.py
97
- run : |
98
- rm -f training/tmp_run.log &&
99
- git checkout training/run_benchmarks/config/test_conf.py &&
100
- git checkout training/run_benchmarks/config/cluster_conf.py
129
+ cat ${WORK_DIRECTORY}/training/result/${RUN_RESULT_NAME}/${{ inputs.case1x8 }}/round1/127.0.0.1_noderank0/rank0.out.log
130
+ grep "FINISHED" "${WORK_DIRECTORY}/training/result/${RUN_RESULT_NAME}/${{ inputs.case1x8 }}/round1/127.0.0.1_noderank0/rank0.out.log"
0 commit comments