Skip to content

Commit 8564e42

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 224e170 commit 8564e42

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

EESSI-install-software.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,11 +271,18 @@ fi
271271

272272
# Install NVIDIA drivers in host_injections (if they exist)
273273
if command_exists "nvidia-smi"; then
274-
echo "Command 'nvidia-smi' found. Installing NVIDIA drivers for use in prefix shell..."
275-
${EESSI_PREFIX}/scripts/gpu_support/nvidia/link_nvidia_host_libraries.sh
274+
nvidia-smi --version
275+
ec=$?
276+
if [ ${ec} -eq 0 ]; then
277+
echo "Command 'nvidia-smi' found. Installing NVIDIA drivers for use in prefix shell..."
278+
${EESSI_PREFIX}/scripts/gpu_support/nvidia/link_nvidia_host_libraries.sh
279+
else
280+
echo "Warning: command 'nvidia-smi' found, but 'nvidia-smi --version' did not run succesfully."
281+
echo "This script now assumes this is NOT a GPU node."
282+
echo "If, and only if, the current node actually does contain Nvidia GPUs, this should be considered an error."
283+
fi
276284
fi
277285

278-
279286
if [ ! -z "${shared_fs_path}" ]; then
280287
shared_eb_sourcepath=${shared_fs_path}/easybuild/sources
281288
echo ">> Using ${shared_eb_sourcepath} as shared EasyBuild source path"

0 commit comments

Comments
 (0)