Skip to content

Commit ca1aa51

Browse files
authored
Merge pull request #200 from bedroge/accel_lmod_cache
Include accelerator modules in Lmod caches
2 parents 841290f + be4e9f9 commit ca1aa51

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

scripts/update_lmod_caches.sh

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,26 @@ fi
3636
# Find all subtrees of supported CPU targets by looking for "modules" directories, and taking their parent directory
3737
architectures=$(find ${stack_base_dir}/software/ -maxdepth 5 -type d -name modules -exec dirname {} \;)
3838

39-
# Create/update the Lmod cache for all architectures
39+
# Create/update the Lmod cache for all CPU targets
4040
for archdir in ${architectures}
4141
do
4242
lmod_cache_dir="${archdir}/.lmod/cache"
43-
${update_lmod_system_cache_files} -d ${lmod_cache_dir} -t ${lmod_cache_dir}/timestamp ${archdir}/modules/all
43+
modulepath="${archdir}/modules/all"
44+
# Find any accelerator targets for this CPU, and add them to the module path, so they will be included in the cache
45+
if [ -d "${archdir}/accel" ]; then
46+
accelerators=$(find ${archdir}/accel -maxdepth 3 -type d -name modules -exec dirname {} \;)
47+
for acceldir in ${accelerators}; do
48+
modulepath="${acceldir}/modules/all:$modulepath"
49+
done
50+
fi
51+
52+
${update_lmod_system_cache_files} -d ${lmod_cache_dir} -t ${lmod_cache_dir}/timestamp "${modulepath}"
4453
exit_code=$?
4554
if [[ ${exit_code} -eq 0 ]]; then
46-
echo_green "Updated the Lmod cache for ${archdir}."
55+
echo_green "Updated the Lmod cache for ${archdir} using MODULEPATH: ${modulepath}."
4756
ls -lrt ${lmod_cache_dir}
4857
else
49-
echo_red "Updating the Lmod cache failed for ${archdir}."
58+
echo_red "Updating the Lmod cache failed for ${archdir} using MODULEPATH: ${modulepath}."
5059
exit ${exit_code}
5160
fi
5261
done

0 commit comments

Comments
 (0)