Skip to content

Commit bc84aec

Browse files
authored
Merge pull request #475 from ocaisa/always_lmod_rc
Always set `$LMOD_RC` (even when `EESSI_BASIC_ENV` is set), and make sure loading CUDA apps always work when building
2 parents 222d929 + 8491f9f commit bc84aec

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

eessi_container.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,12 @@ if [[ ${SETUP_NVIDIA} -eq 1 ]]; then
457457
mkdir -p ${EESSI_USR_LOCAL_CUDA}
458458
BIND_PATHS="${BIND_PATHS},${EESSI_VAR_LOG}:/var/log,${EESSI_USR_LOCAL_CUDA}:/usr/local/cuda"
459459
[[ ${VERBOSE} -eq 1 ]] && echo "BIND_PATHS=${BIND_PATHS}"
460+
if [[ "${NVIDIA_MODE}" == "install" ]] ; then
461+
# We need to "trick" our LMOD_RC file to allow us to load CUDA modules even without a CUDA driver
462+
# (this works because we build within a container and the LMOD_RC recognises that)
463+
touch ${EESSI_TMPDIR}/libcuda.so
464+
export SINGULARITY_CONTAINLIBS="${EESSI_TMPDIR}/libcuda.so"
465+
fi
460466
fi
461467
fi
462468

init/eessi_environment_variables

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,15 @@ if [ -d $EESSI_PREFIX ]; then
5050

5151
show_msg "Using ${EESSI_SOFTWARE_SUBDIR} as software subdirectory."
5252
export EESSI_SOFTWARE_PATH=$EESSI_PREFIX/software/$EESSI_OS_TYPE/$EESSI_SOFTWARE_SUBDIR
53+
54+
# Configure our LMOD_RC file
55+
export LMOD_RC="$EESSI_SOFTWARE_PATH/.lmod/lmodrc.lua"
56+
if [ -f $LMOD_RC ]; then
57+
show_msg "Found Lmod configuration file at $LMOD_RC"
58+
else
59+
error "Lmod configuration file not found at $LMOD_RC"
60+
fi
61+
5362
if [ ! -z $EESSI_BASIC_ENV ]; then
5463
show_msg "Only setting up basic environment, so we're done"
5564
elif [ -d $EESSI_SOFTWARE_PATH ]; then
@@ -76,13 +85,6 @@ if [ -d $EESSI_PREFIX ]; then
7685
false
7786
fi
7887

79-
export LMOD_RC="$EESSI_SOFTWARE_PATH/.lmod/lmodrc.lua"
80-
if [ -f $LMOD_RC ]; then
81-
show_msg "Found Lmod configuration file at $LMOD_RC"
82-
else
83-
error "Lmod configuration file not found at $LMOD_RC"
84-
fi
85-
8688
else
8789
error "EESSI software layer at $EESSI_SOFTWARE_PATH not found!"
8890
fi

0 commit comments

Comments
 (0)