[f2py] f2py + ifort + openmp
Noctuelles <[email protected]> Thu, 17 Jan 2013 11:22:07 +0000 (UTC)
| Newsgroups | gmane.comp.python.f2py.user |
|---|---|
| Message-ID | <[email protected]> |
Dear all,
I am new to the mailing list and almost new to python/fortran programming.
However, that is my problem.
I wrote a code in python that uses modules written in fortran. Then, for the
compilation in the Makefile I put
f2py --fcompiler=intelem -c -m modules modules.f90 only : mod1 mod2 mod3 :
and everything works fine.
Since in the fortran modules there are many do loops, I want them to run even
faster than now, that's why I learned how to use OPENMP, but I have a problem
while compiling, I mean, while running the Makefile.
In fact, if I use as a fortran compiler gfortran, I have to add the flags
--opt="-fopenmp -O3", i.e.
f2py --fcompiler=gfortran --opt="-fopenmp -O3" -c -m modules modules.f90 only :
mod1 mod2 mod3 :
and in this way I can create modules.so and my script can run in parallel.
My problem is that if I run the python script with fortran modules compiled by
gfortran, I have a segmentation fault.
That's way I have to use ifort (this explains why I use the --fcompiler=intelem
in the first example).
f2py --fcompiler=intelem --opt="-fopenmp -O3" -c -m modules modules.f90 only :
mod1 mod2 mod3 :
BUT... If I use ifort and put --opt="-fopenmp -O3" ... the Makefile works, it
creates modules.so, but the python script does not run in parallel!
I also tried with the following flags (I found while googling), but in this last
case the modules.so file is not created.
f2py --fcompiler=intelem -c --opt="-O3" --f90flags="-fpp -openmp -D__OPENMP"
-liomp5 -m modules modules.f90 only : mod1 mod2 mod3 :
Have you any idea?
Thanks for your attention,
best regards.
Noctuelles