diff --git a/create_lmodsitepackage.py b/create_lmodsitepackage.py index 9a4a232863..8364d32c5b 100755 --- a/create_lmodsitepackage.py +++ b/create_lmodsitepackage.py @@ -19,6 +19,34 @@ return content end +local function from_eessi_prefix(t) + -- eessi_prefix is the prefix with official EESSI modules + -- e.g. /cvmfs/software.eessi.io/versions/2023.06 + local eessi_prefix = os.getenv("EESSI_PREFIX") + + -- If EESSI_PREFIX wasn't defined, we cannot check if this module was from the EESSI environment + -- In that case, we assume it isn't, otherwise EESSI_PREFIX would (probably) have been set + if eessi_prefix == nil then + return False + else + -- NOTE: exact paths for site and user extensions aren't final, so may need to be updated later. + -- See https://github.com/EESSI/software-layer/pull/371 + + -- eessi_prefix_host_injections is the prefix with site-extensions (i.e. additional modules) + -- to the official EESSI modules, e.g. /cvmfs/software.eessi.io/host_injections/2023.06 + local eessi_prefix_host_injections = string.gsub(eessi_prefix, 'versions', 'host_injections') + + -- eessi_prefix_user_home is the prefix with user-extensions (i.e. additional modules) + -- to the official EESSI modules, e.g. $HOME/eessi/versions/2023.06 + local eessi_prefix_user_home = string.gsub(eessi_prefix, os.getenv("EESSI_CVMFS_REPO"), pathJoin(os.getenv("HOME"), "eessi")) + + -- Check if the full modulepath starts with the eessi_prefix_* + return string.find(t.fn, "^" .. eessi_prefix) ~= nil or + string.find(t.fn, "^" .. eessi_prefix_host_injections) ~= nil or + string.find(t.fn, "^" .. eessi_prefix_user_home) ~= nil + end +end + local function eessi_cuda_enabled_load_hook(t) local frameStk = require("FrameStk"):singleton() local mt = frameStk:mt() @@ -107,7 +135,11 @@ -- Combine both functions into a single one, as we can only register one function as load hook in lmod -- Also: make it non-local, so it can be imported and extended by other lmodrc files if needed function eessi_load_hook(t) - eessi_cuda_enabled_load_hook(t) + -- Only apply CUDA hooks if the loaded module is in the EESSI prefix + -- This avoids getting an Lmod Error when trying to load a CUDA module from a local software stack + if from_eesi_prefix(t) then + eessi_cuda_enabled_load_hook(t) + end eessi_openmpi_load_hook(t) end diff --git a/easystacks/pilot.nessi.no/2023.06/eessi-2023.06-eb-4.9.1-2023b.yml b/easystacks/pilot.nessi.no/2023.06/eessi-2023.06-eb-4.9.1-2023b.yml new file mode 100644 index 0000000000..333331e51c --- /dev/null +++ b/easystacks/pilot.nessi.no/2023.06/eessi-2023.06-eb-4.9.1-2023b.yml @@ -0,0 +1,7 @@ +easyconfigs: + # wget got ingested already + # - wget-1.21.4-GCCcore-13.2.0.eb + - py-cpuinfo-9.0.0-GCCcore-13.2.0.eb: + options: + # see https://github.com/easybuilders/easybuild-easyconfigs/pull/20125 + from-commit: 6515b44cd84a20fe7876cb4bdaf3c0080e688566