F2py is a great tool, but my impression is that it is being left behind by the evolution of Fortran from F90 onward. This is unfortunate; it would be nice to be able to easily wrap new Fortran libraries. I'm curious: has anyone been looking into what it would take to enable f2py to handle modern Fortran in general? And into prospects for getting such an effort funded? Eric
Eric Firing <efiring@hawaii.edu> wrote:
I'm curious: has anyone been looking into what it would take to enable f2py to handle modern Fortran in general? And into prospects for getting such an effort funded?
No need. Use Cython and Fortran 2003 ISO C bindings. That is the only portable way to interop between Fortran and C (including CPython) anyway.
f90wrap [1] extends the functionality of f2py, and can automatically generate sensible wrappers for certain cases. [1] https://github.com/jameskermode/f90wrap On 15 July 2015 at 03:45, Sturla Molden <sturla.molden@gmail.com> wrote:
Eric Firing <efiring@hawaii.edu> wrote:
I'm curious: has anyone been looking into what it would take to enable f2py to handle modern Fortran in general? And into prospects for getting such an effort funded?
No need. Use Cython and Fortran 2003 ISO C bindings. That is the only portable way to interop between Fortran and C (including CPython) anyway.
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Too add to Sturla - I think this is what he mentioned but in more details: http://www.fortran90.org/src/best-practices.html#interfacing-with-python Shawn On Tue, Jul 14, 2015 at 9:45 PM, Sturla Molden <sturla.molden@gmail.com> wrote:
Eric Firing <efiring@hawaii.edu> wrote:
I'm curious: has anyone been looking into what it would take to enable f2py to handle modern Fortran in general? And into prospects for getting such an effort funded?
No need. Use Cython and Fortran 2003 ISO C bindings. That is the only portable way to interop between Fortran and C (including CPython) anyway.
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
-- Yuxiang "Shawn" Wang Gerling Haptics Lab University of Virginia yw5aj@virginia.edu +1 (434) 284-0836 https://sites.google.com/a/virginia.edu/yw5aj/
On 2015/12/03 11:08 AM, Yuxiang Wang wrote:
Too add to Sturla - I think this is what he mentioned but in more details:
http://www.fortran90.org/src/best-practices.html#interfacing-with-python
Right, but for each function that requires writing two wrappers, one in Fortran and a second one in cython. Even though they are very simple, this would be cumbersome for a library with more than a few functions. Therefore I think there is still a place for f2py and f90wrap, and I am happy to see development continuing at least on the latter. Eric
Shawn
On Tue, Jul 14, 2015 at 9:45 PM, Sturla Molden <sturla.molden@gmail.com> wrote:
Eric Firing <efiring@hawaii.edu> wrote:
I'm curious: has anyone been looking into what it would take to enable f2py to handle modern Fortran in general? And into prospects for getting such an effort funded?
No need. Use Cython and Fortran 2003 ISO C bindings. That is the only portable way to interop between Fortran and C (including CPython) anyway.
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
On Tue, Jul 14, 2015 at 10:13 PM Sturla Molden <sturla.molden@gmail.com> wrote:
Eric Firing <efiring@hawaii.edu> wrote:
I'm curious: has anyone been looking into what it would take to enable f2py to handle modern Fortran in general? And into prospects for getting such an effort funded?
No need. Use Cython and Fortran 2003 ISO C bindings. That is the only portable way to interop between Fortran and C (including CPython) anyway.
For my wdmtoolbox I have a f2py wrapped Fortran 77 library. Works great on Linux, but because of the 'C' wrapper that f2py creates you run into the same problem as Cython on Windows. https://github.com/cython/cython/wiki/CythonExtensionsOnWindows I guess if you first find a Windows machine, get it all setup, you may not have to futz with it too much, but I just don't want to do it for such a niche package. I probably have a handful of users. So I've been toying with the idea to use ctypes + iso_c_binding. I could then use MinGW on Windows to compile the code for all versions of Python that have ctypes. I've tested this approach on a few functions and it works, but far from done. My $0.02. Kindest regards, Tim
On 03/12/15 22:38, Eric Firing wrote:
Right, but for each function that requires writing two wrappers, one in Fortran and a second one in cython.
Yes, you need two wrappers for each function, one in Cython and one in Fortran 2003. That is what fwrap is supposed to automate, but it has been abandonware for quite a while. Sturla
participants (5)
-
David Verelst
-
Eric Firing
-
Sturla Molden
-
Tim Cera
-
Yuxiang Wang