Skip to content

Commit 6fa2562

Browse files
authored
Allow overriding the GPU_DEVICE variable for capture-hw-details.sh (#3618)
1 parent 6744eea commit 6fa2562

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

scripts/capture-hw-details.sh

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,17 @@ export LEVEL_ZERO_VERSION="$(level_zero_version)"
6868
# Use AGAMA_VERSION for GPU driver version on both Linux and Windows for backward compatibility.
6969
export AGAMA_VERSION="$(agama_version)"
7070

71-
if command -v clinfo &> /dev/null; then
72-
export GPU_DEVICE=$(clinfo --json | jq -r '[.devices[].online[] | select(.CL_DEVICE_TYPE.raw == 4)][0].CL_DEVICE_NAME')
73-
elif command -v nvidia-smi &> /dev/null; then
74-
export GPU_DEVICE=$(nvidia-smi -L | sed -e 's,\(.*\) (UUID.*),\1,')
75-
elif command -v sycl-ls &> /dev/null; then
76-
export GPU_DEVICE=$(ONEAPI_DEVICE_SELECTOR=level_zero:gpu sycl-ls --verbose 2>/dev/null | grep Name | sed -n '2p' | sed -E 's/\s+Name\s+:\s+(.+)$/\1/')
77-
else
78-
export GPU_DEVICE="Not Installed"
71+
# Allow overriding GPU_DEVICE when other methods are unreliable (i.e. if reported name is too common)
72+
if [[ ! -v GPU_DEVICE ]]; then
73+
if command -v clinfo &> /dev/null; then
74+
export GPU_DEVICE=$(clinfo --json | jq -r '[.devices[].online[] | select(.CL_DEVICE_TYPE.raw == 4)][0].CL_DEVICE_NAME')
75+
elif command -v nvidia-smi &> /dev/null; then
76+
export GPU_DEVICE=$(nvidia-smi -L | sed -e 's,\(.*\) (UUID.*),\1,')
77+
elif command -v sycl-ls &> /dev/null; then
78+
export GPU_DEVICE=$(ONEAPI_DEVICE_SELECTOR=level_zero:gpu sycl-ls --verbose 2>/dev/null | grep Name | sed -n '2p' | sed -E 's/\s+Name\s+:\s+(.+)$/\1/')
79+
else
80+
export GPU_DEVICE="Not Installed"
81+
fi
7982
fi
8083

8184
if python -c "import torch" &> /dev/null; then

0 commit comments

Comments
 (0)