Skip to content

Commit b72957c

Browse files
authored
Merge pull request #11 from boegel/init_scripts_fix_version
make sure that copied scripts in `init/` and `scripts/` use right EESSI version
2 parents ff7baef + be30098 commit b72957c

File tree

13 files changed

+73
-26
lines changed

13 files changed

+73
-26
lines changed

.github/workflows/test-eb-hooks.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ on:
66
workflow_dispatch:
77
permissions:
88
contents: read # to fetch code (actions/checkout)
9-
env:
10-
EESSI_VERSION: '2023.06'
119
jobs:
1210
check_eb_hooks:
1311
runs-on: ubuntu-24.04
12+
strategy:
13+
matrix:
14+
EESSI_VERSION:
15+
- '2023.06'
1416
steps:
1517
- name: Check out software-layer repository
1618
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
@@ -50,7 +52,10 @@ jobs:
5052
git show origin/${{ github.base_ref }}:$FILE > "$TEMP_FILE"
5153
fi
5254
55+
# replace <EESSI_VERSION> placeholder (as is also done in install_scripts.sh)
56+
sed -i "s/<EESSI_VERSION>/${{matrix.EESSI_VERSION}}/g" "${TEMP_FILE}"
57+
5358
# Compare the hooks to what is shipped in the repository
54-
source /cvmfs/software.eessi.io/versions/${EESSI_VERSION}/init/bash
59+
source /cvmfs/software.eessi.io/versions/${{matrix.EESSI_VERSION}}/init/bash
5560
module load EESSI-extend
5661
diff "$TEMP_FILE" "$EASYBUILD_HOOKS"

.github/workflows/tests_archdetect_nvidia_gpu.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ jobs:
1717
- 2xa100 # cc80, supported with (atleast) zen2 CPU
1818
- 4xa100 # cc80, supported with (atleast) zen2 CPU
1919
- cc01 # non-existing GPU
20+
EESSI_VERSION:
21+
- '2023.06'
2022
fail-fast: false
2123
steps:
2224
- name: checkout
@@ -31,6 +33,10 @@ jobs:
3133
cvmfs_http_proxy: DIRECT
3234
cvmfs_repositories: software.eessi.io
3335

