Commit 0b86ca79 authored by Ashwin Vishnu's avatar Ashwin Vishnu
Browse files

Allow use of multiprocessing ThreadPool for building pythran extensions, add...

Allow use of multiprocessing ThreadPool for building pythran extensions, add cython dep for coverage tests
parent f235b7a690aa
......@@ -78,13 +78,9 @@ try:
from concurrent.futures import ThreadPoolExecutor as Pool
PARALLEL_COMPILE = True
except ImportError:
# from multiprocessing.pool import ThreadPool as Pool # inefficient
PARALLEL_COMPILE = False
print('*' * 50 +
'\nTo compile pythran extensions in parallel, '
'requires concurrent.futures module\n'
' pip install futures # for Python 2.7 backport\n' +
'*' * 50)
# pip install futures # to use concurrent.futures Python 2.7 backport
from multiprocessing.pool import ThreadPool as Pool
PARALLEL_COMPILE = True
short_version = '.'.join([str(i) for i in sys.version_info[:2]])
......@@ -496,10 +492,18 @@ def build_extensions(self):
except AttributeError:
pass
try:
num_jobs = os.cpu_count()
except AttributeError:
num_jobs = multiprocessing.cpu_count()
pool = Pool(num_jobs)
pool.map(self.build_extension, self.extensions)
try:
pool.shutdown()
except AttributeError:
pool.close()
pool.join()
def compile(self, sources, output_dir=None, macros=None,
......
......@@ -40,7 +40,9 @@ commands =
[testenv:codecov]
sitepackages = True
deps = codecov
deps =
codecov
cython
whitelist_externals = make
usedevelop = False
skip_install = true
......@@ -50,7 +52,9 @@ commands =
[testenv:codecov-travis]
passenv = CI TRAVIS TRAVIS_*
deps = codecov
deps =
codecov
cython
usedevelop = False
skip_install = true
commands =
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment