Skip to content

Commit 0a39567

Browse files
committed
Add multithreaded builds
1 parent 52a0598 commit 0a39567

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

setup.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from distutils.core import setup
22
from distutils.extension import Extension
3+
import multiprocessing
34
# from Cython.Distutils import build_ext
45
from Cython.Build import cythonize
56
import numpy
@@ -294,7 +295,8 @@ def glob_cfiles(path, excludes):
294295
),
295296
)
296297

297-
298+
nthreads = multiprocessing.cpu_count()
299+
print('Building with {} threads'.format(nthreads))
298300
setup(
299301
name='fidimag',
300302
version=version,
@@ -305,5 +307,5 @@ def glob_cfiles(path, excludes):
305307
'fidimag.extensions',
306308
'fidimag.common',
307309
],
308-
ext_modules=cythonize(ext_modules),
310+
ext_modules=cythonize(ext_modules, nthreads=nthreads),
309311
)

0 commit comments

Comments
 (0)