36+
- name: Fix EESSI version in init scripts
37+
run: |
38+
sed -i "s/__EESSI_VERSION_DEFAULT__/${{matrix.EESSI_VERSION}}/g" init/eessi_defaults
39+
3440
- name: test accelerator detection
3541
run: |
3642
export EESSI_SOFTWARE_SUBDIR_OVERRIDE='x86_64/amd/zen2'
@@ -68,7 +74,7 @@ jobs:
6874
match=$(grep "${pattern}" init.out || true)
6975
test "x${match}" = "x" || (echo "unexpected match found for '${pattern}' in init output" && exit 1)
7076
71-
pattern="Prepending /cvmfs/software.eessi.io/versions/2023.06/software/linux/.*/accel/.*/modules/all to \$MODULEPATH"
77+
pattern="Prepending /cvmfs/software.eessi.io/versions/${{matrix.EESSI_VERSION}}/software/linux/.*/accel/.*/modules/all to \$MODULEPATH"
7278
echo ">>> checking for lack of pattern '${pattern}' in init output..."
7379
match=$(grep "${pattern}" init.out || true)
7480
test "x${match}" = "x" || (echo "unexpected match found for '${pattern}' in init output" && exit 1)
@@ -79,19 +85,19 @@ jobs:
7985
echo ">>> checking for pattern '${pattern}' in init output..."
8086
grep "${pattern}" init.out || (echo "FAILED 1" || exit 1)
8187
82-
pattern="Prepending /cvmfs/software.eessi.io/versions/2023.06/software/linux/.*/accel/.*/modules/all to \$MODULEPATH"
88+
pattern="Prepending /cvmfs/software.eessi.io/versions/${{matrix.EESSI_VERSION}}/software/linux/.*/accel/.*/modules/all to \$MODULEPATH"
8389
echo ">>> checking for lack of pattern '${pattern}' in init output..."
8490
match=$(grep "${pattern}" init.out || true)
8591
test "x${match}" = "x" || (echo "unexpected match found for '${pattern}' in init output" && exit 1)
8692
8793
else
8894
echo ">>> checking for 'accel/nvidia/cc80' in init output..."
8995
grep "archdetect found supported accelerator for CPU target x86_64/amd/zen2: accel/nvidia/cc80" init.out || (echo "FAILED 2" && exit 1)
90-
grep "Prepending /cvmfs/software.eessi.io/versions/2023.06/software/linux/x86_64/amd/zen2/accel/nvidia/cc80/modules/all to \$MODULEPATH" init.out || (echo "FAILED 3" && exit 1)
96+
grep "Prepending /cvmfs/software.eessi.io/versions/${{matrix.EESSI_VERSION}}/software/linux/x86_64/amd/zen2/accel/nvidia/cc80/modules/all to \$MODULEPATH" init.out || (echo "FAILED 3" && exit 1)
9197
fi
9298
9399
echo ">>> checking last line of init output..."
94-
tail -1 init.out | grep "Environment set up to use EESSI (2023.06), have fun!" || (echo "FAILED, full init utput:" && cat init.out && exit 1)
100+
tail -1 init.out | grep "Environment set up to use EESSI (${{matrix.EESSI_VERSION}}), have fun!" || (echo "FAILED, full init utput:" && cat init.out && exit 1)
95101
96102
echo "All checks on init output PASSED"
97103
else
@@ -118,7 +124,7 @@ jobs:
118124
echo ">>> checking for 'accel/nvidia/cc80' in init output..."
119125
grep "archdetect found supported accelerator for CPU target x86_64/amd/zen3: accel/nvidia/cc80" init.out || (echo "FAILED 1" && exit 1)
120126
grep "Using x86_64/amd/zen2 as software subdirectory" init.out || (echo "FAILED 2" && exit 1)
121-
grep "Prepending /cvmfs/software.eessi.io/versions/2023.06/software/linux/x86_64/amd/zen2/modules/all to \$MODULEPATH" init.out || (echo "FAILED 3" && exit 1)
122-
grep "Prepending /cvmfs/software.eessi.io/versions/2023.06/software/linux/x86_64/amd/zen3/accel/nvidia/cc80/modules/all to \$MODULEPATH" init.out || (echo "FAILED 4" && exit 1)
127+
grep "Prepending /cvmfs/software.eessi.io/versions/${{matrix.EESSI_VERSION}}/software/linux/x86_64/amd/zen2/modules/all to \$MODULEPATH" init.out || (echo "FAILED 3" && exit 1)
128+
grep "Prepending /cvmfs/software.eessi.io/versions/${{matrix.EESSI_VERSION}}/software/linux/x86_64/amd/zen3/accel/nvidia/cc80/modules/all to \$MODULEPATH" init.out || (echo "FAILED 4" && exit 1)
123129
124130
echo "All checks on init output PASSED"

.github/workflows/tests_eessi_module.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
fail-fast: false
1414
matrix:
1515
EESSI_VERSION:
16-
- 2023.06
16+
- '2023.06'
1717
steps:
1818
- name: Check out software-layer repository
1919
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
@@ -68,7 +68,7 @@ jobs:
6868
fail-fast: false
6969
matrix:
7070
EESSI_VERSION:
71-
- 2023.06
71+
- '2023.06'
7272
EESSI_SOFTWARE_SUBDIR_OVERRIDE:
7373
- x86_64/amd/zen3
7474
- x86_64/amd/zen4
@@ -84,6 +84,10 @@ jobs:
8484
cvmfs_config_package: https://github.com/EESSI/filesystem-layer/releases/download/latest/cvmfs-config-eessi_latest_all.deb
8585
cvmfs_http_proxy: DIRECT
8686
cvmfs_repositories: software.eessi.io
87+
88+
- name: Fix EESSI version in init scripts
89+
run: |
90+
sed -i "s/__EESSI_VERSION_DEFAULT__/${{matrix.EESSI_VERSION}}/g" init/eessi_defaults
8791
8892
- name: Test for expected variables match between Lmod init script and original bash script
8993
run: |
@@ -141,7 +145,7 @@ jobs:
141145
fail-fast: false
142146
matrix:
143147
EESSI_VERSION:
144-
- 2023.06
148+
- '2023.06'
145149
EESSI_SOFTWARE_SUBDIR_OVERRIDE:
146150
- none
147151
- x86_64/amd/zen2

