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

11 February 2014 -- Cleaned up some broken and changed links.
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).

Foresys --- a very nice static analysis tool from Simulog in France. Does many of the same things that FORCHECK does. A nice plus is that code metrics are included; their value may be debated, but they are included if you want them. Also has a GUI; this is the only linux static analysis tool I have seen (for fortran that is) that has a GUI. Very nice, can easily take you with one click to the definition, or source code, for a variable or function on which you click in a source window. A trial version is available online.

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 RedHat. Also check out a support and extensions page as well as the FAQ.

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.

NAGWare Tools --- Software from NAG for transformation and analysis of Fortran-77 and Fortran-95 code. More information here.

The Fortran Programmer's Workshop This tool can be thought of as an interactive "make" facility. It has methods for organizing source code into libraries, building various programs from this code, running programs, and other code-maintenance facilities. There is a command-line version as well as a new graphical version which uses Tcl/Tk. You can visit the Fortran Programmer's Workshop Web Page for more information. I have no experience with this tool, as I am a diehard make fan.

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.

SNiFF+ --- A "source code engineering tool" which I know is in use at CERN, has now been released for Linux. Note that the version that you can download only works on glibc2.1 systems (like RedHat 6.0). I have not yet tried it, but here is what they sent me:

SNiFF+ is the premier Source Code Engineering tool. SNiFF+ provides an
integrated collection of source code analysis, browsing, navigation,
comprehension, editing, build, and configuration management tools for C,
C++, FORTRAN, Java, and CORBA IDL developers. With support for Windows and
all major UNIX platforms, SNiFF+ enables developers in cross-platform and
multi-language environments to utilize the same tool set and GUI.
Visit their web site to download an evaluation copy and find 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.

asa --- This is an output filter for your Fortran output files. It looks at the Hollerith carriage-control strings in the first character position in each line (those pesky "0", "1", and "+" characters) and converts them into control codes understood by programs like "more" and by Unix printer software. This code should also work on other Unix systems.

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

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 -