This repository has been archived by the owner on Jan 30, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Limit number of threads to prevent bombing the system
- Loading branch information
Showing
2 changed files
with
26 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.15.2 | ||
1.15.2.p0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |