Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 33 additions & 1 deletion create_lmodsitepackage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -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