Skip to content

Commit

Permalink
Limit python install parallelisation to number of cpus (#2056)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackgerrits committed Aug 28, 2019
1 parent da4271e commit 69fa55b
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions setup.py
Expand Up @@ -13,6 +13,7 @@
from setuptools.command.test import test as _test
from setuptools.command.install_lib import install_lib as _install_lib
from shutil import rmtree
import multiprocessing

system = platform.system()
version_info = sys.version_info
Expand All @@ -28,12 +29,12 @@ class Distribution(_distribution):
def __init__(self, attrs=None):
self.vcpkg_root = None
_distribution.__init__(self, attrs)

class CMakeExtension(Extension):
def __init__(self, name):
# don't invoke the original build_ext for this special extension
Extension.__init__(self, name, sources=[])

def get_ext_filename_without_platform_suffix(filename):
from distutils.sysconfig import get_config_var
ext_suffix = get_config_var('EXT_SUFFIX')
Expand Down Expand Up @@ -76,7 +77,7 @@ def build_cmake(self, ext):

# example of cmake args
config = 'Debug' if self.debug else 'Release'

cmake_args = [
'-DCMAKE_BUILD_TYPE=' + config,
'-DPY_VERSION=' + '{v[0]}.{v[1]}'.format(v=version_info),
Expand All @@ -86,7 +87,7 @@ def build_cmake(self, ext):
]
if 'CONDA_PREFIX' in os.environ and not 'BOOST_ROOT' in os.environ:
cmake_args.append('-DBOOST_ROOT={}'.format(os.environ['CONDA_PREFIX']))

# example of build args
build_args = [
'--config', config
Expand Down Expand Up @@ -118,7 +119,7 @@ def build_cmake(self, ext):
'-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=' + str(lib_output_dir),
]
build_args += [
'--', '-j8',
'--', '-j{}'.format(multiprocessing.cpu_count()),
# Build the pylibvw target
"pylibvw"
]
Expand Down

0 comments on commit 69fa55b

Please sign in to comment.