Skip to content

Commit 3b30931

Browse files
committed
Print some more details on first initialisation
1 parent 30a8f7c commit 3b30931

8 files changed

Lines changed: 70 additions & 15 deletions

File tree

.github/workflows/scripts/test_init_scripts.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ for shell in ${SHELLS[@]}; do
4242
fi
4343

4444
# TEST 1: Source Script and check Module Output
45-
expected="Module for EESSI/$EESSI_VERSION loaded successfully"
46-
assert "$shell -c 'source init/lmod/$shell' 2>&1 " "${expected}"
45+
expected_pattern=".*EESSI has selected $EESSI_SOFTWARE_SUBDIR_OVERRIDE as the compatible CPU target for EESSI/$EESSI_VERSION.*"
46+
assert_raises "$shell -c 'source init/lmod/$shell' 2>&1 | grep -E \"${expected_pattern}\""
4747

4848
# TEST 2: Check if module overviews first section is the loaded EESSI module
4949
if [ "$shell" = "csh" ]; then
@@ -53,11 +53,11 @@ for shell in ${SHELLS[@]}; do
5353
echo "source init/lmod/$shell" > ~/.cshrc
5454
MODULE_SECTIONS=($($shell -c "module ov" 2>&1 | grep -e '---'))
5555
else
56-
MODULE_SECTIONS=($($shell -c "source init/lmod/$shell 2>/dev/null; module ov 2>&1 | grep -e '---'"))
56+
MODULE_SECTIONS=($($shell -c "source init/lmod/$shell >/dev/null 2>&1; module ov 2>&1 | grep -e '---'"))
5757
fi
5858
PATTERN="/cvmfs/software\.eessi\.io/versions/$EESSI_VERSION/software/linux/$EESSI_SOFTWARE_SUBDIR_OVERRIDE/modules/all"
5959
assert_raises 'echo "${MODULE_SECTIONS[1]}" | grep -E "$PATTERN"'
60-
echo "${MODULE_SECTIONS[1]}" "$PATTERN"
60+
# echo "${MODULE_SECTIONS[1]}" "$PATTERN"
6161

6262
# TEST 3: Check if module overviews second section is the EESSI init module
6363
assert "echo ${MODULE_SECTIONS[4]}" "/cvmfs/software.eessi.io/init/modules"
@@ -66,9 +66,9 @@ for shell in ${SHELLS[@]}; do
6666
# eb --version outputs: "This is EasyBuild 5.1.1 (framework: 5.1.1, easyblocks: 5.1.1) on host ..."
6767
if [ "$shell" = "csh" ]; then
6868
echo "source init/lmod/$shell" > ~/.cshrc
69-
command="$shell -c 'module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}; eb --version' | cut -d \" \" -f4"
69+
command="$shell -c 'module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}; eb --version' | tail -n 1 | awk '{print \$4}'"
7070
else
71-
command="$shell -c 'source init/lmod/$shell 2>/dev/null; module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}; eb --version | cut -d \" \" -f4'"
71+
command="$shell -c 'source init/lmod/$shell >/dev/null 2>&1; module load EasyBuild/${EXPECTED_EASYBUILD_VERSION}; eb --version' | tail -n 1 | awk '{print \$4}'"
7272
fi
7373
assert "$command" "$EXPECTED_EASYBUILD_VERSION"
7474

@@ -81,9 +81,9 @@ for shell in ${SHELLS[@]}; do
8181
fi
8282
# escape the dots in ${EASYBUILD_VERSION}
8383
PATTERN="/cvmfs/software\.eessi\.io/versions/$EESSI_VERSION/software/linux/$EESSI_SOFTWARE_SUBDIR_OVERRIDE/software/EasyBuild/${EXPECTED_EASYBUILD_VERSION//./\\.}/bin/eb"
84-
echo "$EASYBUILD_PATH" | grep -E "$PATTERN"
84+
# echo "$EASYBUILD_PATH" | grep -E "$PATTERN"
8585
assert_raises 'echo "$EASYBUILD_PATH" | grep -E "$PATTERN"'
86-
echo "$EASYBUILD_PATH" "$PATTERN"
86+
# echo "$EASYBUILD_PATH" "$PATTERN"
8787

