3
我想並行執行cython
文件編譯。如何並行執行cython文件編譯?
所以,我看看Cython.Build
源文件,並查找以下簽名cythonize
功能:
def cythonize(module_list, exclude=None, nthreads=0, aliases=None,
quiet=False, force=False, language=None,
exclude_failures=False, **options):
而關於cythonize nthreads
選項如下評論:
"For parallel compilation, set the 'nthreads' option to the number of
concurrent builds."
所以,我想在我的setup.py
文件中使用此選項,如下所示:
from setuptools import setup
from Cython.Build import cythonize
from Cython.Distutils.extension import Extension
EXTENSIONS = [Extension(...)
...
Extension(...)]
setup(name='...',
...
ext_modules=cythonize(EXTENSIONS, nthreads=8),
...)
但我的.pyx
文件仍然使用1個線程進行編譯。
我不明白我在這裏做錯了什麼,以及如何使用nthreads
選項來並行執行cythonize
編譯?
運行'設置(..)'在幾個平行的過程,不可能它有一些意想不到的副作用嗎? – rth