Skip to content

Commit 184dc6a

Browse files
authored
Merge pull request #222 from casparvl/allow_cpu_family_override_and_respect_riscv_override
Allow different overrides for compat (i.e. CPU family) and modules (i.e. SOFTWARE_SUBDIR)
2 parents 38b213a + e1635af commit 184dc6a

2 files changed

Lines changed: 54 additions & 2 deletions

File tree

.github/workflows/tests_eessi_module.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,49 @@ jobs:
316316
GREP_PATTERN="Lmod is automatically replacing \"EESSI/${{matrix.EESSI_VERSION}}\" with \"${LOCAL_STACK_NAME}/${LOCAL_STACK_VERSION}\"."
317317
module load "${LOCAL_STACK_NAME}/${LOCAL_STACK_VERSION}" |& grep "${GREP_PATTERN}"
318318
319+
check_riscv_cpu_override:
320+
runs-on: ubuntu-24.04
321+
strategy:
322+
fail-fast: false
323+
matrix:
324+
EESSI_VERSION:
325+
- '2025.06'
326+
327+
steps:
328+
- name: Check out software-layer repository
329+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
330+
331+
- name: Mount EESSI CernVM-FS repository
332+
uses: cvmfs-contrib/github-action-cvmfs@55899ca74cf78ab874bdf47f5a804e47c198743c # v4.0
333+
with:
334+
cvmfs_config_package: https://github.com/EESSI/filesystem-layer/releases/download/latest/cvmfs-config-eessi_latest_all.deb
335+
cvmfs_http_proxy: DIRECT
336+
cvmfs_repositories: software.eessi.io,dev.eessi.io
337+
338+
- name: Test if we can override the CPU family to check risc-v modules on an x86 system
339+
run: |
340+
# Initialise Lmod
341+
. /cvmfs/software.eessi.io/versions/${{matrix.EESSI_VERSION}}/compat/linux/$(uname -m)/usr/share/Lmod/init/bash
342+
343+
export MODULEPATH=init/modules
344+
345+
# Set the overrides we want to test
346+
export EESSI_CPU_FAMILY_OVERRIDE=x86_64 # Running on an x86_64 system, so we need x86_64 compat layer
347+
export EESSI_SOFTWARE_SUBDIR_OVERRIDE=riscv64/generic # Get modules for riscv64/generic
348+
export EESSI_VERSION_OVERRIDE=2025.06-001 # Override EESSI version, as versioning for riscv repo is different
349+
350+
module load EESSI/${{matrix.EESSI_VERSION}}
351+
352+
# Make sure the compat layer works with a simple ls
353+
[ -n "${EPREFIX:-}" ] && "$EPREFIX/bin/ls" || { echo "EPREFIX is not defined" >&2; exit 1; }
354+
355+
# Check that we have a riscv MODULEPATH
356+
if [[ "$MODULEPATH" == *"riscv"* ]]; then
357+
echo "MODULEPATH contains riscv prefix ($MODULEPATH)"
358+
else
359+
exit 1
360+
fi
361+
319362
check_PS1_update_eessi_module:
320363
runs-on: ubuntu-24.04
321364
strategy:

init/modules/EESSI/2023.06.lua

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ local eessi_init_prefix = pathJoin(eessi_prefix, "init")
1919
local eessi_software_layer_version_suffix = ""
2020
local eessi_os_type = "linux"
2121
-- for RISC-V clients we need to do some overrides, as things are stored in different CVMFS repositories
22-
if (subprocess("uname -m"):gsub("\n$","") == "riscv64") then
22+
local eessi_software_subdir_override = os.getenv("EESSI_SOFTWARE_SUBDIR_OVERRIDE")
23+
if (
24+
subprocess("uname -m"):gsub("\n$","") == "riscv64"
25+
or (eessi_software_subdir_override and string.find(eessi_software_subdir_override, "riscv64"))
26+
) then
2327
if (eessi_version == "2023.06" or eessi_version == "20240402") then
2428
eessi_version_override = os.getenv("EESSI_VERSION_OVERRIDE") or ""
2529
index_suffix = string.find(eessi_version_override, '-')
@@ -114,7 +118,12 @@ local archdetect = archdetect_cpu()
114118
-- archdetect_accel() attempts to identify an accelerator, e.g., accel/nvidia/cc80
115119
local archdetect_accel = archdetect_accel()
116120
-- eessi_cpu_family is derived from the archdetect match, e.g., x86_64
117-
local eessi_cpu_family = archdetect:match("([^/]+)")
121+
local eessi_cpu_family
122+
if os.getenv("EESSI_CPU_FAMILY_OVERRIDE") then
123+
eessi_cpu_family = os.getenv("EESSI_CPU_FAMILY_OVERRIDE")
124+
else
125+
eessi_cpu_family = archdetect:match("([^/]+)")
126+
end
118127
local eessi_software_subdir = archdetect
119128
-- eessi_eprefix is the base location of the compat layer, e.g., /cvmfs/software.eessi.io/versions/<EESSI_VERSION>/compat/linux/x86_64
120129
local eessi_eprefix = pathJoin(eessi_compat_prefix, eessi_os_type, eessi_cpu_family)

0 commit comments

Comments
 (0)