Skip to content

Commit

Permalink
Merge pull request #721 from casparvl/support_gpus_eessi_remove_software
Browse files Browse the repository at this point in the history
Support gpus eessi remove software
  • Loading branch information
trz42 authored Sep 19, 2024
2 parents 89c49a0 + 4f73277 commit d55af49
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions EESSI-remove-software.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,17 @@ echo ">> Setting up \$MODULEPATH..."
module --force purge
# ignore current $MODULEPATH entirely
module unuse $MODULEPATH

# if an accelerator target is specified, we need to make sure that the CPU-only modules are also still available
if [ ! -z ${EESSI_ACCELERATOR_TARGET} ]; then
CPU_ONLY_MODULES_PATH=$(echo $EASYBUILD_INSTALLPATH | sed "s@/accel/${EESSI_ACCELERATOR_TARGET}@@g")/modules/all
if [ -d ${CPU_ONLY_MODULES_PATH} ]; then
module use ${CPU_ONLY_MODULES_PATH}
else
fatal_error "Derived path to CPU-only modules does not exist: ${CPU_ONLY_MODULES_PATH}"
fi
fi

module use $EASYBUILD_INSTALLPATH/modules/all
if [[ -z ${MODULEPATH} ]]; then
fatal_error "Failed to set up \$MODULEPATH?!"
Expand Down Expand Up @@ -109,8 +120,12 @@ if [ $EUID -eq 0 ]; then
# * [R] $CFGS/s/someapp/someapp-someversion.eb (module: someapp/someversion)
rebuild_apps=$(eb --allow-use-as-root-and-accept-consequences --dry-run-short --rebuild --easystack ${easystack_file} | grep "^ \* \[R\]" | grep -o "module: .*[^)]" | awk '{print $2}')
for app in ${rebuild_apps}; do
app_dir=${EASYBUILD_INSTALLPATH}/software/${app}
app_module=${EASYBUILD_INSTALLPATH}/modules/all/${app}.lua
# Returns e.g. /cvmfs/software.eessi.io/versions/2023.06/software/linux/x86_64/amd/zen2/modules/all:
app_modulepath=$(module --terse av ${app} 2>&1 | head -n 1 | sed 's/://')
# Two dirname invocations, so returns e.g. /cvmfs/software.eessi.io/versions/2023.06/software/linux/x86_64/amd/zen2
app_installprefix=$(dirname $(dirname ${app_modulepath}))
app_dir=${app_installprefix}/software/${app}
app_module=${app_installprefix}/modules/all/${app}.lua
echo_yellow "Removing ${app_dir} and ${app_module}..."
rm -rf ${app_dir}
rm -rf ${app_module}
Expand Down

0 comments on commit d55af49

Please sign in to comment.