@@ -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
@@ -1189,10 +1205,21 @@ def inject_gpu_property(ec):
1189
1205
return ec
1190
1206
1191
1207
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
+
1192
1219
def post_module_hook (self , * args , ** kwargs ):
1193
1220
"""Main post module hook: trigger custom functions based on software name."""
1194
1221
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 )
1196
1223
1197
1224
# Always trigger this one, regardless of self.name
1198
1225
cpu_target = get_eessi_envvar ('EESSI_SOFTWARE_SUBDIR' )
@@ -1261,6 +1288,8 @@ def post_module_hook(self, *args, **kwargs):
1261
1288
'cuDNN' : post_postproc_cudnn ,
1262
1289
}
1263
1290
1291
+ PRE_MODULE_HOOKS = {}
1292
+
1264
1293
POST_MODULE_HOOKS = {}
1265
1294
1266
1295
# Define parallelism limit operations
0 commit comments