From be4e9f9d0292204677719e96190516ee4e68b5e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Thu, 3 Oct 2024 10:35:43 +0200 Subject: [PATCH] include accelerator modules in Lmod cache --- scripts/update_lmod_caches.sh | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/scripts/update_lmod_caches.sh b/scripts/update_lmod_caches.sh index f1765f0c..70737123 100755 --- a/scripts/update_lmod_caches.sh +++ b/scripts/update_lmod_caches.sh @@ -36,17 +36,26 @@ fi # Find all subtrees of supported CPU targets by looking for "modules" directories, and taking their parent directory architectures=$(find ${stack_base_dir}/software/ -maxdepth 5 -type d -name modules -exec dirname {} \;) -# Create/update the Lmod cache for all architectures +# Create/update the Lmod cache for all CPU targets for archdir in ${architectures} do lmod_cache_dir="${archdir}/.lmod/cache" - ${update_lmod_system_cache_files} -d ${lmod_cache_dir} -t ${lmod_cache_dir}/timestamp ${archdir}/modules/all + modulepath="${archdir}/modules/all" + # Find any accelerator targets for this CPU, and add them to the module path, so they will be included in the cache + if [ -d "${archdir}/accel" ]; then + accelerators=$(find ${archdir}/accel -maxdepth 3 -type d -name modules -exec dirname {} \;) + for acceldir in ${accelerators}; do + modulepath="${acceldir}/modules/all:$modulepath" + done + fi + + ${update_lmod_system_cache_files} -d ${lmod_cache_dir} -t ${lmod_cache_dir}/timestamp "${modulepath}" exit_code=$? if [[ ${exit_code} -eq 0 ]]; then - echo_green "Updated the Lmod cache for ${archdir}." + echo_green "Updated the Lmod cache for ${archdir} using MODULEPATH: ${modulepath}." ls -lrt ${lmod_cache_dir} else - echo_red "Updating the Lmod cache failed for ${archdir}." + echo_red "Updating the Lmod cache failed for ${archdir} using MODULEPATH: ${modulepath}." exit ${exit_code} fi done