@@ -150,6 +150,29 @@ else
150150 # make sure the the software and modules directory exist
151151 # (since it's expected by init/eessi_environment_variables when using archdetect and by the EESSI module)
152152 mkdir -p ${EESSI_PREFIX} /software/${EESSI_OS_TYPE} /${EESSI_SOFTWARE_SUBDIR_OVERRIDE} /{modules,software}
153+
154+ # If EESSI_ACCELERATOR_TARGET_OVERRIDE is defined, we are building for an accelerator target
155+ # In that case, make sure the modulepath for the accelerator subdir exists, otherwise the EESSI module will not
156+ # set EESSI_ACCELERATOR_TARGET and the if-condition later in this script which checks if EESSI_ACCELERATOR_TARGET
157+ # is equal to EESSI_ACCELERATOR_TARGET_OVERRIDE will fail
158+ # See https://github.com/EESSI/software-layer-scripts/pull/59#issuecomment-3173593882
159+ if [ -n $EESSI_ACCELERATOR_TARGET_OVERRIDE ]; then
160+ # Note that ${EESSI_PREFIX}/software/${EESSI_OS_TYPE}/${EESSI_SOFTWARE_SUBDIR_OVERRIDE}/${EESSI_ACCELERATOR_TARGET_OVERRIDE}/modules/all
161+ # is only the correct path if EESSI_ACCEL_SOFTWARE_SUBDIR_OVERRIDE is not set
162+ if [ -z $EESSI_ACCEL_SOFTWARE_SUBDIR_OVERRIDE ]; then
163+ mkdir -p ${EESSI_PREFIX} /software/${EESSI_OS_TYPE} /${EESSI_SOFTWARE_SUBDIR_OVERRIDE} /${EESSI_ACCELERATOR_TARGET_OVERRIDE} /modules/all
164+ else
165+ # At runtime, one might want to use a different CPU subdir for a given accelerator. E.g. one could use
166+ # a zen2 CPU subdir on a zen4 node if the required GPU software isn't available in the zen4 tree.
167+ # At build time, this doesn't make a lot of sense: we'd probably build in a CPU prefix that is different
168+ # from what the code will be optimized for, and we wouldn't want that
169+ # So this message _should_ never be printed...
170+ msg=" When building the software subdirectory for the CPU should almost certainly be that of the host."
171+ msg=" $msg If you think this is incorrect, please implement behaviour that makes sense in "
172+ msg=" $msg EESSI-software-installation.sh, essentially replacing this error."
173+ fatal_error " $msg "
174+ fi
175+ fi
153176 )
154177fi
155178
@@ -294,6 +317,7 @@ source $TOPDIR/load_eessi_extend_module.sh ${EESSI_VERSION}
294317echo " DEBUG: after loading EESSI-extend // EASYBUILD_INSTALLPATH='${EASYBUILD_INSTALLPATH} '"
295318
296319# Install full CUDA SDK and cu* libraries in host_injections
320+ # (This is done *before* configuring EasyBuild as it may rely on an older EB version)
297321# Hardcode this for now, see if it works
298322# TODO: We should make a nice yaml and loop over all CUDA versions in that yaml to figure out what to install
299323# Allow skipping CUDA SDK install in e.g. CI environments
@@ -315,6 +339,7 @@ if nvidia_gpu_available; then
315339 ${EESSI_PREFIX} /scripts/gpu_support/nvidia/link_nvidia_host_libraries.sh
316340fi
317341
342+
318343if [ ! -z " ${shared_fs_path} " ]; then
319344 shared_eb_sourcepath=${shared_fs_path} /easybuild/sources
320345 echo " >> Using ${shared_eb_sourcepath} as shared EasyBuild source path"
323348
324349# if an accelerator target is specified, we need to make sure that the CPU-only modules are also still available
325350if [ ! -z ${EESSI_ACCELERATOR_TARGET} ]; then
326- CPU_ONLY_MODULES_PATH=$( echo $EASYBUILD_INSTALLPATH | sed " s@/accel/ ${EESSI_ACCELERATOR_TARGET} @@g" ) /modules/all
351+ CPU_ONLY_MODULES_PATH=$( echo $EASYBUILD_INSTALLPATH | sed " s@/${EESSI_ACCELERATOR_TARGET} @@g" ) /modules/all
327352 if [ -d ${CPU_ONLY_MODULES_PATH} ]; then
328353 module use ${CPU_ONLY_MODULES_PATH}
329354 else
@@ -414,7 +439,7 @@ lmod_rc_file="$LMOD_CONFIG_DIR/lmodrc.lua"
414439echo " DEBUG: lmod_rc_file='${lmod_rc_file} '"
415440if [[ ! -z ${EESSI_ACCELERATOR_TARGET} ]]; then
416441 # EESSI_ACCELERATOR_TARGET is set, so let's remove the accelerator path from $lmod_rc_file
417- lmod_rc_file=$( echo ${lmod_rc_file} | sed " s@/accel/ ${EESSI_ACCELERATOR_TARGET} @@" )
442+ lmod_rc_file=$( echo ${lmod_rc_file} | sed " s@/${EESSI_ACCELERATOR_TARGET} @@" )
418443 echo " Path to lmodrc.lua changed to '${lmod_rc_file} '"
419444fi
420445lmodrc_changed=$( cat ${pr_diff} | grep ' ^+++' | cut -f2 -d' ' | sed ' s@^[a-z]/@@g' | grep ' ^create_lmodrc.py$' > /dev/null; echo $? )
427452lmod_sitepackage_file=" $LMOD_PACKAGE_PATH /SitePackage.lua"
428453if [[ ! -z ${EESSI_ACCELERATOR_TARGET} ]]; then
429454 # EESSI_ACCELERATOR_TARGET is set, so let's remove the accelerator path from $lmod_sitepackage_file
430- lmod_sitepackage_file=$( echo ${lmod_sitepackage_file} | sed " s@/accel/ ${EESSI_ACCELERATOR_TARGET} @@" )
455+ lmod_sitepackage_file=$( echo ${lmod_sitepackage_file} | sed " s@/${EESSI_ACCELERATOR_TARGET} @@" )
431456 echo " Path to SitePackage.lua changed to '${lmod_sitepackage_file} '"
432457fi
433458sitepackage_changed=$( cat ${pr_diff} | grep ' ^+++' | cut -f2 -d' ' | sed ' s@^[a-z]/@@g' | grep ' ^create_lmodsitepackage.py$' > /dev/null; echo $? )
0 commit comments