@@ -143,6 +143,8 @@ def post_ready_hook(self, *args, **kwargs):
143143 # get CPU target
144144 cpu_target = get_eessi_envvar ('EESSI_SOFTWARE_SUBDIR' )
145145
146+ new_parallel = parallel
147+
146148 # check if we have limits defined for this software
147149 if self .name in PARALLELISM_LIMITS :
148150 limits = PARALLELISM_LIMITS [self .name ]
@@ -158,11 +160,16 @@ def post_ready_hook(self, *args, **kwargs):
158160 else :
159161 return # no applicable limits found
160162
161- # apply the limit if it's different from current
162- if new_parallel != parallel :
163- self .cfg [parallel_param ] = new_parallel
164- msg = "limiting parallelism to %s (was %s) for %s on %s to avoid out-of-memory failures during building/testing"
165- print_msg (msg % (new_parallel , parallel , self .name , cpu_target ), log = self .log )
163+ # check if there's a general limit set for CPU target
164+ elif cpu_target in PARALLELISM_LIMITS :
165+ operation_func , operation_args = PARALLELISM_LIMITS [cpu_target ]
166+ new_parallel = operation_func (parallel , operation_args )
167+
168+ # apply the limit if it's different from current
169+ if new_parallel != parallel :
170+ self .cfg [parallel_param ] = new_parallel
171+ msg = "limiting parallelism to %s (was %s) for %s on %s to avoid out-of-memory failures during building/testing"
172+ print_msg (msg % (new_parallel , parallel , self .name , cpu_target ), log = self .log )
166173
167174
168175def pre_prepare_hook (self , * args , ** kwargs ):
@@ -1376,27 +1383,22 @@ def set_maximum(parallel, max_value):
13761383# specific CPU target is defined in the data structure below. If not, it checks for
13771384# the generic '*' entry.
13781385PARALLELISM_LIMITS = {
1386+ # by default, only use quarter of cores when building for A64FX;
1387+ # this is done because total memory is typically limited on A64FX due to HBM,
1388+ # Deucalion has 32GB HBM for 48 cores per node
1389+ CPU_TARGET_A64FX : (divide_by_factor , 4 ),
1390+ # software-specific limits
13791391 'libxc' : {
13801392 '*' : (divide_by_factor , 2 ),
1381- CPU_TARGET_A64FX : (set_maximum , 12 ),
1382- },
1383- 'nodejs' : {
1384- CPU_TARGET_A64FX : (divide_by_factor , 2 ),
13851393 },
13861394 'MBX' : {
13871395 '*' : (divide_by_factor , 2 ),
13881396 },
1389- 'PyTorch' : {
1390- CPU_TARGET_A64FX : (divide_by_factor , 4 ),
1391- },
13921397 'TensorFlow' : {
13931398 '*' : (divide_by_factor , 2 ),
13941399 CPU_TARGET_A64FX : (set_maximum , 8 ),
13951400 },
13961401 'Qt5' : {
13971402 CPU_TARGET_A64FX : (set_maximum , 8 ),
13981403 },
1399- 'ROOT' : {
1400- CPU_TARGET_A64FX : (divide_by_factor , 2 ),
1401- },
14021404}
0 commit comments