[Numpy-discussion] How to test f2py?

Kurt Smith kwmsmith at gmail.com
Fri Feb 26 11:01:31 EST 2010


On Thu, Feb 25, 2010 at 7:18 PM, David Cournapeau <david at silveregg.co.jp> wrote:
> Kurt Smith wrote:
>
>> I'm the developer of fwrap.  It is coming along, but will be at least
>> a month, likely two before the first release.  (The main areas that
>> need some TLC are the fortran parser and the build system; the build
>> system will leverage numpy's distutils unless waf is easy to get
>> working.) The first release will cover a large portion of f2py's
>> current functionality, but I don't plan on having python callbacks
>> working then.  Callbacks will be a part of the second release.
>>
>> An issue that you should be aware of is that fwrap will not work with
>> f77, and requires gfortran 4.3.3 or greater, since it uses C
>> interoperability features not available in f77.  (Fwrap will work with
>> any 'modern' fortran compiler that has the basic C interoperability
>> features implemented.  Looking around it appears that all of them do
>> have the basic set necessary, see [1].  So this only excludes f77.)
>
> By f77, do you mean g77, i.e. the fortran compiler in the GNU gcc 3.x
> suite ?

Yes, my bad.  For some reason 'apt-cache search' finds 'f77' but not
'g77' here.  Fwrap makes use of the ISO C BINDING intrinsic module and
BIND(C) attributes heavily -- compilers that handle *only* Fortran 77
code don't have this.

>
> If so, that's quite a bummer for scipy. I don't see us removing support
> for g77 in the short or even mid term (many distributions depend on it,
> and that's not counting windows where there is still no gcc 4.x official
> support from MinGW).
>
> Do you have a list somewhere of what exactly is required for fwrap from
> the fortran compiler ?

Not a comprehensive list, although that would be good to draw up.
I'll do that soon.

It is entirely possible to add in support for FORTRAN 77-only stuff,
to allow g77 to be supported.  Since g77 is important to support in
scipy it's probably worth the effort.  But that will have to come
later (over the summer); it wouldn't be too hard.

The reason for the new stuff isn't purely academic, either -- it
allows interoperability between C structs and Fortran derived types,
and greatly improves portability, to the point that fwrap doesn't need
to be installed for the wrapped code to compile (similar to
Cython-generated code).

Kurt

>
> cheers,
>
> David



More information about the NumPy-Discussion mailing list