Skip to content

Commit

Permalink
Merge pull request #475 from ocaisa/always_lmod_rc
Browse files Browse the repository at this point in the history
Always set `$LMOD_RC` (even when `EESSI_BASIC_ENV` is set), and make sure loading CUDA apps always work when building
  • Loading branch information
boegel authored Mar 13, 2024
2 parents 222d929 + 8491f9f commit bc84aec
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
6 changes: 6 additions & 0 deletions eessi_container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,12 @@ if [[ ${SETUP_NVIDIA} -eq 1 ]]; then
mkdir -p ${EESSI_USR_LOCAL_CUDA}
BIND_PATHS="${BIND_PATHS},${EESSI_VAR_LOG}:/var/log,${EESSI_USR_LOCAL_CUDA}:/usr/local/cuda"
[[ ${VERBOSE} -eq 1 ]] && echo "BIND_PATHS=${BIND_PATHS}"
if [[ "${NVIDIA_MODE}" == "install" ]] ; then
# We need to "trick" our LMOD_RC file to allow us to load CUDA modules even without a CUDA driver
# (this works because we build within a container and the LMOD_RC recognises that)
touch ${EESSI_TMPDIR}/libcuda.so
export SINGULARITY_CONTAINLIBS="${EESSI_TMPDIR}/libcuda.so"
fi
fi
fi

Expand Down
16 changes: 9 additions & 7 deletions init/eessi_environment_variables
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@ if [ -d $EESSI_PREFIX ]; then

show_msg "Using ${EESSI_SOFTWARE_SUBDIR} as software subdirectory."
export EESSI_SOFTWARE_PATH=$EESSI_PREFIX/software/$EESSI_OS_TYPE/$EESSI_SOFTWARE_SUBDIR

# Configure our LMOD_RC file
export LMOD_RC="$EESSI_SOFTWARE_PATH/.lmod/lmodrc.lua"
if [ -f $LMOD_RC ]; then
show_msg "Found Lmod configuration file at $LMOD_RC"
else
error "Lmod configuration file not found at $LMOD_RC"
fi

if [ ! -z $EESSI_BASIC_ENV ]; then
show_msg "Only setting up basic environment, so we're done"
elif [ -d $EESSI_SOFTWARE_PATH ]; then
Expand All @@ -76,13 +85,6 @@ if [ -d $EESSI_PREFIX ]; then
false
fi

export LMOD_RC="$EESSI_SOFTWARE_PATH/.lmod/lmodrc.lua"
if [ -f $LMOD_RC ]; then
show_msg "Found Lmod configuration file at $LMOD_RC"
else
error "Lmod configuration file not found at $LMOD_RC"
fi

else
error "EESSI software layer at $EESSI_SOFTWARE_PATH not found!"
fi
Expand Down

0 comments on commit bc84aec

Please sign in to comment.