Re: [f2py] f2py and F90 compiler options
Kevin Mitchell <[email protected]>
| Newsgroups | gmane.comp.python.f2py.user |
|---|---|
| Message-ID | <[email protected]> |
Mmm, it would seem that the -frecord-marker=4 isn't ending up in all the right places. I too have often found passing flags to the compiler/linker through f2py to be somewhat confounding. When you compile with f2py, do any of the echo'ed compile commands NOT have the "-frecord-marker=4" flag in them? I've found sometimes that rearranging the order of arguments to f2py can help. You could also try setting the F90FLAGS F90FLAGS="$F90FLAGS -frecord-marker=4" f2py -m testfort -c testfort.f90 --f90flags="-frecord-marker=4" Kevin On Fri, Jun 5, 2009 at 1:13 PM, Jeremy Roberts<[email protected]> wrote: > Hi, > > I'm new to f2pi, and I'm seemingly running into issues using the Fortran-90 > compiler options. The issue is that I have a large Fortran unformatted file > with a record marker length of 4, and default on my system is 8. I can fix > this by using "-frecord-marker = 4". A Fortran executable works fine to > read this. > > However, using f2pi and calling the same subroutine from Python yields an > error indicating that the "-frecord-marker" assignment hasn't been properly > used. > > Fortran 90 : > > terminal% gfortran -frecord-marker=4 testfort.f90 testmain.f90 -o testx > terminal% testx > ** read ** > > where my files are: > > module testfort ! testfort.f90 > implicit none > contains > subroutine fudge(a) > integer, intent(in) :: a > integer :: ucov=77, io > open (unit = ucov, file = "44groupcov", action = "read", status = > "old", & > position = "rewind", iostat = io, form="unformatted") > read(ucov) > print *, " ** read ** " > end subroutine fudge > end module testfort > > program testmain ! testmain.f90 > use testfort > implicit none > call fudge(1) > end program testmain > > Note, without the frecord assignment, I get: > terminal% gfortran testfort.f90 testmain.f90 -o testx > terminal% testx > At line 9 of file testfort.f90 > Fortran runtime error: Invalid argument > > which seems to mean it's expecting a different file marker length in the > unformatted file "44groupcov". > > Now, using f2py: > > terminal% f2py -m testfort -c testfort.f90 --f90flags="-frecord-marker=4" > --fcompiler=gfortran > terminal% python test.py > At line 9 of file testfort.f90 > Fortran runtime error: Invalid argument > > Where test.py is: > > #! /usr/bin/env python > import testfort > testfort.testfort.fudge(1) > > > Any insight as to what I'm doing wrong would be greatly appreciated. > > I'm using f2py version 2_5972 and Python 2.5.4. > > > > _______________________________________________ > f2py-users mailing list > f2py-users-Y4l6ocDipWCuvFJfX82//[email protected] > http://cens.ioc.ee/mailman/listinfo/f2py-users > >