Skip to content

Commit f400e47

Browse files
committed
Take all sugestions into account
Signed-off-by: laraPPr <[email protected]>
1 parent a741480 commit f400e47

File tree

4 files changed

+9
-24
lines changed

4 files changed

+9
-24
lines changed

EESSI-install-software.sh

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -310,18 +310,10 @@ else
310310
fi
311311

312312
# Install NVIDIA drivers in host_injections (if they exist)
313-
# Accept that this may fail
314-
set +e
315-
verify_nvidia-smi
316-
ec=$?
317-
if [ ${ec} -eq 0 ]; then
318-
echo "Installing NVIDIA drivers for use in prefix shell...""
319-
export LD_LIBRARY_PATH="/.singularity.d/libs:${LD_LIBRARY_PATH}"
313+
if nvidia_gpu_available; then
314+
echo "Installing NVIDIA drivers for use in prefix shell..."
320315
${EESSI_PREFIX}/scripts/gpu_support/nvidia/link_nvidia_host_libraries.sh
321-
elif [ ${ec} -eq 1 ]; then
322-
export LD_LIBRARY_PATH="/.singularity.d/libs:${LD_LIBRARY_PATH}"
323316
fi
324-
set -e
325317

326318
if [ ! -z "${shared_fs_path}" ]; then
327319
shared_eb_sourcepath=${shared_fs_path}/easybuild/sources

bot/build.sh

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -220,18 +220,11 @@ BUILD_STEP_ARGS+=("--save" "${TARBALL_TMP_BUILD_STEP_DIR}")
220220
BUILD_STEP_ARGS+=("--storage" "${STORAGE}")
221221

222222
# add options required to handle NVIDIA support
223-
# Accept that this may fail
224-
set +e
225-
verify_nvidia-smi
226-
ec=$?
227-
if [ ${ec} -eq 0 ]; then
223+
if nvidia_gpu_available; then
228224
BUILD_STEP_ARGS+=("--nvidia" "all")
229-
elif [ ${ec} -eq 1 ]; then
230-
BUILD_STEP_ARGS+=("--nvidia" "install")
231-
elif [ ${ec} -eq 2 ]; then
225+
else
232226
BUILD_STEP_ARGS+=("--nvidia" "install")
233227
fi
234-
set -e
235228

236229
# Retain location for host injections so we don't reinstall CUDA
237230
# (Always need to run the driver installation as available driver may change)

bot/test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ fi
225225
TEST_STEP_ARGS+=("--extra-bind-paths" "/sys/fs/cgroup:/hostsys/fs/cgroup:ro")
226226

227227
# add options required to handle NVIDIA support
228-
if verify_nvidia-smi; then
228+
if nvidia_gpu_available; then
229229
TEST_STEP_ARGS+=("--nvidia" "run")
230230
fi
231231

scripts/utils.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,21 +148,21 @@ function get_ipv4_address {
148148
return 0
149149
}
150150

151-
function verify_nvidia-smi {
151+
function nvidia_gpu_available {
152152
if command_exists "nvidia-smi"; then
153-
nvidia-smi --version
153+
# We are careful here in case we are running in a container and LD_LIBARY_PATH has been wiped
154+
LD_LIBRARY_PATH="/.singularity.d/libs:${LD_LIBRARY_PATH}" nvidia-smi --version
154155
ec=$?
155156
if [ ${ec} -eq 0 ]; then
156157
echo "Command 'nvidia-smi' found."
157158
return 0
158159
else
159160
echo "Warning: command 'nvidia-smi' found, but 'nvidia-smi --version' did not run succesfully."
160161
echo "This script now assumes this is NOT a GPU node."
161-
echo "If, and only if, the current node actually does contain Nvidia GPUs, this should be considered an error."
162162
return 1
163163
fi
164164
else
165-
echo "No 'nvidia-smi' found, no available GPU but allowing overriding this check"
165+
echo "No 'nvidia-smi' found, no available GPU."
166166
return 2
167167
fi
168168
}

0 commit comments

Comments
 (0)