Information about running Fortran codes under Linux

I am interested in any information people have that could be useful here; please send email to the address at the bottom of the page. As I am no longer actively developing in Fortran, I mostly add info here when someone else tells me it's missing. So please let me know if you miss something here!

Recent (within past year) Additions

25 February 2015 -- Added "findent" (thanks Willem Vermin), added a "historical" page which contains information about discontinued products.
Fortran is the language of the past, and one of the languages of the present, as far as physics is concerned. Hence this page. This page system was originally oriented towards the previous version (F77) of Fortran, but it now contains (as far as I know) all information on F90/F95 for Linux as well.

These pages are almost entirely specific to Linux, with the exception of the paragraph you are reading right now. For general Fortran information, The Fortran Library and The Fortran Market are good places to start. Check out one of the following links if you need to learn Fortran 77 or Fortran 90. Arnaud deSitter maintains a page on Fortran Compiler Tips and Tricks. Finally, here are some tips on what constitutes good Fortran coding style.

One more note: I run Linux on an x86 box, thus my experience comes solely from experience with this platform. All comments below apply to the x86 platforms unless specifically noted.

Fortran Compilers for Linux

There are several choices. Here is a list. Please contact me if you see something inaccurate or know of something that is missing. Click on the compiler name for more detailed information.

Commercial Compilers

The information below is mostly about the compilers' capabilities. Polyhedron Software has posted a table making performance comparisons between many linux compilers. Not all the ones listed below are covered on their page, but they do have many different benchmarks and thus give a better idea of speed differences in a wide range of applications.

The theory group at NIKHEF has done some comparisons as well, you can see their results at their fortran performace page.

Free Compilers

Comparisons between compilers, benchmarks

More information to come here when I find it. Contributions are welcome.
Performance comparison: Absoft/Intel/Lahey/Portland -- John Wolter from NASA sent a note about this page.
Porting Experiences for Six Different Compilers --- Barbara Robson has sent in comments about linux fortran compilers based on her project to port an F95 code. Compilers covered are PGI, NAG, Absoft, Lahey, Fujitsu, and NA Software.
Polyhedron Benchmarks --- Polyhedron maintains a very thorough table of benchmarks for various Fortran compilers, interesting for anyone desiring the utmost in performance.
Phoenix vs. the Linux Compilers --- Peter Hauschildt has submitted a detailed comparison of the performance of the Phoenix code when compiled by Absoft, NAG, and PGI compilers on x86 Linux boxes. Phoenix is a VERY LARGE stellar atmospherics code.
My personal silly benchmark
I have a very small code which computes bremsstrahlung energy-loss distributions for high-energy electrons. Go here to pick up a package containing this benchmark and some instructions. The program almost certainly fits in cache. Go here to see results of running this benchmark on my machine, and others, using code from various compilers.

Tips and Tricks

Suggestions and info to help you get the most out of your Fortran+Linux system.

Linux-Specific Fortran Tools

These packages help use Fortran on Linux systems more effectively and/or more easily.

Compiler driver scripts

These scripts allow you to run f2c and gcc together and with the correct arguments, without having to issue two commands. You issue one command, which looks like a typical Fortran compiler program. It manages the separate phases of f2c and gcc compilation. Slackware comes standard with a script called f77 (which I do not recommend), and RedHat comes standard with fort77 (see below.) fort77 and yaf77 can be found at any Sunsite mirror, directory devel/lang/fortran.

Debugger Support

NAGWare F95 code can be directly debugged with gdb, and Absoft's compiler ships with its own fully symbolic source-level debugger. Users of one of the various f2c+gcc packages can use the f2c-stabs package, which is an Emacs interface to gdb. It has its own Fortran parser, and knows how to translate the names used in the Fortran source so that gdb can find them. Look here for a package description from the author (Harvey J. Stein, <>).

Other Fortran Tools Available for Linux

Forcheck --- Forcheck is a Fortran 77 and Fortran 90 parser which verifies the syntax of program units and the consistency of the entire program. It has been developed by Leiden University in the Netherlands, but it is a commercial product. The following information comes from the Forcheck Group at Leiden:
"It warns for all kinds of anomalies such as unassigned or unreferenced items. It produces listings and cross-references of all syntax items. For the global program it provides a call-tree, a subprogram index, and cross-references of procedures, i/o, include files, common blocks and even common-block elements. Forcheck supports most Fortran language extensions of many compilers and can be tuned easily by the user. It can be used as a software engineering tool for small up to very large projects."
I have a copy and am generally quite pleased with it. I am especially happy that it supports F90 and DEC-Fortran STRUCTUREs, so I can analyze much more code than I could with FTNCHEK. There are still a couple of things for which I like FTNCHEK better, for example FTNCHEK has more user-friendly global analysis (it will tell you the line number and type of interface mismatches which reside in different files, something FORCHECK cannot do). Forcheck has a web page (click here).

Source Navigator --- a wonderful tool from Cygnus Solutions. Contains an integrated editor, cross-reference tool, "class browser" (which treats DEC-Fortran STRUCTUREs as "classes"), a graphical front-end to gprof, and more. It is now open-source; check it out at SourceForge.

FTNCHEK --- FTNCHEK is a Fortran-77 parser which will make a nice listing file, construct a subroutine call tree (a sort of flow diagram for your program), and list all variables with their types. It also can do extensive syntax checking, and detects many classes of errors in ANSI fortran-77 code. Most F77 compilers will do none of this for you (except for find the coding errors, if they are severe enough.) The FTNCHEK listing file can be made to look very much like VAX Fortran's FOR/LIS output. Pick it up here.

Findent --- findent indents Fortran source, fixed and free format, and converts Fortran fixed format to Fortran free format.

PlusFORT --- PlusFORT is a very sophisticated package which can analyze, beautify, and improve your Fortran codes. The package is quite a bit more difficult to use than is FTNCHEK (see above), but can do much more. It claims to handle all VAX/VMS extensions. I found that it will accept things such as STRUCTUREs, but does not do much with them other than parse them (sometimes incorrectly computing the size.) A free subset of the complete version is available for Linux platforms. Visit the PlusFORT Page for more information.

Understand --- Understand is a program-analysis tool for Fortran codes. You run this program with your source files as input, and it constructs a database which can be visually browsed. The tool appears to be best suited for "understanding" your program; clicking on any entity (under X windows) allows you to see a diagram of, for example, what routines call a particular subroutine, and what subroutines are called by it; find all the places a particular variable is used, where and how it is defined, etc. It also creates tables of program statistics which can be browsed under a WWW browser. A demo version can be downloaded from their web site. Interactive Software Services Ltd distributes INTERACTER, a "multi-platform Fortran user-interface and graphics library for Unix, VMS, Windows, and DOS." They've had a Linux version available since September 1995. It supports the Fujitsu compiler, f2c and g77; the g77 support applies to Intel, Alpha, and SPARC platforms (you apparently do not need to purchase a separate license for each platform). The Linux version is priced lower than the other Unix versions. This information comes directly from ISS Ltd and I cannot confirm or deny it, as I have no direct experience with the product.

Other Linux Fortran Sites

Look here for historical information about products no longer available.
See either my local page  for more Linux information. 
Or, go to my home page for other non-linux information. 
This page was accessed roughly 5700 times when it resided at MIT. It was accessed about 160,000 times when it was located at UGA between January 1997 and June 2001.
Jeff Templon -