Skip to content

Commit 3ffb3a8

Browse files
committed
Merge branch '2023.06-software.eessi.io' of github-trz:EESSI/software-layer into 2023.06-a64fx-2023b-eb490-apps-2
2 parents a34915b + 10d1236 commit 3ffb3a8

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

eb_hooks.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from easybuild.tools.run import run_cmd
1414
from easybuild.tools.systemtools import AARCH64, POWER, X86_64, get_cpu_architecture, get_cpu_features
1515
from easybuild.tools.toolchain.compiler import OPTARCH_GENERIC
16+
from easybuild.tools.version import VERSION as EASYBUILD_VERSION
1617

1718
# prefer importing LooseVersion from easybuild.tools, but fall back to distuils in case EasyBuild <= 4.7.0 is used
1819
try:
@@ -126,9 +127,15 @@ def post_ready_hook(self, *args, **kwargs):
126127
Post-ready hook: limit parallellism for selected builds based on software name and CPU target.
127128
parallelism needs to be limited because some builds require a lot of memory per used core.
128129
"""
129-
# 'parallel' easyconfig parameter is set via EasyBlock.set_parallel in ready step based on available cores.
130+
# 'parallel' (EB4) or 'max_parallel' (EB5) easyconfig parameter is set via EasyBlock.set_parallel in ready step
131+
# based on available cores.
132+
133+
# Check whether we have EasyBuild 4 or 5
134+
parallel_param = 'parallel'
135+
if EASYBUILD_VERSION >= '5':
136+
parallel_param = 'max_parallel'
130137
# get current parallelism setting
131-
parallel = self.cfg['parallel']
138+
parallel = self.cfg[parallel_param]
132139
if parallel == 1:
133140
return # no need to limit if already using 1 core
134141

@@ -152,7 +159,7 @@ def post_ready_hook(self, *args, **kwargs):
152159

153160
# apply the limit if it's different from current
154161
if new_parallel != parallel:
155-
self.cfg['parallel'] = new_parallel
162+
self.cfg[parallel_param] = new_parallel
156163
msg = "limiting parallelism to %s (was %s) for %s on %s to avoid out-of-memory failures during building/testing"
157164
print_msg(msg % (new_parallel, parallel, self.name, cpu_target), log=self.log)
158165

0 commit comments

Comments
 (0)