Skip to content

Commit e6f89cc

Browse files
author
Caspar van Leeuwen
committed
Account for the fact that nvidia-smi might be installed on a CPU node. The command will exist, but return a non-zero exit when run with .e.g --version because there are no GPU drivers
1 parent a285a1c commit e6f89cc

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

bot/test.sh

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,19 @@ TEST_STEP_ARGS+=("--extra-bind-paths" "/sys/fs/cgroup:/hostsys/fs/cgroup:ro")
214214

215215
# add options required to handle NVIDIA support
216216
if command_exists "nvidia-smi"; then
217-
echo "Command 'nvidia-smi' found, using available GPU"
218-
TEST_STEP_ARGS+=("--nvidia" "run")
217+
# Accept that this may fail
218+
set +e
219+
nvidia-smi --version
220+
ec=$?
221+
set -e
222+
if [ ${ec} -eq 0 ]; then
223+
echo "Command 'nvidia-smi' found, using available GPU"
224+
TEST_STEP_ARGS+=("--nvidia" "run")
225+
else
226+
echo "Warning: command 'nvidia-smi' found, but 'nvidia-smi --version' did not run succesfully."
227+
echo "This script now assumes this is NOT a GPU node."
228+
echo "If, and only if, the current node actually does contain Nvidia GPUs, this should be considered an error."
229+
fi
219230
fi
220231

221232
# prepare arguments to test_suite.sh (specific to test step)

0 commit comments

Comments
 (0)