[Numpy-discussion] f2py and openmp on mac os x with gfortran

Juan fiolj at yahoo.com
Thu Jul 21 05:34:13 EDT 2011


Hi Brandt, I am on linux and see the same problem. It is solved (at least here)
if you add at the end the library libgomp, i.e:
f2py -c -m play play.f90 --fcompiler=gfortran --f90flags="-fopenmp" -lgomp
Hope it helps,
     Juan

> Hello,
> I'm struggling to create openmp subroutines. I've simplified the problem
> down to the subroutine below.
> 
> -- play.f90 --
> subroutine step(soln,n)
>   implicit none
>   integer n,i
>   real*8 soln(n)
> 
>   !f2py intent(in) n
>   !f2py intent(out) soln
>   !f2py depend(n) soln
> 
> !$OMP PARALLEL DO
>   do i=1,n
>     soln(i) = .1
>   end do
> !$OMP END PARALLEL DO
> end subroutine step
> 
> 
> I compile this with the command:
> 
> f2py -c -m play play.f90 --fcompiler=gfortran --f90flags="-fopenmp"
> 
> This completes successfully. When I import the module, I get the following
> error message.
> 
> $ python -c 'import play'
> Traceback (most recent call last):
>   File "<string>", line 1, in <module>
> ImportError: dlopen(./play.so, 2): Symbol not found: _GOMP_parallel_end
>   Referenced from: /home/bbelson/Desktop/SOR/play.so
>   Expected in: flat namespace
>  in /home/bbelson/Desktop/SOR/play.so
> 
> It seems to me that the linking step is broken, however I did not see any
> other options in the f2py documentation to change the linking step. Did I
> miss something?
> 
> Thanks,
> Brandt



More information about the NumPy-Discussion mailing list