[SciPy-User] swig and OpenMP
Dag Sverre Seljebotn
Fri Feb 12 09:18:55 CST 2010
Christian Meesters wrote:
> Sorry for being a bit off-topic, but I thought somebody here might have
> the relevant info for me.
> A while ago I already asked about integrating OpenMP-code in C/C++-code
> to be wrapped for python on the swig mailing list. Unfortunately nobody
> there knew an answer to my problem.
> Please find a minimal example in this pastebin:
> pi_test.h : http://paste.pocoo.org/show/174174/
> pi_test.c: http://paste.pocoo.org/show/174175/
> pi_test.i: http://paste.pocoo.org/show/174177/
> and my setup.py: http://paste.pocoo.org/show/175890/
> When I do
> $ python setup.py build
> I get no compiler warnings or error - except for the unused variables.
> But when importing the module I get this as a Traceback:
> ImportError: ./pi_test.so: undefined symbol: GOMP_parallel_end
> So, apparently OpenMP did not make it correctly into the wrapped code.
> Any pointers for me? What's going wrong here?
> Does anyone know a working example for OpenMP-code with SWIG (or
Hmm...you have extra_compile_args=-fopenmp, but not extra_link_args.
Perhaps the module is only compiled, but not linked, with -fopenmp? I'd
try to add extra_link_args as well. Inspect the build messages and make
sure that the OpenMP libraries get linked in.
More information about the SciPy-User