[f2py] f2py + ifort + openmp

580 views
Skip to first unread message

Noctuelles

unread,
Jan 17, 2013, 6:22:07 AM1/17/13
to f2py-...@cens.ioc.ee
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


Ethan Gutmann

unread,
Jan 17, 2013, 12:58:11 PM1/17/13
to For users of the f2py program
Hi Noctuelles,

The following flags work for me on a linux machine.

F2PYFLAGS=--fcompiler=intelem --f90flags='-fpp -openmp' -lguide --opt='-fast' -DF2PY_REPORT_ON_ARRAY_COPY=1
f2py -c sourcefile.pyf ${F2PYFLAGS} sourcefile.f90

The -lguide flag is the only difference that stands out for me, I don't think -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 hoping I don't have to figure it all out again on that machine. The only environment variable I can see set that seems like it might affect compilation is

LIBPATH includes … intel/fce/10.0.023/lib

good luck, and let us know if you get it fixed.

Ethan
> _______________________________________________
> f2py-users mailing list
> f2py-...@cens.ioc.ee
> http://cens.ioc.ee/mailman/listinfo/f2py-users


Ee Y

unread,
Jan 18, 2013, 5:59:51 AM1/18/13
to f2py-...@cens.ioc.ee
Hello Ethan,

    thank you for your answer. I tried to used the flags you sent me but I have an error while running the Makefile. I copy the text below:

This is the content of the Makefile

moduleomp: moduleomp.f90
f2py --fcompiler=intelem --f90flags='-fpp -openmp' -lguide --opt='-fast' -DF2PY_REPORT_ON_ARRAY_COPY=1 -c -m moduleomp modul\
eomp.f90 only: paral :

and that is what happens running "make"

