Skip to content

Commit

Permalink
Merge pull request #200 from bedroge/accel_lmod_cache
Browse files Browse the repository at this point in the history
Include accelerator modules in Lmod caches
  • Loading branch information
boegel authored Oct 3, 2024
2 parents 841290f + be4e9f9 commit ca1aa51
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions scripts/update_lmod_caches.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit ca1aa51

Please sign in to comment.