[Numpy-discussion] state of G3F2PY?
Tue Jun 16 11:13:59 CDT 2009
On Tue, Jun 16, 2009 at 8:21 AM, william
> Hi! I'm looking at trying to bind a rather large (>150K lines of code)
> crystallography library to python and would like to know what the state of
> F2py is. Are allocatable arrays supported? Derived types? Modules,
> Pointers, etc.? Is there a list somewhere? Has anyone else looked into
> wrapping such a large code base? If so, any pointers?
I've never used the current distributed version of f2py (numpy.f2py I
believe is the default one) to wrap a library as large as this, and I
don't believe that f2py can handle assumed-shape arrays as arguments
to routines -- I haven't checked its support for allocatable, though,
but I don't think so. I'm certainly open to correction, though. In
my experience, f2py excels at wrapping Fortran 77-style programs with
older array passing conventions, where the shape information is passed
in as arguments to a subroutine/function.
It won't solve your problem currently, but you might be interested in
my GSoC project which aims to do just what you want -- binding a
fortran library to Cython/Python, with support for
allocatable/assumed-shape/assumed-size array arguments, pointers,
derived types, modules, etc. It is being heavily developed as we
speak, but will (hopefully) be usable by sometime this fall.
Your library seems pretty large, which would be an excellent test for
the GSoC project. If you are willing, and when the project is ready
to tackle such a library, we'd be glad to work with you to get your
library wrapped. As mentioned, we won't be at this point until the
Pearu has been kind enough to let us use the 'fparser' module from the
G3F2PY project as the fortran parser, so the work of f2py continues on
in our GSoC work.
There are a few software requrirements -- we've tried to keep
dependencies to a minimum:
1) a fortran compiler that supports the intrinsic ISO_C_BINDING module
-- gfortran 4.3.3 supports it, as do pretty much every current version
of other compilers.
2) The GSoC project is distributed with Cython.
3) Python version >= 2.5.
4) Hopefully you're not on windows -- we certainly plan on supporting
Windows at some point in the future, but we don't have access to it
for testing right now.
Hope this helps,
More information about the Numpy-discussion