I was hoping to use openmp to speed up my Fortran code that I run through f2py. However, after compiling succesfully, I can't import the module in Python.
For a Fortran95 module like this:
module test
implicit none
contains
subroutine readygo()
real(kind = 8), dimension(10000) :: q
!$OMP WORKSHARE
q = 7
!$OMP END WORKSHARE
end subroutine
end module
Compiled and imported with these commands:
f2py -m SOmod --fcompiler=gnu95 --f90flags='-march=native -O3 -fopenmp' -c SOtest.f95
python2 -c "import SOmod"
I get an error. The error is for the import - compiling works fine both with f2py or gfortran directly (only get a warning about 'Using deprecated NumPy API').
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: ./SOmod.so: undefined symbol: GOMP_barrier
I get different GOMP_* errors for different OMP directives. Without directives (but with -openmp flag) it works.
Any help would be greatly appreciated.