Skip to content

Commit 383b39e

Browse files
authored
Merge pull request #17 from boegel/A64FX_parallel_limit
use standard limit for A64FX: only use quarter of available cores + fix determining level of parallelism in a way compatible with EasyBuild 4.x and 5.x
2 parents 1fcb8f3 + a0bd30c commit 383b39e

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

eb_hooks.py

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -128,21 +128,18 @@ def post_ready_hook(self, *args, **kwargs):
128128
Post-ready hook: limit parallellism for selected builds based on software name and CPU target.
129129
parallelism needs to be limited because some builds require a lot of memory per used core.
130130
"""
131-
# 'parallel' (EB4) or 'max_parallel' (EB5) easyconfig parameter is set via EasyBlock.set_parallel in ready step
132-
# based on available cores.
133-
134-
# Check whether we have EasyBuild 4 or 5
135-
parallel_param = 'parallel'
136-
if EASYBUILD_VERSION >= '5':
137-
parallel_param = 'max_parallel'
138-
# get current parallelism setting
139-
parallel = self.cfg[parallel_param]
131+
# 'parallel' easyconfig parameter (EB4) or the parallel property (EB5) is set via EasyBlock.set_parallel
132+
# in ready step based on available cores
133+
parallel = getattr(self, 'parallel', self.cfg['parallel'])
134+
140135
if parallel == 1:
141136
return # no need to limit if already using 1 core
142137

143138
# get CPU target
144139
cpu_target = get_eessi_envvar('EESSI_SOFTWARE_SUBDIR')
145140

141+
new_parallel = parallel
142+
146143
# check if we have limits defined for this software
147144
if self.name in PARALLELISM_LIMITS:
148145
limits = PARALLELISM_LIMITS[self.name]
@@ -158,11 +155,19 @@ def post_ready_hook(self, *args, **kwargs):
158155
else:
159156
return # no applicable limits found
160157

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)
158+
# check if there's a general limit set for CPU target
159+
elif cpu_target in PARALLELISM_LIMITS:
160+
operation_func, operation_args = PARALLELISM_LIMITS[cpu_target]
161+
new_parallel = operation_func(parallel, operation_args)
162+
163+
# apply the limit if it's different from current
164+
if new_parallel != parallel:
165+
if EASYBUILD_VERSION >= '5':
166+
self.cfg.parallel = new_parallel
167+
else:
168+
self.cfg['parallel'] = new_parallel
169+
msg = "limiting parallelism to %s (was %s) for %s on %s to avoid out-of-memory failures during building/testing"
170+
print_msg(msg % (new_parallel, parallel, self.name, cpu_target), log=self.log)
166171

167172

168173
def pre_prepare_hook(self, *args, **kwargs):
@@ -1376,27 +1381,22 @@ def set_maximum(parallel, max_value):
13761381
# specific CPU target is defined in the data structure below. If not, it checks for
13771382
# the generic '*' entry.
13781383
PARALLELISM_LIMITS = {
1384+
# by default, only use quarter of cores when building for A64FX;
1385+
# this is done because total memory is typically limited on A64FX due to HBM,
1386+
# Deucalion has 32GB HBM for 48 cores per node
1387+
CPU_TARGET_A64FX: (divide_by_factor, 4),
1388+
# software-specific limits
13791389
'libxc': {
13801390
'*': (divide_by_factor, 2),
1381-
CPU_TARGET_A64FX: (set_maximum, 12),
1382-
},
1383-
'nodejs': {
1384-
CPU_TARGET_A64FX: (divide_by_factor, 2),
13851391
},
13861392
'MBX': {
13871393
'*': (divide_by_factor, 2),
13881394
},
1389-
'PyTorch': {
1390-
CPU_TARGET_A64FX: (divide_by_factor, 4),
1391-
},
13921395
'TensorFlow': {
13931396
'*': (divide_by_factor, 2),
13941397
CPU_TARGET_A64FX: (set_maximum, 8),
13951398
},
13961399
'Qt5': {
13971400
CPU_TARGET_A64FX: (set_maximum, 8),
13981401
},
1399-
'ROOT': {
1400-
CPU_TARGET_A64FX: (divide_by_factor, 2),
1401-
},
14021402
}

0 commit comments

Comments
 (0)