|
1 | 1 | name: Get Runner Infos
|
2 | 2 |
|
| 3 | +inputs: |
| 4 | + ut_name: |
| 5 | + required: true |
| 6 | + type: string |
| 7 | + description: Which ut to launch |
| 8 | + |
3 | 9 | outputs:
|
4 | 10 | runner_id:
|
5 | 11 | value: ${{ steps.runner.outputs.runner_id }}
|
|
21 | 27 | steps:
|
22 | 28 | - name: Get runner
|
23 | 29 | shell: bash -xe {0}
|
| 30 | + if: ${{ ! contains(inputs.ut_name, 'distributed') }} |
24 | 31 | id: runner
|
25 | 32 | run: |
|
26 | 33 | # get test runner
|
|
76 | 83 | echo "xpu_num=${xpu_num}" |tee -a ${GITHUB_OUTPUT}
|
77 | 84 | echo "cpus_per_xpu=${cpus_per_xpu}" |tee -a ${GITHUB_OUTPUT}
|
78 | 85 | echo "pytest_extra_args=${pytest_extra_args}" |tee -a ${GITHUB_OUTPUT}
|
| 86 | + - name: Get distributed runner |
| 87 | + shell: bash -xe {0} |
| 88 | + if: ${{ contains(inputs.ut_name, 'distributed') }} |
| 89 | + id: runner-dist |
| 90 | + run: | |
| 91 | + # get test runner |
| 92 | + echo "runner_id=$(echo ${RUNNER_NAME} |sed 's/\-[0-9]$//')" |tee -a ${GITHUB_OUTPUT} |
| 93 | + echo "user_id=$(id -u)" |tee -a ${GITHUB_OUTPUT} |
| 94 | + echo "render_id=$(getent group render |cut -d: -f3)" |tee -a ${GITHUB_OUTPUT} |
| 95 | + echo "hostname=$(hostname)" |tee -a ${GITHUB_OUTPUT} |
| 96 | + # show host info |
| 97 | + lscpu |
| 98 | + lshw -C display |
| 99 | + free -h |
| 100 | + df -h |
| 101 | + cat /etc/os-release |
| 102 | + uname -a |
| 103 | + # clinfo hang and reboot system to recover |
| 104 | + timeout 120 clinfo --list || sudo reboot |
| 105 | + scaling_governor=$(cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor |sort |uniq) |
| 106 | + if [ $(sudo -n true > /dev/null 2>&1 && echo $? || echo $?) -eq 0 ];then |
| 107 | + if [ "${scaling_governor}" != "performance" ];then |
| 108 | + # set frequency governor to performance mode |
| 109 | + sudo apt-get update |
| 110 | + sudo apt-get install -y linux-tools-common linux-tools-$(uname -r) linux-cloud-tools-$(uname -r) |
| 111 | + sudo cpupower set -b 0 |
| 112 | + sudo cpupower frequency-set -g performance |
| 113 | + fi |
| 114 | + # clean cache |
| 115 | + sync; sudo sh -c "echo 3 > /proc/sys/vm/drop_caches" || true |
| 116 | + else |
| 117 | + echo "[INFO] You do NOT have ROOT permission to set system config." |
| 118 | + echo " The frequency governor is ${scaling_governor}." |
| 119 | + fi |
| 120 | + cpu_num="$(lscpu |grep -E 'Core\(s\) per socket:|Socket\(s\):' |awk 'BEGIN{sum=1}{sum*=$NF}END{printf sum}')" |
| 121 | + xpu_num="$(clinfo --list |awk 'BEGIN{gpu=0;}{ |
| 122 | + if(gpu==1 && $0~/Platform/){gpu=0}; if(gpu==1){print $0}; if($0~/Platform.*Graphics/){gpu=1} |
| 123 | + }' |wc -l)" |
| 124 | + cpus_per_xpu="$(echo |awk -v c="${cpu_num}" -v x="${xpu_num}" '{printf c/x}')" |
| 125 | + pytest_extra_args="$(echo |awk -v x="${xpu_num}" -v z="${ZE_AFFINITY_MASK}" -v cx="${cpus_per_xpu}" '{ |
| 126 | + if (x > 0) { |
| 127 | + split(z, xpu_list, ","); |
| 128 | + for (i=0;i<x;i=i+4) { |
| 129 | + if (z != "") { |
| 130 | + ze = xpu_list[i+1]; |
| 131 | + } else { |
| 132 | + ze = i; |
| 133 | + } |
| 134 | + printf(" --tx popen//env:ZE_AFFINITY_MASK=%d,%d,%d,%d//env:OMP_NUM_THREADS=%d//python=\"numactl -l -C %d-%d python\"", |
| 135 | + ze,ze+1,ze+2,ze+3,4*cx,i*cx,(i+4)*cx-1); |
| 136 | + } |
| 137 | + }else { |
| 138 | + printf(" -n 1 "); |
| 139 | + } |
| 140 | + }')" |
| 141 | + echo "xpu_num=${xpu_num}" |tee -a ${GITHUB_OUTPUT} |
| 142 | + echo "cpus_per_xpu=${cpus_per_xpu}" |tee -a ${GITHUB_OUTPUT} |
| 143 | + echo "pytest_extra_args=${pytest_extra_args}" |tee -a ${GITHUB_OUTPUT} |
79 | 144 | - name: Cleanup host
|
80 | 145 | shell: bash -xe {0}
|
81 | 146 | run: |
|
|
0 commit comments