-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ROCm] Optimize ROCm CI pipeline 2 (#16691)
- Set `KERNEL_EXPLORER_TEST_USE_CUPY=1` to replace numpy with cupy on kernel explorer test. KERNEL_EXPLORER_TEST_USE_CUPY=0 The CPU utilization is shown as below: ![image](https://github.com/microsoft/onnxruntime/assets/94887879/91724b78-0b4e-4cbd-ad88-83cad9976472) KERNEL_EXPLORER_TEST_USE_CUPY=1 The CPU utilization is shown as below: ![image](https://github.com/microsoft/onnxruntime/assets/94887879/58239911-667c-4d5f-bb78-deca60d0266f) - Use `Bash@3`. - Update shell script.
- Loading branch information
1 parent
f768269
commit 4af19c4
Showing
5 changed files
with
60 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,47 @@ | ||
#!/bin/bash | ||
set -ex | ||
|
||
agentName=$1 | ||
target_device=$2 | ||
echo "agent name $agentName" | ||
echo "agent target device : $target_device" | ||
usage() { echo "Usage: $0 [-n <agent name>] [-d <target device>] [-r <driver render>]" 1>&2; exit 1; } | ||
|
||
while getopts "n:d:r:" parameter_Option | ||
do case "${parameter_Option}" | ||
in | ||
n) AGENT_NAME=${OPTARG};; | ||
d) TARGET_DEVICE=${OPTARG};; | ||
r) DRIVER_RENDER=${OPTARG};; | ||
*) usage ;; | ||
esac | ||
done | ||
|
||
echo "Agent Name: $AGENT_NAME, Target Device: $TARGET_DEVICE, Driver Render: $DRIVER_RENDER" | ||
|
||
echo -e "\n ---- rocm-smi" | ||
echo -e "\n ---- Execute rocm-smi" | ||
rocm-smi | ||
|
||
echo -e "\n ---- rocm-smi --showpids" | ||
echo -e "\n ---- Execute rocm-smi --showpids" | ||
rocm-smi --showpids | ||
|
||
echo -e "\n ---- rocm-smi --showpidgpus" | ||
echo -e "\n ---- Execute rocm-smi --showpidgpus" | ||
rocm-smi --showpidgpus | ||
|
||
echo -e "\n ---- rocm-smi --showpids detail" | ||
echo -e "\n ---- Execute rocm-smi --showpids detail" | ||
rocm-smi --showpids | awk '$1 ~/[0-9]+/{if((NR>6)) {print $1}}' | xargs -I {} ps {} | ||
|
||
echo -e "\n ---- rocm-smi --showmeminfo" | ||
echo -e "\n ---- Execute rocm-smi --showmeminfo" | ||
rocm-smi --showmeminfo vram vis_vram gtt | ||
|
||
echo -e "\n ---- Clean up the process that is using the target device" | ||
gpu_details=$(rocm-smi --showpidgpus) | ||
pid_lines=$(echo "$gpu_details" | grep -n "DRM device" | cut -d ":" -f 1) | ||
pid_lines_array=($pid_lines) | ||
|
||
for ((i = 0; i < ${#pid_lines_array[@]}; i++)); do | ||
pid_line=${pid_lines_array[$i]} | ||
pid=$(echo "$gpu_details" | awk '{print $2}' | sed -n "${pid_line}p") | ||
gpu_line=$((pid_line + 1)) | ||
pid_gpu=$(echo "$gpu_details" | sed -n "${gpu_line}p" | sed -e 's/^[ ]*//g' | sed -e 's/[ ]*$//g') | ||
if [ "$pid_gpu" == "$target_device" ]; then | ||
echo "kill pid: $pid, gpu: $pid_gpu" | ||
kill -9 $pid | ||
echo -e "\n ---- Clean up processes that use the target device $TARGET_DEVICE" | ||
GPU_USED_BY_PIDS=$(rocm-smi --showpidgpus) | ||
PID_NUMBERS_LINES=$(echo "$GPU_USED_BY_PIDS" | grep -n "DRM device" | cut -d ":" -f 1) | ||
PID_NUMBERS_LINES_ARRAY=($PID_NUMBERS_LINES) | ||
|
||
for ((i = 0; i < ${#PID_NUMBERS_LINES_ARRAY[@]}; i++)); do | ||
PID_NUMBER_LINE=${PID_NUMBERS_LINES_ARRAY[$i]} | ||
PID_NUMBER=$(echo "$GPU_USED_BY_PIDS" | awk '{print $2}' | sed -n "${PID_NUMBER_LINE}p") | ||
GPU_USED_BY_PID_LINE=$((PID_NUMBER_LINE + 1)) | ||
GPU_USED_BY_PID=$(echo "$GPU_USED_BY_PIDS" | sed -n "${GPU_USED_BY_PID_LINE}p" | sed -e 's/^[ ]*//g' | sed -e 's/[ ]*$//g') | ||
if [ "$GPU_USED_BY_PID" == "$TARGET_DEVICE" ]; then | ||
echo "kill pid: $PID_NUMBER, using gpu: $GPU_USED_BY_PID" | ||
kill -9 "$PID_NUMBER" | ||
fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters