Re: [f2py] f2py + ifort + openmp
Ethan Gutmann <[email protected]> Thu, 17 Jan 2013 10:58:11 -0700
| Newsgroups | gmane.comp.python.f2py.user |
|---|---|
| Message-ID | <[email protected]> |
Hi Noctuelles, =
The following flags work for me on a linux machine. =
F2PYFLAGS=3D--fcompiler=3Dintelem --f90flags=3D'-fpp -openmp' -lguide --opt=
=3D'-fast' -DF2PY_REPORT_ON_ARRAY_COPY=3D1
f2py -c sourcefile.pyf ${F2PYFLAGS} sourcefile.f90
The -lguide flag is the only difference that stands out for me, I don't thi=
nk -fast should matter, though you could try it too. =
Other information
ifort (IFORT) 10.1 20070913
f2py Version: 1
numpy Version: 1.5.1
python Version: 2.6.5
I struggled with it too, and I'm about to migrate to a new machine so I'm h=
oping I don't have to figure it all out again on that machine. The only en=
vironment variable I can see set that seems like it might affect compilatio=
n is
LIBPATH includes =85 intel/fce/10.0.023/lib
good luck, and let us know if you get it fixed. =
Ethan
On Jan 17, 2013, at 4:22 AM, Noctuelles <[email protected]> wrote:
> Dear all,
> =
> I am new to the mailing list and almost new to python/fortran programm=
ing.
> 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=3Dintelem -c -m modules modules.f90 only : mod1 mod2 mod=
3 :
> =
> 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 pro=
blem
> 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=3D"-fopenmp -O3", i.e.
> =
> f2py --fcompiler=3Dgfortran --opt=3D"-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 compil=
ed by
> gfortran, I have a segmentation fault.
> That's way I have to use ifort (this explains why I use the --fcompiler=
=3Dintelem
> in the first example).
> =
> f2py --fcompiler=3Dintelem --opt=3D"-fopenmp -O3" -c -m modules modules.f=
90 only :
> mod1 mod2 mod3 :
> =
> BUT... If I use ifort and put --opt=3D"-fopenmp -O3" ... the Makefile wor=
ks, 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 th=
is last
> case the modules.so file is not created.
> =
> f2py --fcompiler=3Dintelem -c --opt=3D"-O3" --f90flags=3D"-fpp -openmp -D=
__OPENMP"
> -liomp5 -m modules modules.f90 only : mod1 mod2 mod3 :
> =
> Have you any idea?
> =
> Thanks for your attention,
> best regards.
> =
> Noctuelles
> =
> =
> _______________________________________________
> f2py-users mailing list
> f2py-users-Y4l6ocDipWCuvFJfX82//[email protected]
> http://cens.ioc.ee/mailman/listinfo/f2py-users