make: Warning: File `Makefile' has modification time 33 s in the future
f2py --fcompiler=intelem --f90flags='-fpp -openmp' -lguide --opt='-fast' -DF2PY_REPORT_ON_ARRAY_COPY=1 -c -m moduleomp moduleomp.f90 only: paral :
running build
running config_cc
unifing config_cc, config, build_clib, build_ext, build commands --compiler options
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
running build_src
build_src
building extension "moduleomp" sources
f2py options: ['only:', 'paral', ':']
f2py:> /tmp/tmpK4hQam/src.linux-x86_64-2.7/moduleompmodule.c
creating /tmp/tmpK4hQam
creating /tmp/tmpK4hQam/src.linux-x86_64-2.7
Reading fortran codes...
Reading file 'moduleomp.f90' (format:free)
Post-processing...
Block: moduleomp
Block: moduleomp
In: :moduleomp:moduleomp.f90:moduleomp
get_useparameters: no module omp_lib info used by moduleomp
Block: paral
In: :moduleomp:moduleomp.f90:moduleomp:paral
get_useparameters: no module omp_lib info used by paral
Post-processing (stage 2)...
Block: moduleomp
Block: unknown_interface
Block: moduleomp
Block: paral
Building modules...
Building module "moduleomp"...
Constructing F90 module support for "moduleomp"...
Constructing wrapper function "moduleomp.paral"...
nthreads,thread_id = paral()
Wrote C/API module "moduleomp" to file "/tmp/tmpK4hQam/src.linux-x86_64-2.7/moduleompmodule.c"
Fortran 90 wrappers are saved to "/tmp/tmpK4hQam/src.linux-x86_64-2.7/moduleomp-f2pywrappers2.f90"
adding '/tmp/tmpK4hQam/src.linux-x86_64-2.7/fortranobject.c' to sources.
adding '/tmp/tmpK4hQam/src.linux-x86_64-2.7' to include_dirs.
copying /usr/import/epd/lib/python2.7/site-packages/numpy/f2py/src/fortranobject.c -> /tmp/tmpK4hQam/src.linux-x86_64-2.7
copying /usr/import/epd/lib/python2.7/site-packages/numpy/f2py/src/fortranobject.h -> /tmp/tmpK4hQam/src.linux-x86_64-2.7
adding '/tmp/tmpK4hQam/src.linux-x86_64-2.7/moduleomp-f2pywrappers2.f90' to sources.
build_src: building npy-pkg config files
running build_ext
customize UnixCCompiler
customize UnixCCompiler using build_ext
customize IntelEM64TFCompiler
Found executable /usr/import/intel/fce/9.0/bin/ifort
customize IntelEM64TFCompiler using build_ext
building 'moduleomp' extension
compiling C sources
C compiler: gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -O2 -fPIC

creating /tmp/tmpK4hQam/tmp
creating /tmp/tmpK4hQam/tmp/tmpK4hQam
creating /tmp/tmpK4hQam/tmp/tmpK4hQam/src.linux-x86_64-2.7
compile options: '-DF2PY_REPORT_ON_ARRAY_COPY=1 -I/tmp/tmpK4hQam/src.linux-x86_64-2.7 -I/usr/import/epd/lib/python2.7/site-packages/numpy/core/include -I/usr/import/epd/include/python2.7 -c'
gcc: /tmp/tmpK4hQam/src.linux-x86_64-2.7/moduleompmodule.c
gcc: /tmp/tmpK4hQam/src.linux-x86_64-2.7/fortranobject.c
compiling Fortran 90 module sources
Fortran f77 compiler: /usr/import/intel/fce/9.0/bin/ifort -FI -w90 -w95 -KPIC -cm -fast -tpp7 -xW
Fortran f90 compiler: /usr/import/intel/fce/9.0/bin/ifort -FR -fpp -openmp -KPIC -cm -fast -tpp7 -xW
Fortran fix compiler: /usr/import/intel/fce/9.0/bin/ifort -FI -fpp -openmp -KPIC -cm -fast -tpp7 -xW
compile options: '-DF2PY_REPORT_ON_ARRAY_COPY=1 -I/tmp/tmpK4hQam/src.linux-x86_64-2.7 -I/usr/import/epd/lib/python2.7/site-packages/numpy/core/include -I/usr/import/epd/include/python2.7 -c'
extra options: '-module /tmp/tmpK4hQam/ -I/tmp/tmpK4hQam/'
ifort:f90: moduleomp.f90
ifort: Command line warning: -fast overrides any subsequent processor specific option. '-xW' has no effect
compiling Fortran sources
Fortran f77 compiler: /usr/import/intel/fce/9.0/bin/ifort -FI -w90 -w95 -KPIC -cm -fast -tpp7 -xW
Fortran f90 compiler: /usr/import/intel/fce/9.0/bin/ifort -FR -fpp -openmp -KPIC -cm -fast -tpp7 -xW
Fortran fix compiler: /usr/import/intel/fce/9.0/bin/ifort -FI -fpp -openmp -KPIC -cm -fast -tpp7 -xW
compile options: '-DF2PY_REPORT_ON_ARRAY_COPY=1 -I/tmp/tmpK4hQam/src.linux-x86_64-2.7 -I/usr/import/epd/lib/python2.7/site-packages/numpy/core/include -I/usr/import/epd/include/python2.7 -c'
extra options: '-module /tmp/tmpK4hQam/ -I/tmp/tmpK4hQam/'
ifort:f90: /tmp/tmpK4hQam/src.linux-x86_64-2.7/moduleomp-f2pywrappers2.f90
ifort: Command line warning: -fast overrides any subsequent processor specific option. '-xW' has no effect
/usr/import/intel/fce/9.0/bin/ifort -shared -shared -nofor_main /tmp/tmpK4hQam/tmp/tmpK4hQam/src.linux-x86_64-2.7/moduleompmodule.o /tmp/tmpK4hQam/tmp/tmpK4hQam/src.linux-x86_64-2.7/fortranobject.o /tmp/tmpK4hQam/moduleomp.o /tmp/tmpK4hQam/tmp/tmpK4hQam/src.linux-x86_64-2.7/moduleomp-f2pywrappers2.o -L/usr/import/epd/lib -lguide -lpython2.7 -o ./moduleomp.so
moduleomp.f90(16) : (col. 6) remark: OpenMP DEFINED REGION WAS PARALLELIZED.
ld: /tmp/ipo_ifortvrTUJH.o: relocation R_X86_64_PC32 against symbol `_moduleomp_mp_paral__16__par_region0' can not be used when making a shared object; recompile with -fPIC
ld: final link failed: Bad value
moduleomp.f90(16) : (col. 6) remark: OpenMP DEFINED REGION WAS PARALLELIZED.
ld: /tmp/ipo_ifortvrTUJH.o: relocation R_X86_64_PC32 against symbol `_moduleomp_mp_paral__16__par_region0' can not be used when making a shared object; recompile with -fPIC
ld: final link failed: Bad value
error: Command "/usr/import/intel/fce/9.0/bin/ifort -shared -shared -nofor_main /tmp/tmpK4hQam/tmp/tmpK4hQam/src.linux-x86_64-2.7/moduleompmodule.o /tmp/tmpK4hQam/tmp/tmpK4hQam/src.linux-x86_64-2.7/fortranobject.o /tmp/tmpK4hQam/moduleomp.o /tmp/tmpK4hQam/tmp/tmpK4hQam/src.linux-x86_64-2.7/moduleomp-f2pywrappers2.o -L/usr/import/epd/lib -lguide -lpython2.7 -o ./moduleomp.so" failed with exit status 1
make: *** [moduleomp] Error 1


Finally, this is the content of moduleomp.f90 (i.e. the basic "hello world" example):

module moduleomp

implicit none

contains

subroutine paral(nthreads,thread_id)

integer, intent(out) :: nthreads, thread_id
integer OMP_GET_NUM_THREADS, OMP_GET_THREAD_NUM


!$OMP PARALLEL PRIVATE(thread_id)

thread_id = OMP_GET_THREAD_NUM()
write(*,*) 'Hello World from thread = ', thread_id

if (thread_id .eq. 0) then
nthreads = OMP_GET_NUM_THREADS()
write(*,*) 'Number of threads = ', nthreads
end if

!$OMP END PARALLEL \

end subroutine paral

end module moduleomp


And this is the simple content of my python script:

from moduleomp import moduleomp

print moduleomp.paral()



Thank you again for you help...

Cheers!
n.
_________
_________



>Hi Noctuelles, > >The following flags work for me on a linux machine. > >F2PYFLAGS=--fcompiler=intelem --f90flags='-fpp -openmp' -lguide --opt='-fast' -DF2PY_REPORT_ON_ARRAY_COPY=1 >f2py -c sourcefile.pyf ${F2PYFLAGS} sourcefile.f90 > >The -lguide flag is the only difference that stands out for me, I don't think -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 hoping I don't have to figure it all out again on that machine. The only environment variable I can see set that seems like it might affect compilation is > >LIBPATH includes … 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 <noctu111 at yahoo.es> wrote: > >> Dear all,

Ethan Gutmann

unread,
Jan 18, 2013, 1:09:15 PM1/18/13
to For users of the f2py program
That f90 program compiles for me, but I'm using a different version of ifort on a computer with different libraries etc. Did you try adding the -fPIC option as suggested by this error message?

http://jaytaylor.com/blog/2010/10/06/howto-fix-fpic-errors/

Can you compile moduleomp.f90 directly with ifort with a dummy program to call it? (i.e. take f2py out of the equation)

Ee Y

unread,
Jan 20, 2013, 5:10:42 PM1/20/13
to For users of the f2py program
Dear Ethan,

thanks for bearing with me. I was not sure about where to add the -fPIC option, so:

1) I tried to add the -fPIC option to the --opt flag, but that's the output of the make command

f2py --fcompiler=intelem --f90flags='-fpp -openmp' -lguide --opt='-fast -fPIC -O3' -DF2PY_REPORT_ON_ARRAY_COPY=1 -c -m moduleomp moduleomp.f90 only: paral :
running build
running config_cc
unifing config_cc, config, build_clib, build_ext, build commands --compiler options
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
running build_src
build_src
building extension "moduleomp" sources
f2py options: ['only:', 'paral', ':']
f2py:> /tmp/tmpFqUG_Z/src.linux-x86_64-2.7/moduleompmodule.c
creating /tmp/tmpFqUG_Z
creating /tmp/tmpFqUG_Z/src.linux-x86_64-2.7
Reading fortran codes...
Reading file 'moduleomp.f90' (format:free)
Post-processing...
Block: moduleomp
Block: moduleomp
Block: paral
Post-processing (stage 2)...
Block: moduleomp
Block: unknown_interface
Block: moduleomp
Block: paral
Building modules...
Building module "moduleomp"...
Constructing F90 module support for "moduleomp"...
Constructing wrapper function "moduleomp.paral"...
 nthreads,thread_id = paral()
Wrote C/API module "moduleomp" to file "/tmp/tmpFqUG_Z/src.linux-x86_64-2.7/moduleompmodule.c"
Fortran 90 wrappers are saved to "/tmp/tmpFqUG_Z/src.linux-x86_64-2.7/moduleomp-f2pywrappers2.f90"
  adding '/tmp/tmpFqUG_Z/src.linux-x86_64-2.7/fortranobject.c' to sources.
  adding '/tmp/tmpFqUG_Z/src.linux-x86_64-2.7' to include_dirs.
copying /usr/import/epd/lib/python2.7/site-packages/numpy/f2py/src/fortranobject.c -> /tmp/tmpFqUG_Z/src.linux-x86_64-2.7
copying /usr/import/epd/lib/python2.7/site-packages/numpy/f2py/src/fortranobject.h -> /tmp/tmpFqUG_Z/src.linux-x86_64-2.7
  adding '/tmp/tmpFqUG_Z/src.linux-x86_64-2.7/moduleomp-f2pywrappers2.f90' to sources.
build_src: building npy-pkg config files
running build_ext
customize UnixCCompiler
customize UnixCCompiler using build_ext
customize IntelEM64TFCompiler
Found executable /usr/import/intel/fce/9.0/bin/ifort
customize IntelEM64TFCompiler using build_ext
building 'moduleomp' extension
compiling C sources
C compiler: gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -O2 -fPIC

creating /tmp/tmpFqUG_Z/tmp
creating /tmp/tmpFqUG_Z/tmp/tmpFqUG_Z
creating /tmp/tmpFqUG_Z/tmp/tmpFqUG_Z/src.linux-x86_64-2.7
compile options: '-DF2PY_REPORT_ON_ARRAY_COPY=1 -I/tmp/tmpFqUG_Z/src.linux-x86_64-2.7 -I/usr/import/epd/lib/python2.7/site-packages/numpy/core/include -I/usr/import/epd/include/python2.7 -c'
gcc: /tmp/tmpFqUG_Z/src.linux-x86_64-2.7/moduleompmodule.c
gcc: /tmp/tmpFqUG_Z/src.linux-x86_64-2.7/fortranobject.c
compiling Fortran 90 module sources
Fortran f77 compiler: /usr/import/intel/fce/9.0/bin/ifort -FI -w90 -w95 -KPIC -cm -fast -fPIC -O3 -tpp7 -xW
Fortran f90 compiler: /usr/import/intel/fce/9.0/bin/ifort -FR -fpp -openmp -KPIC -cm -fast -fPIC -O3 -tpp7 -xW
Fortran fix compiler: /usr/import/intel/fce/9.0/bin/ifort -FI -fpp -openmp -KPIC -cm -fast -fPIC -O3 -tpp7 -xW
compile options: '-DF2PY_REPORT_ON_ARRAY_COPY=1 -I/tmp/tmpFqUG_Z/src.linux-x86_64-2.7 -I/usr/import/epd/lib/python2.7/site-packages/numpy/core/include -I/usr/import/epd/include/python2.7 -c'
extra options: '-module /tmp/tmpFqUG_Z/ -I/tmp/tmpFqUG_Z/'
ifort:f90: moduleomp.f90
ifort: Command line warning: -fast overrides any subsequent processor specific option.  '-xW' has no effect
compiling Fortran sources
Fortran f77 compiler: /usr/import/intel/fce/9.0/bin/ifort -FI -w90 -w95 -KPIC -cm -fast -fPIC -O3 -tpp7 -xW
Fortran f90 compiler: /usr/import/intel/fce/9.0/bin/ifort -FR -fpp -openmp -KPIC -cm -fast -fPIC -O3 -tpp7 -xW
Fortran fix compiler: /usr/import/intel/fce/9.0/bin/ifort -FI -fpp -openmp -KPIC -cm -fast -fPIC -O3 -tpp7 -xW
compile options: '-DF2PY_REPORT_ON_ARRAY_COPY=1 -I/tmp/tmpFqUG_Z/src.linux-x86_64-2.7 -I/usr/import/epd/lib/python2.7/site-packages/numpy/core/include -I/usr/import/epd/include/python2.7 -c'
extra options: '-module /tmp/tmpFqUG_Z/ -I/tmp/tmpFqUG_Z/'
ifort:f90: /tmp/tmpFqUG_Z/src.linux-x86_64-2.7/moduleomp-f2pywrappers2.f90
ifort: Command line warning: -fast overrides any subsequent processor specific option.  '-xW' has no effect
/usr/import/intel/fce/9.0/bin/ifort -shared -shared -nofor_main /tmp/tmpFqUG_Z/tmp/tmpFqUG_Z/src.linux-x86_64-2.7/moduleompmodule.o /tmp/tmpFqUG_Z/tmp/tmpFqUG_Z/src.linux-x86_64-2.7/fortranobject.o /tmp/tmpFqUG_Z/moduleomp.o /tmp/tmpFqUG_Z/tmp/tmpFqUG_Z/src.linux-x86_64-2.7/moduleomp-f2pywrappers2.o -L/usr/import/epd/lib -lguide -lpython2.7 -o ./moduleomp.so
moduleomp.f90(13) : (col. 6) remark: OpenMP DEFINED REGION WAS PARALLELIZED.
ld: /tmp/ipo_ifortGwyhCh.o: relocation R_X86_64_PC32 against symbol `_moduleomp_mp_paral__13__par_region0' can not be used when making a shared object; recompile with -fPIC
ld: final link failed: Bad value
moduleomp.f90(13) : (col. 6) remark: OpenMP DEFINED REGION WAS PARALLELIZED.
ld: /tmp/ipo_ifortGwyhCh.o: relocation R_X86_64_PC32 against symbol `_moduleomp_mp_paral__13__par_region0' can not be used when making a shared object; recompile with -fPIC
ld: final link failed: Bad value
error: Command "/usr/import/intel/fce/9.0/bin/ifort -shared -shared -nofor_main /tmp/tmpFqUG_Z/tmp/tmpFqUG_Z/src.linux-x86_64-2.7/moduleompmodule.o /tmp/tmpFqUG_Z/tmp/tmpFqUG_Z/src.linux-x86_64-2.7/fortranobject.o /tmp/tmpFqUG_Z/moduleomp.o /tmp/tmpFqUG_Z/tmp/tmpFqUG_Z/src.linux-x86_64-2.7/moduleomp-f2pywrappers2.o -L/usr/import/epd/lib -lguide -lpython2.7 -o ./moduleomp.so" failed with exit status 1
make: *** [moduleomp] Error 1



2) Then I tried to add the option to --f90flags . Again, it does not compile

f2py --fcompiler=intelem --f90flags='-fpp -openmp -fPIC' -lguide --opt='-fast -O3' -DF2PY_REPORT_ON_ARRAY_COPY=1 -c -m moduleomp moduleomp.f90 only: paral :
running build
running config_cc
unifing config_cc, config, build_clib, build_ext, build commands --compiler options
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
running build_src
build_src
building extension "moduleomp" sources
f2py options: ['only:', 'paral', ':']
f2py:> /tmp/tmp_YINTS/src.linux-x86_64-2.7/moduleompmodule.c
creating /tmp/tmp_YINTS
creating /tmp/tmp_YINTS/src.linux-x86_64-2.7
Reading fortran codes...
Reading file 'moduleomp.f90' (format:free)
Post-processing...
Block: moduleomp
Block: moduleomp
Block: paral
Post-processing (stage 2)...
Block: moduleomp
Block: unknown_interface
Block: moduleomp
Block: paral
Building modules...
Building module "moduleomp"...
Constructing F90 module support for "moduleomp"...
Constructing wrapper function "moduleomp.paral"...
 nthreads,thread_id = paral()
Wrote C/API module "moduleomp" to file "/tmp/tmp_YINTS/src.linux-x86_64-2.7/moduleompmodule.c"
Fortran 90 wrappers are saved to "/tmp/tmp_YINTS/src.linux-x86_64-2.7/moduleomp-f2pywrappers2.f90"
  adding '/tmp/tmp_YINTS/src.linux-x86_64-2.7/fortranobject.c' to sources.
  adding '/tmp/tmp_YINTS/src.linux-x86_64-2.7' to include_dirs.
copying /usr/import/epd/lib/python2.7/site-packages/numpy/f2py/src/fortranobject.c -> /tmp/tmp_YINTS/src.linux-x86_64-2.7
copying /usr/import/epd/lib/python2.7/site-packages/numpy/f2py/src/fortranobject.h -> /tmp/tmp_YINTS/src.linux-x86_64-2.7
  adding '/tmp/tmp_YINTS/src.linux-x86_64-2.7/moduleomp-f2pywrappers2.f90' to sources.
build_src: building npy-pkg config files
running build_ext
customize UnixCCompiler
customize UnixCCompiler using build_ext
customize IntelEM64TFCompiler
Found executable /usr/import/intel/fce/9.0/bin/ifort
customize IntelEM64TFCompiler using build_ext
building 'moduleomp' extension
compiling C sources
C compiler: gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -O2 -fPIC

creating /tmp/tmp_YINTS/tmp
creating /tmp/tmp_YINTS/tmp/tmp_YINTS
creating /tmp/tmp_YINTS/tmp/tmp_YINTS/src.linux-x86_64-2.7
compile options: '-DF2PY_REPORT_ON_ARRAY_COPY=1 -I/tmp/tmp_YINTS/src.linux-x86_64-2.7 -I/usr/import/epd/lib/python2.7/site-packages/numpy/core/include -I/usr/import/epd/include/python2.7 -c'
gcc: /tmp/tmp_YINTS/src.linux-x86_64-2.7/moduleompmodule.c
gcc: /tmp/tmp_YINTS/src.linux-x86_64-2.7/fortranobject.c
compiling Fortran 90 module sources
Fortran f77 compiler: /usr/import/intel/fce/9.0/bin/ifort -FI -w90 -w95 -KPIC -cm -fast -O3 -tpp7 -xW
Fortran f90 compiler: /usr/import/intel/fce/9.0/bin/ifort -FR -fpp -openmp -fPIC -KPIC -cm -fast -O3 -tpp7 -xW
Fortran fix compiler: /usr/import/intel/fce/9.0/bin/ifort -FI -fpp -openmp -fPIC -KPIC -cm -fast -O3 -tpp7 -xW
compile options: '-DF2PY_REPORT_ON_ARRAY_COPY=1 -I/tmp/tmp_YINTS/src.linux-x86_64-2.7 -I/usr/import/epd/lib/python2.7/site-packages/numpy/core/include -I/usr/import/epd/include/python2.7 -c'
extra options: '-module /tmp/tmp_YINTS/ -I/tmp/tmp_YINTS/'
ifort:f90: moduleomp.f90
ifort: Command line warning: -fast overrides any subsequent processor specific option.  '-xW' has no effect
compiling Fortran sources
Fortran f77 compiler: /usr/import/intel/fce/9.0/bin/ifort -FI -w90 -w95 -KPIC -cm -fast -O3 -tpp7 -xW
Fortran f90 compiler: /usr/import/intel/fce/9.0/bin/ifort -FR -fpp -openmp -fPIC -KPIC -cm -fast -O3 -tpp7 -xW
Fortran fix compiler: /usr/import/intel/fce/9.0/bin/ifort -FI -fpp -openmp -fPIC -KPIC -cm -fast -O3 -tpp7 -xW
compile options: '-DF2PY_REPORT_ON_ARRAY_COPY=1 -I/tmp/tmp_YINTS/src.linux-x86_64-2.7 -I/usr/import/epd/lib/python2.7/site-packages/numpy/core/include -I/usr/import/epd/include/python2.7 -c'
extra options: '-module /tmp/tmp_YINTS/ -I/tmp/tmp_YINTS/'
ifort:f90: /tmp/tmp_YINTS/src.linux-x86_64-2.7/moduleomp-f2pywrappers2.f90
ifort: Command line warning: -fast overrides any subsequent processor specific option.  '-xW' has no effect
/usr/import/intel/fce/9.0/bin/ifort -shared -shared -nofor_main /tmp/tmp_YINTS/tmp/tmp_YINTS/src.linux-x86_64-2.7/moduleompmodule.o /tmp/tmp_YINTS/tmp/tmp_YINTS/src.linux-x86_64-2.7/fortranobject.o /tmp/tmp_YINTS/moduleomp.o /tmp/tmp_YINTS/tmp/tmp_YINTS/src.linux-x86_64-2.7/moduleomp-f2pywrappers2.o -L/usr/import/epd/lib -lguide -lpython2.7 -o ./moduleomp.so
moduleomp.f90(13) : (col. 6) remark: OpenMP DEFINED REGION WAS PARALLELIZED.
ld: /tmp/ipo_ifortR7vdL6.o: relocation R_X86_64_PC32 against symbol `_moduleomp_mp_paral__13__par_region0' can not be used when making a shared object; recompile with -fPIC
ld: final link failed: Bad value
moduleomp.f90(13) : (col. 6) remark: OpenMP DEFINED REGION WAS PARALLELIZED.
ld: /tmp/ipo_ifortR7vdL6.o: relocation R_X86_64_PC32 against symbol `_moduleomp_mp_paral__13__par_region0' can not be used when making a shared object; recompile with -fPIC
ld: final link failed: Bad value
error: Command "/usr/import/intel/fce/9.0/bin/ifort -shared -shared -nofor_main /tmp/tmp_YINTS/tmp/tmp_YINTS/src.linux-x86_64-2.7/moduleompmodule.o /tmp/tmp_YINTS/tmp/tmp_YINTS/src.linux-x86_64-2.7/fortranobject.o /tmp/tmp_YINTS/moduleomp.o /tmp/tmp_YINTS/tmp/tmp_YINTS/src.linux-x86_64-2.7/moduleomp-f2pywrappers2.o -L/usr/import/epd/lib -lguide -lpython2.7 -o ./moduleomp.so" failed with exit status 1
make: *** [moduleomp] Error 1

Finally I "converted" the fortran module in a program and yes, I can compile it with ifort -openmp moduleomp.f90 -o moduleomp

Thank you again for your support!
n.

Ee Y

unread,
Jan 22, 2013, 9:00:39 AM1/22/13
to Ee Y, For users of the f2py program
Hello again,

    just to let you know that I managed to run the code using gfortran instead of ifort. Then, the Makefile looks like

f2py --fcompiler=gfortran --opt="-fopenmp -O3" modules modules.f90 only: mod1 mod2 mod3 :

And... it works :-)
Best,
N.



De: Ee Y <noct...@yahoo.es>
Para: For users of the f2py program <f2py-...@cens.ioc.ee>
Enviado: Domingo 20 de enero de 2013 23:10
Asunto: Re: [f2py] f2py + ifort + openmp

Ethan Gutmann

unread,
Jan 22, 2013, 9:59:28 AM1/22/13
to Ee Y, For users of the f2py program
Hi sorry I wasn't more help, but I'm glad you got it working.  
Reply all
Reply to author
Forward
0 new messages