[f2py] OpenMP - again

Paul Anton Letnes paul.anton.letnes at gmail.com
Sat Sep 4 12:31:36 EEST 2010


Dear f2py fans.

I finally got an OpenMP example up and running. It even gives a decent speedup (1.8-ish) on my 2-core laptop! The only disadvantage is that I have not managed to pass the "-fopenmp" flag to the final compile-and-link command, meaning that if I simply run "make" (Makefile included, of course) the resulting python module is not linked to libopenmp. I managed to fix this by manually copying the final build command and adding the "-fopenmp" flag by hand - see detailed instructions in the Makefile.

Can anyone please tell me how I can "automagically" get the -fopenmp flag into the final build command? I believe that will make this example more complete. Also, feel free to suggest improvements to this example!

And to the devs - thanks for writing f2py, it is an impressive piece of software :-)

Best regards,
Paul.

PS:
The final build command is, on my machine:
/opt/local/bin/gfortran -Wall -Wall -undefined dynamic_lookup -bundle build/build/src.macosx-10.6-x86_64-2.6/wrappermodule.o build/build/src.macosx-10.6-x86_64-2.6/fortranobject.o build/wrapper.o build/build/src.macosx-10.6-x86_64-2.6/wrapper-f2pywrappers2.o fortranmodule.o -L/opt/local/lib/gcc44/gcc/x86_64-apple-darwin10/4.4.4 -lgfortran -o ./wrapper.so
It should be (note the -fopenmp flag in the beginning):
/opt/local/bin/gfortran -fopenmp -Wall -Wall -undefined dynamic_lookup -bundle build/build/src.macosx-10.6-x86_64-2.6/wrappermodule.o build/build/src.macosx-10.6-x86_64-2.6/fortranobject.o build/wrapper.o build/build/src.macosx-10.6-x86_64-2.6/wrapper-f2pywrappers2.o fortranmodule.o -L/opt/local/lib/gcc44/gcc/x86_64-apple-darwin10/4.4.4 -lgfortran -o ./wrapper.so


-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenMP-example.zip
Type: application/zip
Size: 1680 bytes
Desc: not available
Url : http://cens.ioc.ee/pipermail/f2py-users/attachments/20100904/42b724b4/attachment.zip 


More information about the f2py-users mailing list