8888
# TEST 6 and 7: Check the various options (EESSI_DEFAULT_MODULES_APPEND, EESSI_DEFAULT_MODULES_APPEND, EESSI_EXTRA_MODULEPATH) all work
8989
if [ "$shell" = "csh" ]; then
@@ -101,14 +101,14 @@ for shell in ${SHELLS[@]}; do
101101
TEST_MODULEPATH=$($shell -c 'export EESSI_DEFAULT_MODULES_APPEND=append_module ; export EESSI_DEFAULT_MODULES_PREPEND=prepend_module ; export EESSI_EXTRA_MODULEPATH=.github/workflows/modules ; source init/lmod/'"$shell"' 2>/dev/null; echo $MODULEPATH')
102102
fi
103103
LMOD_SYSTEM_DEFAULT_MODULES_PATTERN='^prepend_module:.*:append_module$'
104-
echo "$TEST_LMOD_SYSTEM_DEFAULT_MODULES" AND "$LMOD_SYSTEM_DEFAULT_MODULES_PATTERN"
104+
# echo "$TEST_LMOD_SYSTEM_DEFAULT_MODULES" AND "$LMOD_SYSTEM_DEFAULT_MODULES_PATTERN"
105105
assert_raises 'echo "$TEST_LMOD_SYSTEM_DEFAULT_MODULES" | grep -E "$LMOD_SYSTEM_DEFAULT_MODULES_PATTERN"'
106106
if [ "$shell" = "fish" ]; then
107107
MODULEPATH_PATTERN='\.github/workflows/modules$'
108108
else
109109
MODULEPATH_PATTERN=':\.github/workflows/modules$'
110110
fi
111-
echo "$TEST_MODULEPATH" AND "$MODULEPATH_PATTERN"
111+
# echo "$TEST_MODULEPATH" AND "$MODULEPATH_PATTERN"
112112
assert_raises 'echo "$TEST_MODULEPATH" | grep -E "$MODULEPATH_PATTERN"'
113113

114114
# End Test Suite

.github/workflows/tests_eessi_module.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,11 @@ jobs:
109109
# First do (and undo) the Lmod initialisation
110110
export MODULEPATH=init/modules
111111
# Turn on debug output in case we want to take a look
112-
export EESSI_DEBUG_INIT=true
112+
export EESSI_MODULE_DEBUG_INIT=true
113113
CPU_ARCH=$(./init/eessi_archdetect.sh -a cpupath)
114114
module load EESSI/${{matrix.EESSI_VERSION}}
115-
# EESSI_DEBUG_INIT/EESSI_ARCHDETECT_OPTIONS only relevant for Lmod init
116-
unset EESSI_DEBUG_INIT
115+
# EESSI_MODULE_DEBUG_INIT/EESSI_ARCHDETECT_OPTIONS only relevant for Lmod init
116+
unset EESSI_MODULE_DEBUG_INIT
117117
# Store all relevant environment variables
118118
env | grep -E '(^EESSI_|^LMOD_RC|^LMOD_PACKAGE_PATH|^MODULEPATH)' | grep -v EESSI_ARCHDETECT_OPTIONS | sort > "${moduleoutfile}"
119119
module unload EESSI/${{matrix.EESSI_VERSION}}
@@ -200,7 +200,7 @@ jobs:
200200
fi
201201
202202
# Turn on debug output in case we want to take a look
203-
export EESSI_DEBUG_INIT=true
203+
export EESSI_MODULE_DEBUG_INIT=true
204204
205205
initial_env_file="initial_env.txt"
206206
module_cycled_file="load_unload_cycle.txt"

init/lmod/bash

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
# - EESSI_MODULE_FAMILY_NAME: use the value of the environment variable to set an Lmod family for the EESSI module
2626
# - EESSI_MODULE_STICKY: make the EESSI module sticky
2727
# - EESSI_MODULE_UPDATE_PS1: have the EESSI module update PS1 to give a prompt that is prepended with "{EESSI/...} "
28+
# (- EESSI_MODULE_DEBUG_INIT: enable debug print statements when loading the EESSI module)
2829
#
2930
# Effects:
3031
# - Should always succeed
@@ -86,6 +87,17 @@ if [ -z "$__Init_EESSI_Default_Modules" ]; then
8687
export MODULEPATH="${EESSI_CVMFS_REPO}/init/modules${EESSI_EXTRA_MODULEPATH:+:$EESSI_EXTRA_MODULEPATH}"
8788
. "${EESSI_CVMFS_REPO}/versions/${LMOD_EESSI_VERSION}/compat/linux/$(uname -m)/usr/share/Lmod/init/bash"
8889
module --initial_load --no_redirect restore
90+
91+
# After initialising, we now know the architecture(s) that was/were selected so let's report them
92+
echo "EESSI has selected ${EESSI_SOFTWARE_SUBDIR} as the compatible CPU target for EESSI/${EESSI_VERSION}"
93+
if [ -n "$EESSI_ACCEL_SUBDIR" ]; then
94+
echo "EESSI has selected ${EESSI_ACCEL_SUBDIR} as the compatible accelerator target for EESSI/${EESSI_VERSION}"
95+
else
96+
echo "EESSI did not identify an accelerator on the system"
97+
fi
98+
# If people want more detailed information about what EESSI is doing, they can also set an environment variable
99+
# for additional information.
100+
echo "(for debug information when loading the EESSI module, set the environment variable EESSI_MODULE_DEBUG_INIT)"
89101
else
90102
module reset
91103
fi

init/lmod/csh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,18 @@ if ( ! $?__Init_EESSI_Default_Modules ) then
6565
source "${EESSI_CVMFS_REPO}/versions/${LMOD_EESSI_VERSION}/compat/linux/`uname -m`/usr/share/Lmod/init/csh"
6666

6767
module --initial_load --no_redirect restore
68+
69+
echo "EESSI has selected ${EESSI_SOFTWARE_SUBDIR} as the compatible CPU target for EESSI/${EESSI_VERSION}"
70+
if ( $?EESSI_ACCEL_SUBDIR ) then
71+
if ( "$EESSI_ACCEL_SUBDIR" != "" ) then
72+
echo "EESSI has selected ${EESSI_ACCEL_SUBDIR} as the compatible accelerator target for EESSI/${EESSI_VERSION}"
73+
else
74+
echo "EESSI did not identify an accelerator on the system"
75+
endif
76+
else
77+
echo "EESSI did not identify an accelerator on the system"
78+
endif
79+
echo "(for debug information when loading the EESSI module, set the environment variable EESSI_MODULE_DEBUG_INIT)"
6880
else
6981
module reset
7082
endif

init/lmod/fish

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@ if test -z "$__Init_EESSI_Default_Modules"
5757
. "$EESSI_CVMFS_REPO"/versions/"$LMOD_EESSI_VERSION"/compat/linux/(uname -m)/usr/share/Lmod/init/fish
5858

5959
module --initial_load --no_redirect restore
60+
61+
echo "EESSI has selected $EESSI_SOFTWARE_SUBDIR as the compatible CPU target for EESSI/$EESSI_VERSION"
62+
if test -n "$EESSI_ACCEL_SUBDIR"
63+
echo "EESSI has selected $EESSI_ACCEL_SUBDIR as the compatible accelerator target for EESSI/$EESSI_VERSION"
64+
else
65+
echo "EESSI did not identify an accelerator on the system"
66+
end
67+
echo "(for debug information when loading the EESSI module, set the environment variable EESSI_MODULE_DEBUG to 1)"
6068
else
6169
module reset
6270
end

init/lmod/ksh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,17 @@ if [ -z "$__Init_EESSI_Default_Modules" ]; then
4343
. "${EESSI_CVMFS_REPO}/versions/${LMOD_EESSI_VERSION}/compat/linux/$(uname -m)/usr/share/Lmod/init/ksh"
4444

4545
module --initial_load --no_redirect restore
46+
47+
# After initialising, we now know the architecture(s) that was/were selected so let's report them
48+
echo "EESSI has selected ${EESSI_SOFTWARE_SUBDIR} as the compatible CPU target for EESSI/${EESSI_VERSION}"
49+
if [ -n "$EESSI_ACCEL_SUBDIR" ]; then
50+
echo "EESSI has selected ${EESSI_ACCEL_SUBDIR} as the compatible accelerator target for EESSI/${EESSI_VERSION}"
51+
else
52+
echo "EESSI did not identify an accelerator on the system"
53+
fi
54+
# If people want more detailed information about what EESSI is doing, they can also set an environment variable
55+
# for additional information.
56+
echo "(for debug information when loading the EESSI module, set the environment variable EESSI_MODULE_DEBUG_INIT)"
4657
else
4758
module reset
4859
fi

init/lmod/zsh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,17 @@ if [ -z "$__Init_EESSI_Default_Modules" ]; then
4343
. "${EESSI_CVMFS_REPO}/versions/${LMOD_EESSI_VERSION}/compat/linux/$(uname -m)/usr/share/Lmod/init/zsh"
4444

4545
module --initial_load --no_redirect restore
46+
47+
# After initialising, we now know the architecture(s) that was/were selected so let's report them
48+
echo "EESSI has selected ${EESSI_SOFTWARE_SUBDIR} as the compatible CPU target for EESSI/${EESSI_VERSION}"
49+
if [ -n "$EESSI_ACCEL_SUBDIR" ]; then
50+
echo "EESSI has selected ${EESSI_ACCEL_SUBDIR} as the compatible accelerator target for EESSI/${EESSI_VERSION}"
51+
else
52+
echo "EESSI did not identify an accelerator on the system"
53+
fi
54+
# If people want more detailed information about what EESSI is doing, they can also set an environment variable
55+
# for additional information.
56+
echo "(for debug information when loading the EESSI module, set the environment variable EESSI_MODULE_DEBUG_INIT)"
4657
else
4758
module reset
4859
fi

init/modules/EESSI/2023.06.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ setenv("EESSI_VERSION", eessi_version)
5757
setenv("EESSI_CVMFS_REPO", eessi_repo)
5858
setenv("EESSI_OS_TYPE", eessi_os_type)
5959
function eessiDebug(text)
60-
if (mode() == "load" and os.getenv("EESSI_DEBUG_INIT")) then
60+
-- Allow the old environment or the new one (EESSI_MODULE_...) to enable the debug print statements
61+
if (mode() == "load" and (os.getenv("EESSI_DEBUG_INIT") or os.getenv("EESSI_MODULE_DEBUG_INIT"))) then
6162
LmodMessage(text)
6263
end
6364
end

0 commit comments

Comments
 (0)