.github/workflows/tests_init_module.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
fail-fast: false
1515
matrix:
1616
EESSI_VERSION:
17-
- 2023.06
17+
- '2023.06'
1818
EESSI_SOFTWARE_SUBDIR_OVERRIDE:
1919
- x86_64/intel/haswell
2020
steps:
@@ -27,6 +27,12 @@ jobs:
2727
cvmfs_config_package: https://github.com/EESSI/filesystem-layer/releases/download/latest/cvmfs-config-eessi_latest_all.deb
2828
cvmfs_http_proxy: DIRECT
2929
cvmfs_repositories: software.eessi.io
30+
31+
- name: Fix EESSI version in lmod init scripts
32+
run: |
33+
for shell in $(ls init/lmod); do
34+
sed -i "s/__EESSI_VERSION_DEFAULT__/${{matrix.EESSI_VERSION}}/g" init/lmod/${shell}
35+
done
3036
3137
- name: Clone assert.sh script
3238
run: git clone https://github.com/lehmannro/assert.sh.git

eb_hooks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ def parse_hook_zen4_module_only(ec, eprefix):
408408
# Need to escape newline character so that the newline character actually ends up in the module file
409409
# (otherwise, it splits the string, and a 2-line string ends up in the modulefile, resulting in syntax error)
410410
errmsg = "EasyConfigs using toolchains based on GCCcore-12.2.0 are not supported for the Zen4 architecture.\\n"
411-
errmsg += "See https://www.eessi.io/docs/known_issues/eessi-2023.06/#gcc-1220-and-foss-2022b-based-modules-cannot-be-loaded-on-zen4-architecture"
411+
errmsg += "See https://www.eessi.io/docs/known_issues/eessi-<EESSI_VERSION>/#gcc-1220-and-foss-2022b-based-modules-cannot-be-loaded-on-zen4-architecture"
412412
ec['modluafooter'] = 'if (not os.getenv("%s")) then LmodError("%s") end' % (env_varname, errmsg)
413413

414414

init/eessi_defaults

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
# license: GPLv2
99
#
1010

11+
export EESSI_VERSION_DEFAULT='__EESSI_VERSION_DEFAULT__'
12+
1113
# use different defaults for RISC-V, as we want to redirect to the riscv.eessi.io repo
1214
if [[ $(uname -m) == "riscv64" ]]; then
1315
export EESSI_CVMFS_REPO="${EESSI_CVMFS_REPO_OVERRIDE:=/cvmfs/riscv.eessi.io}"
@@ -20,7 +22,7 @@ if [[ $(uname -m) == "riscv64" ]]; then
2022
fi
2123
else
2224
export EESSI_CVMFS_REPO="${EESSI_CVMFS_REPO_OVERRIDE:=/cvmfs/software.eessi.io}"
23-
export EESSI_VERSION="${EESSI_VERSION_OVERRIDE:=2023.06}"
25+
export EESSI_VERSION="${EESSI_VERSION_OVERRIDE:=${EESSI_VERSION_DEFAULT}}"
2426
fi
2527
# use archdetect by default, unless otherwise specified
2628
export EESSI_USE_ARCHDETECT="${EESSI_USE_ARCHDETECT:=1}"

init/lmod/bash

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Choose an EESSI CVMFS repository
22
EESSI_CVMFS_REPO="${EESSI_CVMFS_REPO:-/cvmfs/software.eessi.io}"
33
# Choose an EESSI version
4-
EESSI_VERSION="${EESSI_VERSION:-2023.06}"
4+
EESSI_VERSION_DEFAULT="__EESSI_VERSION_DEFAULT__"
5+
EESSI_VERSION="${EESSI_VERSION:-${EESSI_VERSION_DEFAULT}}"
56
# Path to top-level module tree
67
export MODULEPATH="${EESSI_CVMFS_REPO}/versions/${EESSI_VERSION}/init/modules"
78
. "${EESSI_CVMFS_REPO}/versions/${EESSI_VERSION}/compat/linux/$(uname -m)/usr/share/Lmod/init/bash"

init/lmod/csh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Choose an EESSI CVMFS repository
22
if (! $?EESSI_CVMFS_REPO) then; set EESSI_CVMFS_REPO = "/cvmfs/software.eessi.io"; endif
33
# Choose an EESSI version
4-
if (! $?EESSI_VERSION) then; set EESSI_VERSION = "2023.06"; endif
4+
setenv EESSI_VERSION_DEFAULT "__EESSI_VERSION_DEFAULT__"
5+
if (! $?EESSI_VERSION) then; set EESSI_VERSION = "${EESSI_VERSION_DEFAULT}"; endif
56
# Path to top-level module tree
67
setenv MODULEPATH "${EESSI_CVMFS_REPO}/versions/${EESSI_VERSION}/init/modules"
78
source "${EESSI_CVMFS_REPO}/versions/${EESSI_VERSION}/compat/linux/$(uname -m)/usr/share/Lmod/init/csh"

