@@ -444,6 +444,16 @@ def pre_fetch_hook_zen4_gcccore1220(self, *args, **kwargs):
444
444
print_msg ("Updated build option 'force' to 'True'" )
445
445
446
446
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
+
447
457
def post_module_hook_zen4_gcccore1220 (self , * args , ** kwargs ):
448
458
"""Revert changes from pre_fetch_hook_zen4_gcccore1220"""
449
459
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):
462
472
raise EasyBuildError ("Cannot restore force to it's original value: 'self' is misisng attribute %s." ,
463
473
EESSI_FORCE_ATTR )
464
474
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
+
465
481
466
482
# Modules for dependencies are loaded in the prepare step. Thus, that's where we need this variable to be set
467
483
# 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):
1186
1202
return ec
1187
1203
1188
1204
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
+
1189
1216
def post_module_hook (self , * args , ** kwargs ):
1190
1217
"""Main post module hook: trigger custom functions based on software name."""
1191
1218
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 )
1193
1220
1194
1221
# Always trigger this one, regardless of self.name
1195
1222
cpu_target = get_eessi_envvar ('EESSI_SOFTWARE_SUBDIR' )
@@ -1258,6 +1285,8 @@ def post_module_hook(self, *args, **kwargs):
1258
1285
'cuDNN' : post_postproc_cudnn ,
1259
1286
}
1260
1287
1288
+ PRE_MODULE_HOOKS = {}
1289
+
1261
1290
POST_MODULE_HOOKS = {}
1262
1291
1263
1292
# Define parallelism limit operations
0 commit comments