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: ...@@ -78,13 +78,9 @@ try:
from concurrent.futures import ThreadPoolExecutor as Pool from concurrent.futures import ThreadPoolExecutor as Pool
PARALLEL_COMPILE = True PARALLEL_COMPILE = True
except ImportError: except ImportError:
# from multiprocessing.pool import ThreadPool as Pool # inefficient # pip install futures # to use concurrent.futures Python 2.7 backport
PARALLEL_COMPILE = False from multiprocessing.pool import ThreadPool as Pool
print('*' * 50 + PARALLEL_COMPILE = True
'\nTo compile pythran extensions in parallel, '
'requires concurrent.futures module\n'
' pip install futures # for Python 2.7 backport\n' +
'*' * 50)
short_version = '.'.join([str(i) for i in sys.version_info[:2]]) short_version = '.'.join([str(i) for i in sys.version_info[:2]])
...@@ -496,10 +492,18 @@ def build_extensions(self): ...@@ -496,10 +492,18 @@ def build_extensions(self):
except AttributeError: except AttributeError:
pass pass
num_jobs = multiprocessing.cpu_count() try:
num_jobs = os.cpu_count()
except AttributeError:
num_jobs = multiprocessing.cpu_count()
pool = Pool(num_jobs) pool = Pool(num_jobs)
pool.map(self.build_extension, self.extensions) pool.map(self.build_extension, self.extensions)
pool.shutdown() try:
pool.shutdown()
except AttributeError:
pool.close()
pool.join()
def compile(self, sources, output_dir=None, macros=None, def compile(self, sources, output_dir=None, macros=None,
......
...@@ -40,7 +40,9 @@ commands = ...@@ -40,7 +40,9 @@ commands =
[testenv:codecov] [testenv:codecov]
sitepackages = True sitepackages = True
deps = codecov deps =
codecov
cython
whitelist_externals = make whitelist_externals = make
usedevelop = False usedevelop = False
skip_install = true skip_install = true
...@@ -50,7 +52,9 @@ commands = ...@@ -50,7 +52,9 @@ commands =
[testenv:codecov-travis] [testenv:codecov-travis]
passenv = CI TRAVIS TRAVIS_* passenv = CI TRAVIS TRAVIS_*
deps = codecov deps =
codecov
cython
usedevelop = False usedevelop = False
skip_install = true skip_install = true
commands = 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