From a7e915d38b5f93a06a8e63e91654666f528465fa Mon Sep 17 00:00:00 2001 From: Michael Kuhn Date: Mon, 15 Jul 2019 08:25:01 +0200 Subject: 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. --- lib/spack/spack/build_environment.py | 1 + 1 file changed, 1 insertion(+) (limited to 'lib') 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 -- cgit v1.2.3-60-g2f50