[SciPy-User] swig and OpenMP

Rohit Garg rpg.314@gmail....
Fri Feb 12 08:04:00 CST 2010


It's another symptom of a much bigger disease.

Whenever you ask your compiler (atleast GCC) to instrument your code,
certain symbols are added. These symbols are
undocumented/subject-to-change.

Whenever you try to import such a module into python, the dynamic
library loader will complain about these symbols.

For instance, if you try to  compile your extension module with
Profile guided optimization, you'll land into the same problems.

The only reasonable fix I see for these kinds of problems is to embed
Python instead of extending it. Unfortunately, it also seems to be a
lot less popular/easy/common.

On Fri, Feb 12, 2010 at 3:11 PM, Christian Meesters <meesters@gmx.de> wrote:
> Hi,
>
> 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
> Cython)?
>
> For the record: I'm using python 2.6.4, swig 1.3.36, and gcc 4.4.1.
>
> TIA
> Christian
>
>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>



-- 
Rohit Garg

http://rpg-314.blogspot.com/

Senior Undergraduate
Department of Physics
Indian Institute of Technology
Bombay


More information about the SciPy-User mailing list