@@ -444,6 +444,15 @@ 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
+ """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
+
447
456
def post_module_hook_zen4_gcccore1220 (self , * args , ** kwargs ):
448
457
"""Revert changes from pre_fetch_hook_zen4_gcccore1220"""
449
458
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):
462
471
raise EasyBuildError ("Cannot restore force to it's original value: 'self' is misisng attribute %s." ,
463
472
EESSI_FORCE_ATTR )
464
473
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
+
465
478
466
479
# Modules for dependencies are loaded in the prepare step. Thus, that's where we need this variable to be set
467
480
# 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):
1186
1199
return ec
1187
1200
1188
1201
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
+
1189
1213
def post_module_hook (self , * args , ** kwargs ):
1190
1214
"""Main post module hook: trigger custom functions based on software name."""
1191
1215
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 )
1193
1217
1194
1218
# Always trigger this one, regardless of self.name
1195
1219
cpu_target = get_eessi_envvar ('EESSI_SOFTWARE_SUBDIR' )
@@ -1258,6 +1282,8 @@ def post_module_hook(self, *args, **kwargs):
1258
1282
'cuDNN' : post_postproc_cudnn ,
1259
1283
}
1260
1284
1285
+ PRE_MODULE_HOOKS = {}
1286
+
1261
1287
POST_MODULE_HOOKS = {}
1262
1288
1263
1289
# Define parallelism limit operations
0 commit comments