From 822be669b1a60ceb9221004056aa09501abdb112 Mon Sep 17 00:00:00 2001 From: Thomas Roeblitz Date: Sun, 7 Apr 2024 00:36:10 +0200 Subject: [PATCH] workaround for LMOD to register two hooks --- create_lmodrc.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/create_lmodrc.py b/create_lmodrc.py index 2d4abef0e9..5e6200ad02 100755 --- a/create_lmodrc.py +++ b/create_lmodrc.py @@ -29,7 +29,7 @@ return content end -local function cuda_enabled_load_hook(t) +local function eessi_cuda_enabled_load_hook(t) local frameStk = require("FrameStk"):singleton() local mt = frameStk:mt() local simpleName = string.match(t.modFullName, "(.-)/") @@ -94,7 +94,7 @@ end end -local function openmpi_load_hook(t) +local function eessi_openmpi_load_hook(t) -- disable smcuda BTL when loading OpenMPI module for aarch64/neoverse_v1, -- to work around hang/crash due to bug in OpenMPI; -- see https://gitlab.com/eessi/support/-/issues/41 @@ -114,8 +114,15 @@ end end -hook.register("load", cuda_enabled_load_hook) -hook.register("load", openmpi_load_hook) +-- 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) + eessi_openmpi_load_hook(t) +end + + +hook.register("load", eessi_load_hook) """ def error(msg):