Skip to content

Commit 6688044

Browse files
committed
Tweak eb_hooks for module-only on Zen4
1 parent f596b1e commit 6688044

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

eb_hooks.py

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,15 @@ def pre_fetch_hook_zen4_gcccore1220(self, *args, **kwargs):
444444
print_msg("Updated build option 'force' to 'True'")
445445

446446

447+
def pre_module_hook_zen4_gcccore1220(self, *args, **kwargs):
448+
"""Revert changes from pre_fetch_hook_zen4_gcccore1220"""
449+
if is_gcccore_1220_based(ecname=self.name, ecversion=self.version, tcname=self.toolchain.name,
450+
tcversion=self.toolchain.version):
451+
if hasattr(self, EESSI_MODULE_ONLY_ATTR):
452+
# Allow the module to be loaded in the module step
453+
os.environ[EESSI_IGNORE_ZEN4_GCC1220_ENVVAR] = "1"
454+
455+
447456
def post_module_hook_zen4_gcccore1220(self, *args, **kwargs):
448457
"""Revert changes from pre_fetch_hook_zen4_gcccore1220"""
449458
if is_gcccore_1220_based(ecname=self.name, ecversion=self.version, tcname=self.toolchain.name,
@@ -462,6 +471,10 @@ def post_module_hook_zen4_gcccore1220(self, *args, **kwargs):
462471
raise EasyBuildError("Cannot restore force to it's original value: 'self' is misisng attribute %s.",
463472
EESSI_FORCE_ATTR)
464473

474+
# If the variable to allow loading is set, remove it
475+
if os.environ.get(EESSI_IGNORE_ZEN4_GCC1220_ENVVAR, False):
476+
del os.environ[EESSI_IGNORE_ZEN4_GCC1220_ENVVAR]
477+
465478

466479
# Modules for dependencies are loaded in the prepare step. Thus, that's where we need this variable to be set
467480
# so that the modules can be succesfully loaded without printing the error (so that we can create a module
@@ -1186,10 +1199,21 @@ def inject_gpu_property(ec):
11861199
return ec
11871200

11881201

1202+
def pre_module_hook(self, *args, **kwargs):
1203+
"""Main pre module hook: trigger custom functions based on software name."""
1204+
if self.name in POST_MODULE_HOOKS:
1205+
POST_MODULE_HOOKS[self.name](self, *args, **kwargs)
1206+
1207+
# Always trigger this one, regardless of self.name
1208+
cpu_target = get_eessi_envvar('EESSI_SOFTWARE_SUBDIR')
1209+
if cpu_target == CPU_TARGET_ZEN4:
1210+
pre_module_hook_zen4_gcccore1220(self, *args, **kwargs)
1211+
1212+
11891213
def post_module_hook(self, *args, **kwargs):
11901214
"""Main post module hook: trigger custom functions based on software name."""
11911215
if self.name in POST_MODULE_HOOKS:
1192-
POST_MODULE_HOOKS[ec.name](self, *args, **kwargs)
1216+
POST_MODULE_HOOKS[self.name](self, *args, **kwargs)
11931217

11941218
# Always trigger this one, regardless of self.name
11951219
cpu_target = get_eessi_envvar('EESSI_SOFTWARE_SUBDIR')
@@ -1258,6 +1282,8 @@ def post_module_hook(self, *args, **kwargs):
12581282
'cuDNN': post_postproc_cudnn,
12591283
}
12601284

1285+
PRE_MODULE_HOOKS = {}
1286+
12611287
POST_MODULE_HOOKS = {}
12621288

12631289
# Define parallelism limit operations

0 commit comments

Comments
 (0)