Python Task Force Home

SEP Home

About SEP
People
Research
Courses
Software
Internal Info
SEP WWW
SEP Computing
linux
CEES-SEP
Back-ups
NODE CLONING
CLUSTER BUILDING
NODE UPGRADING
Comp. Environ.
Configuring Mail
Computer Maint.
Makefiles
Mathematica FAQ
Matlab FAQ
Other info
New Accounts
Cluster node allocation
Using pod
Printing
Python Task Force
UNIX Setup



Usernames of participants

bob, shaines, bill, daniel, lomask, nick, shan, paul


Next meeting: Wed, July 22, 10 AM


Is it worth using on a large scale python drivers for Fortran subroutines, interfaced with f2py? [Nick Vlad]:

Disadvantages:

  1. Robustness:

    F2py tries to be smarter than it should and I did not find a way to switch that off. I.e., if you pass to it a vector V of length n, and the number "n" itself (F-77 style), it will recognize that n=len(V) and the resulting subroutine will only take as input V itself. And other such hacks, of which the author must be quite proud of. They work most of the time, but this being software written by a human being, from time to time it will fail. As a result, you will have 30-year old, 100% reliable f77 legacy code (lapack, etc), behaving unpredictably.

  2. Current reliability:

    F90/95 not fully implemented (i.e. does not recognize derived types). F2py is also under continuous development which means current and future bugs, which mean lost productivity on our side.

  3. Long-term reliability:

    F2py is also maintained by a single man - a Mechanical Engineering researcher at Tallin Technical University, Estonia. With python itself slowly evolving, I can see a day in which the f2py guy finds something else to do, f2py ceases to work and all our stuff becomes totally non-reproducible.

  4. Cost:

    To make things work reasonably well, it requires interfaces to be auto generated and hand modified for existing f90 code, or for f2py directives to be embedded in the fortran code. It won't be as simple as only calling a f90 subroutine from a python driver and have an automatic command generate the interface. Given the large amount of old report code that we have, this means thousands of cummulated man-hours.

Advantages:

  1. Python can do what MPI cannot, and it can also do scripting, GUIs and web-related things.
  2. None of F2py's problems seem to be shared by SWIG, which is the tool for interfacing with C/C++. However, unlike with F2py, I did not explore that with working examples of code

Conclusions:

While Python itself has other capabilities worth exploring, F2py does not seem to match the current needs of SEP. The cause is not the concept behind f2py itself, but the implementation. For coarse-grained parallelization I would highly recommend replacing MPI with a python "makefile" calling Fortran-compiled ".x" executables, but not writing a python driver with fortran subroutines.


Python on the web

Python propaganda

Tutorials

Python and scientific computing

Tools




© 2007 , Stanford Exploration Project
Department of Geophysics
Stanford University

Modified: 10/25/07, 15:05:11 PDT , by bill
Page Maintainer: webmaster `AT' sep.stanford.edu