Skip to content

Commit

Permalink
ENH: distutils: set NPY_NUM_BUILD_JOBS to cpu_count
Browse files Browse the repository at this point in the history
  • Loading branch information
xoviat committed Dec 17, 2017
1 parent 73df4c3 commit 51e1114
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion numpy/distutils/misc_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import tempfile
import subprocess
import shutil
import multiprocessing

import distutils
from distutils.errors import DistutilsError
Expand Down Expand Up @@ -92,7 +93,11 @@ def get_num_build_jobs():
"""
from numpy.distutils.core import get_distribution
envjobs = int(os.environ.get("NPY_NUM_BUILD_JOBS", 1))
try:
cpu_count = len(os.sched_getaffinity(0))
except AttributeError:
cpu_count = multiprocessing.cpu_count()
envjobs = int(os.environ.get("NPY_NUM_BUILD_JOBS", cpu_count))
dist = get_distribution()
# may be None during configuration
if dist is None:
Expand Down

0 comments on commit 51e1114

Please sign in to comment.