diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2018-10-08 21:34:12 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-08 21:34:12 -0500 |
commit | 86a7acc8582923604fac849bb19f0b08efc0a91a (patch) | |
tree | 05450fcffe5532f44085bca57bf9041f1dbb275b /numpy | |
parent | 4189ed73feecc0b1c6febf2e1ba6dbaa7bfb26dd (diff) | |
parent | dc8078f3e98a831857e1f176003cd627d24597a3 (diff) | |
download | numpy-86a7acc8582923604fac849bb19f0b08efc0a91a.tar.gz |
Merge pull request #12088 from jdemeyer/cpu_count
BUG: limit default for get_num_build_jobs() to 8
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/distutils/misc_util.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/numpy/distutils/misc_util.py b/numpy/distutils/misc_util.py index b30fc27f7..073e841e8 100644 --- a/numpy/distutils/misc_util.py +++ b/numpy/distutils/misc_util.py @@ -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 is 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 ------- @@ -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 |