init/lmod/fish

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Choose an EESSI CVMFS repository
22
set EESSI_CVMFS_REPO (set -q EESSI_CVMFS_REPO; and echo "$EESSI_CVMFS_REPO"; or echo "/cvmfs/software.eessi.io")
33
# Choose an EESSI version
4-
set EESSI_VERSION (set -q EESSI_VERSION; and echo "$EESSI_VERSION"; or echo "2023.06")
4+
set EESSI_VERSION_DEFAULT "__EESSI_VERSION_DEFAULT__"
5+
set EESSI_VERSION (set -q EESSI_VERSION; and echo "$EESSI_VERSION"; or echo "$EESSI_VERSION_DEFAULT")
56
# Path to top-level module tree
67
set -x MODULEPATH "$EESSI_CVMFS_REPO"/versions/"$EESSI_VERSION"/init/modules
78
. "$EESSI_CVMFS_REPO"/versions/"$EESSI_VERSION"/compat/linux/(uname -m)/usr/share/Lmod/init/fish

init/lmod/ksh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Choose an EESSI CVMFS repository
22
EESSI_CVMFS_REPO="${EESSI_CVMFS_REPO:-/cvmfs/software.eessi.io}"
33
# Choose an EESSI version
4-
EESSI_VERSION="${EESSI_VERSION:-2023.06}"
4+
EESSI_VERSION_DEFAULT="__EESSI_VERSION_DEFAULT__"
5+
EESSI_VERSION="${EESSI_VERSION:-${EESSI_VERSION_DEFAULT}}"
56
# Path to top-level module tree
67
export MODULEPATH="${EESSI_CVMFS_REPO}/versions/${EESSI_VERSION}/init/modules"
78
. "${EESSI_CVMFS_REPO}/versions/${EESSI_VERSION}/compat/linux/$(uname -m)/usr/share/Lmod/init/ksh"

init/lmod/zsh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Choose an EESSI CVMFS repository
22
EESSI_CVMFS_REPO="${EESSI_CVMFS_REPO:-/cvmfs/software.eessi.io}"
33
# Choose an EESSI version
4-
EESSI_VERSION="${EESSI_VERSION:-2023.06}"
4+
EESSI_VERSION_DEFAULT="__EESSI_VERSION_DEFAULT__"
5+
EESSI_VERSION="${EESSI_VERSION:-${EESSI_VERSION_DEFAULT}}"
56
# Path to top-level module tree
67
export MODULEPATH="${EESSI_CVMFS_REPO}/versions/${EESSI_VERSION}/init/modules"
78
. "${EESSI_CVMFS_REPO}/versions/${EESSI_VERSION}/compat/linux/$(uname -m)/usr/share/Lmod/init/zsh"

