summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMichael Kuhn <michael.kuhn@informatik.uni-hamburg.de>2019-07-15 08:25:01 +0200
committerPeter Scheibel <scheibel1@llnl.gov>2019-07-15 11:40:49 -0700
commita7e915d38b5f93a06a8e63e91654666f528465fa (patch)
treea8ac6e2c587bd288c7ed3cbc3346be18ef4bbe0f /lib
parent3f83a2a7d82067dd2e6dacb45572a4948dfda86a (diff)
downloadspack-a7e915d38b5f93a06a8e63e91654666f528465fa.tar.gz
spack-a7e915d38b5f93a06a8e63e91654666f528465fa.tar.bz2
spack-a7e915d38b5f93a06a8e63e91654666f528465fa.tar.xz
spack-a7e915d38b5f93a06a8e63e91654666f528465fa.zip
Fix build_jobs exceeding number of cores
All documentation mentions that `build_jobs` is limited by the number of cores available in the system. This is also enforced when setting it via `--jobs`. However, when setting it via `config.yaml`, it can exceed the number of cores available, making builds run out of memory.
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/build_environment.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py
index 3f4329731a..ff7d41a39a 100644
--- a/lib/spack/spack/build_environment.py
+++ b/lib/spack/spack/build_environment.py
@@ -406,6 +406,7 @@ def _set_variables_for_single_module(pkg, module):
"""Helper function to set module variables for single module."""
jobs = spack.config.get('config:build_jobs') if pkg.parallel else 1
+ jobs = min(jobs, multiprocessing.cpu_count())
assert jobs is not None, "no default set for config:build_jobs"
m = module