diff options
author | Jeroen Demeyer <jdemeyer@cage.ugent.be> | 2018-10-05 11:46:30 +0200 |
---|---|---|
committer | Jeroen Demeyer <jdemeyer@cage.ugent.be> | 2018-10-05 11:57:27 +0200 |
commit | 4c05fed01c68a305abf62135695bc61606746683 (patch) | |
tree | d1a3c9aab245e14cd2028b5f341a7002c1ab107d | |
parent | 5f3c0c2ba7f0c794a483c7e74722f95bdd3bb827 (diff) | |
download | numpy-4c05fed01c68a305abf62135695bc61606746683.tar.gz |
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
-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..772aaf6b9 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 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 |