@@ -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+
447457def 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
@@ -1189,10 +1205,21 @@ def inject_gpu_property(ec):
11891205 return ec
11901206
11911207
1208+ def pre_module_hook (self , * args , ** kwargs ):
1209+ """Main pre module hook: trigger custom functions based on software name."""
1210+ if self .name in PRE_MODULE_HOOKS :
1211+ PRE_MODULE_HOOKS [self .name ](self , * args , ** kwargs )
1212+
1213+ # Always trigger this one, regardless of self.name
1214+ cpu_target = get_eessi_envvar ('EESSI_SOFTWARE_SUBDIR' )
1215+ if cpu_target == CPU_TARGET_ZEN4 :
1216+ pre_module_hook_zen4_gcccore1220 (self , * args , ** kwargs )
1217+
1218+
11921219def post_module_hook (self , * args , ** kwargs ):
11931220 """Main post module hook: trigger custom functions based on software name."""
11941221 if self .name in POST_MODULE_HOOKS :
1195- POST_MODULE_HOOKS [ec .name ](self , * args , ** kwargs )
1222+ POST_MODULE_HOOKS [self .name ](self , * args , ** kwargs )
11961223
11971224 # Always trigger this one, regardless of self.name
11981225 cpu_target = get_eessi_envvar ('EESSI_SOFTWARE_SUBDIR' )
@@ -1261,6 +1288,8 @@ def post_module_hook(self, *args, **kwargs):
12611288 'cuDNN' : post_postproc_cudnn ,
12621289}
12631290
1291+ PRE_MODULE_HOOKS = {}
1292+
12641293POST_MODULE_HOOKS = {}
12651294
12661295# Define parallelism limit operations
0 commit comments