[UCI-Linux] HOWTO Pythonize a FORTRAN program

Harry Mangalam harry.mangalam at uci.edu
Thu Jul 31 11:07:17 PDT 2008


From the intro at CaR (Computers and Research) talk:
<http://forums.es.uci.edu/BioBB/viewforum.php?f=10>

Despite many reports of its demise, FORTRAN remains quite alive. For 
straight numerical computation, FORTRAN compilers are among the best 
available and there are a number of Open Source FORTRAN compilers 
available - F77, GNU FORTRAN, G95 are the ones that roll off the tip 
of my brain immediately. The Intel FORTRAN compiler for Linux, 
MacOSX, and Windows is also free for academic use and is very fast on 
Intel hardware.

However, despite its advantages for numerical code, it's not a 
particularly attractive program for dealing with humans. Handling 
commandline options, interfacing with GUI widget sets, and connecting 
with relational databases are among those things it's not 
particularly suited for.

In order to make existing FORTRAN programs more amenable to current 
uses, I've written a HOWTO on wrapping a FORTRAN program with Python, 
to use Python's interoperations with other programming languages, and 
other abilities to make for a more usable experience. It requires 
almost no modification of the existing FORTRAN code besides 
converting the main function into a callable subroutine (generally a 
1 line modification). The FORTRAN code continues to run as fast as it 
ever did but using Python, you can easily add many features to the 
FORTRAN that would otherwise be quite difficult.

The HOWTO is currently hosted here:
<http://moo.nac.uci.edu/~hjm/fd_rrt1d/index.html>

Thanks to Vladimir Mandelshtam for allowing his code to be used as the 
basis for this HOWTO.

-- 
Harry Mangalam - Research Computing, NACS, E2148, Engineering Gateway, 
UC Irvine 92697  949 824-0084(o), 949 285-4487(c)
--
..Kick at the darkness til it bleeds daylight.
(Lovers in a Dangerous Time) - Bruce Cockburn


More information about the UCI-Linux mailing list