@@ -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.
6969export 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
7982fi
8083
8184if python -c " import torch" & > /dev/null; then
0 commit comments