Skip to content

Commit e0c6d63

Browse files
authored
Merge pull request #1096 from ocaisa/buildenv
{2023.06}[2022b,2023a,2023b] buildenv default
2 parents b9e9e9b + 33a0efb commit e0c6d63

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

eb_hooks.py

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,16 @@ 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+
"""Make module load-able during module step"""
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, 'initial_environ'):
452+
# Allow the module to be loaded in the module step (which uses initial environment)
453+
print_msg(f"Setting {EESSI_IGNORE_ZEN4_GCC1220_ENVVAR} in initial environment")
454+
self.initial_environ[EESSI_IGNORE_ZEN4_GCC1220_ENVVAR] = "1"
455+
456+
447457
def post_module_hook_zen4_gcccore1220(self, *args, **kwargs):
448458
"""Revert changes from pre_fetch_hook_zen4_gcccore1220"""
449459
if is_gcccore_1220_based(ecname=self.name, ecversion=self.version, tcname=self.toolchain.name,
@@ -462,6 +472,12 @@ def post_module_hook_zen4_gcccore1220(self, *args, **kwargs):
462472
raise EasyBuildError("Cannot restore force to it's original value: 'self' is misisng attribute %s.",
463473
EESSI_FORCE_ATTR)
464474

475+
# If the variable to allow loading is set, remove it
476+
if hasattr(self, 'initial_environ'):
477+
if self.initial_environ.get(EESSI_IGNORE_ZEN4_GCC1220_ENVVAR, False):
478+
print_msg(f"Removing {EESSI_IGNORE_ZEN4_GCC1220_ENVVAR} in initial environment")
479+
del self.initial_environ[EESSI_IGNORE_ZEN4_GCC1220_ENVVAR]
480+
465481

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

11881204

1205+
def pre_module_hook(self, *args, **kwargs):
1206+
"""Main pre module hook: trigger custom functions based on software name."""
1207+
if self.name in PRE_MODULE_HOOKS:
1208+
PRE_MODULE_HOOKS[self.name](self, *args, **kwargs)
1209+
1210+
# Always trigger this one, regardless of self.name
1211+
cpu_target = get_eessi_envvar('EESSI_SOFTWARE_SUBDIR')
1212+
if cpu_target == CPU_TARGET_ZEN4:
1213+
pre_module_hook_zen4_gcccore1220(self, *args, **kwargs)
1214+
1215+
11891216
def post_module_hook(self, *args, **kwargs):
11901217
"""Main post module hook: trigger custom functions based on software name."""
11911218
if self.name in POST_MODULE_HOOKS:
1192-
POST_MODULE_HOOKS[ec.name](self, *args, **kwargs)
1219+
POST_MODULE_HOOKS[self.name](self, *args, **kwargs)
11931220

11941221
# Always trigger this one, regardless of self.name
11951222
cpu_target = get_eessi_envvar('EESSI_SOFTWARE_SUBDIR')
@@ -1258,6 +1285,8 @@ def post_module_hook(self, *args, **kwargs):
12581285
'cuDNN': post_postproc_cudnn,
12591286
}
12601287

1288+
PRE_MODULE_HOOKS = {}
1289+
12611290
POST_MODULE_HOOKS = {}
12621291

12631292
# Define parallelism limit operations

0 commit comments

Comments
 (0)