I'm having my first try at parallel cython using prange (I have successfully used the multiprocessing module but the syntax is really clumsy), and am trying to follow the instructions at
http://cython.readthedocs.io/en/latest/src/userguide/parallelism.html , and also looking at
http://nealhughes.net/parallelcomp2/
I get this error (**** is instead of some personal details in my path):
# python cyrun_ptest.pyx
Traceback (most recent call last):
File "cyrun_ptest.pyx", line 4, in <module>
import cyrun_ptest2
ImportError: dlopen(/Users/****/work/cyrun_ptest2.so, 2): Symbol not found: _GOMP_parallel
Referenced from: /Users/****/work/cyrun_ptest2.so
Expected in: flat namespace
in /Users/****/work/cyrun_ptest2.so
"import cyrun_ptest2" is the very first non-comment line in cyrun_ptest.pyx.
My compile file looks like this:
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
from Cython.Distutils import build_ext
ext_modules = [
Extension(
"cyrun_ptest",
["cyrun_ptest.pyx"],
extra_compile_args=["-fopenmp" ],
extra_link_args=['-fopenmp'],
)
]
setup(
name='cyrun_ptest',
cmdclass = {"build_ext": build_ext},
ext_modules = ext_modules
)
A bit of commenting and uncommenting suggests that the -fopenmp is what's tripping it up. In fact earlier I was being told the gcc did not support the option -fopenmp . I got around that by pointing to the brew gcc (/usr/local/bin) instead of the Mac-supplied one (/usr/bin), but it seems I didn't completely fix things.
Does anyone have an idea how to fix this?
Thanks in advance