Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Limit number of threads to prevent bombing the system
Browse files Browse the repository at this point in the history
  • Loading branch information
jdemeyer committed Oct 5, 2018
1 parent 78057db commit b151634
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build/pkgs/numpy/package-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.15.2
1.15.2.p0
25 changes: 25 additions & 0 deletions build/pkgs/numpy/patches/cpu_count.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
See https://github.com/numpy/numpy/pull/12088

diff --git a/numpy/distutils/misc_util.py b/numpy/distutils/misc_util.py
index b30fc27..b07c562 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 bombing
+ 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

0 comments on commit b151634

Please sign in to comment.