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

2011-07-21 Thread Paul Anton Letnes
Hi,

I had the same problem. I think this might work:
FFLAGS='-fopenmp' f2py -c (etc)
The thing is that f2py doesn't let you pass the -fopenmp flag at the right time 
to the compiler, so you have to use some sort of environment variable trick. By 
the way, as far as I know, this is the case also on non-mac platforms.

Did that do the trick?

Cheers,
Paul.


On 20. juli 2011, at 21.02, Brandt Belson wrote:

 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
 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


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

2011-07-21 Thread Juan
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
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


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

2011-07-21 Thread Brandt Belson
Hi all,
As Juan said, I didn't include the -lgomp flag for f2py. Once I use that,
the f2py module works with openMP as expected.
Thanks,
Brandt



 Message: 1
 Date: Thu, 21 Jul 2011 11:34:13 +0200
 From: Juan fi...@yahoo.com
 Subject: Re: [Numpy-discussion] f2py and openmp on mac os x with
gfortran
 To: numpy-discussion@scipy.org
 Message-ID: 4e27f295.8050...@yahoo.com
 Content-Type: text/plain; charset=UTF-8

 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



___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


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

2011-07-20 Thread Brandt Belson
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
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


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

2011-07-20 Thread Robin
I'm not at my Mac to check the exact paths but see if pointing one of
the environment variables
LD_LIBRARY_PATH
or
DYLD_LIBRARY_PATH
to a directory where the gfortran openmp libraries can be found - this
will depend on where you got gfortran from and the version, but you
should be able to find it by following the symlink that is the
gfortran command and looking for an appropriate lib/ directory near
the target of that.

Cheers

Robin

On Wed, Jul 20, 2011 at 9:02 PM, Brandt Belson bbel...@princeton.edu wrote:
 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
 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion


___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion