Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
BUG: limit default for get_num_build_jobs() to 8
The default value for get_num_build_jobs() is now the number of CPUs
limited to a maximum of 8. This is to prevent overloading systems
with a lot of CPUs. See ticket #12087
  • Loading branch information
jdemeyer authored and charris committed Oct 16, 2018
commit dec25db6df3aad7aa8060647fd370a9b1e2010ed
5 changes: 4 additions & 1 deletion numpy/distutils/misc_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ def get_num_build_jobs():
Get number of parallel build jobs set by the --parallel command line
argument of setup.py
If the command did not receive a setting the environment variable
NPY_NUM_BUILD_JOBS checked and if that is unset it returns 1.
NPY_NUM_BUILD_JOBS checked. If that is unset, return the number of
processors on the system, with a maximum of 8 (to prevent
overloading the system if there a lot of CPUs).

Returns
-------
Expand All @@ -97,6 +99,7 @@ def get_num_build_jobs():
cpu_count = len(os.sched_getaffinity(0))
except AttributeError:
cpu_count = multiprocessing.cpu_count()
cpu_count = min(cpu_count, 8)
envjobs = int(os.environ.get("NPY_NUM_BUILD_JOBS", cpu_count))
dist = get_distribution()
# may be None during configuration
Expand Down