init/modules/EESSI/2023.06.lua

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ if (subprocess("uname -m"):gsub("\n$","") == "riscv64") then
2121
end
2222
local eessi_prefix = pathJoin(eessi_repo, "versions", eessi_version)
2323
local eessi_os_type = "linux"
24+
setenv("EESSI_VERSION_DEFAULT", eessi_version)
2425
setenv("EESSI_VERSION", eessi_version)
2526
setenv("EESSI_CVMFS_REPO", eessi_repo)
2627
setenv("EESSI_OS_TYPE", eessi_os_type)
@@ -80,18 +81,18 @@ local archdetect_accel = archdetect_accel()
8081
-- eessi_cpu_family is derived from the archdetect match, e.g., x86_64
8182
local eessi_cpu_family = archdetect:match("([^/]+)")
8283
local eessi_software_subdir = archdetect
83-
-- eessi_eprefix is the base location of the compat layer, e.g., /cvmfs/software.eessi.io/versions/2023.06/compat/linux/x86_64
84+
-- eessi_eprefix is the base location of the compat layer, e.g., /cvmfs/software.eessi.io/versions/<EESSI_VERSION>/compat/linux/x86_64
8485
local eessi_eprefix = pathJoin(eessi_prefix, "compat", eessi_os_type, eessi_cpu_family)
8586
-- eessi_software_path is the location of the software installations, e.g.,
86-
-- /cvmfs/software.eessi.io/versions/2023.06/software/linux/x86_64/amd/zen3
87+
-- /cvmfs/software.eessi.io/versions/<EESSI_VERSION>/software/linux/x86_64/amd/zen3
8788
local eessi_software_path = pathJoin(eessi_prefix, "software", eessi_os_type, eessi_software_subdir)
8889
local eessi_modules_subdir = pathJoin("modules", "all")
8990
-- eessi_module_path is the location of the _CPU_ module files, e.g.,
90-
-- /cvmfs/software.eessi.io/versions/2023.06/software/linux/x86_64/amd/zen3/modules/all
91+
-- /cvmfs/software.eessi.io/versions/<EESSI_VERSION>/software/linux/x86_64/amd/zen3/modules/all
9192
local eessi_module_path = pathJoin(eessi_software_path, eessi_modules_subdir)
9293
local eessi_site_software_path = string.gsub(eessi_software_path, "versions", "host_injections")
9394
-- Site module path is the same as the EESSI one, but with `versions` changed to `host_injections`, e.g.,
94-
-- /cvmfs/software.eessi.io/host_injections/2023.06/software/linux/x86_64/amd/zen3/modules/all
95+
-- /cvmfs/software.eessi.io/host_injections/<EESSI_VERSION>/software/linux/x86_64/amd/zen3/modules/all
9596
local eessi_site_module_path = pathJoin(eessi_site_software_path, eessi_modules_subdir)
9697
setenv("EPREFIX", eessi_eprefix)
9798
eessiDebug("Setting EPREFIX to " .. eessi_eprefix)
@@ -134,10 +135,10 @@ if not (archdetect_accel == nil or archdetect_accel == '') then
134135
-- The CPU subdirectory of the accelerator installations is _usually_ the same as host CPU, but this can be overridden
135136
eessi_accel_software_subdir = os.getenv("EESSI_ACCEL_SOFTWARE_SUBDIR_OVERRIDE") or eessi_software_subdir
136137
-- CPU location of the accelerator installations, e.g.,
137-
-- /cvmfs/software.eessi.io/versions/2023.06/software/linux/x86_64/amd/zen3
138+
-- /cvmfs/software.eessi.io/versions/<EESSI_VERSION>/software/linux/x86_64/amd/zen3
138139
eessi_accel_software_path = pathJoin(eessi_prefix, "software", eessi_os_type, eessi_accel_software_subdir)
139140
-- location of the accelerator modules, e.g.,
140-
-- /cvmfs/software.eessi.io/versions/2023.06/software/linux/x86_64/amd/zen3/accel/nvidia/cc80/modules/all
141+
-- /cvmfs/software.eessi.io/versions/<EESSI_VERSION>/software/linux/x86_64/amd/zen3/accel/nvidia/cc80/modules/all
141142
eessi_module_path_accel = pathJoin(eessi_accel_software_path, archdetect_accel, eessi_modules_subdir)
142143
eessiDebug("Checking if " .. eessi_module_path_accel .. " exists")
143144
if isDir(eessi_module_path_accel) then

install_scripts.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,3 +187,21 @@ hook_files=(
187187
eb_hooks.py
188188
)
189189
copy_files_by_list ${TOPDIR} ${INSTALL_PREFIX}/init/easybuild "${hook_files[@]}"
190+
191+
# replace version placeholders in scripts;
192+
# note: the commands below are always run, regardless of whether the scripts were changed,
193+
# but that should be fine (no changes are made if version placeholder is not present anymore)
194+
195+
# make sure that scripts in init/ and scripts/ use correct EESSI version
196+
sed -i "s/__EESSI_VERSION_DEFAULT__/${EESSI_VERSION}/g" ${INSTALL_PREFIX}/init/eessi_defaults
197+
198+
# replace placeholder for default EESSI version in Lmod init scripts
199+
for shell in $(ls ${INSTALL_PREFIX}/init/lmod); do
200+
sed -i "s/__EESSI_VERSION_DEFAULT__/${EESSI_VERSION}/g" ${INSTALL_PREFIX}/init/lmod/${shell}
201+
done
202+
203+
# replace EESSI version used in comments in EESSI module
204+
sed -i "s@/<EESSI_VERSION>/@/${EESSI_VERSION}/@g" ${INSTALL_PREFIX}/init/modules/EESSI/${EESSI_VERSION}.lua
205+
206+
# replace EESSI version used in EasyBuild hooks
207+
sed -i "s@/<EESSI_VERSION>/@/${EESSI_VERSION}/@g" ${INSTALL_PREFIX}/init/easybuild/eb_hooks.py

0 commit comments

Comments
 (0)