View on GitHub

SSC Coding Guidelines

Fortran Coding Guidelines

Our recommendations for creating and maintaining reliable scientific software in Fortran.

Fortran general remarks

Fortran is used for scientific high-performance computing focusing on numerical applications. It is especially strong for array-based operations, with its inherent support for parallelism and vectorization.

Fortran code is most often legacy code having been developed over generations of researchers, using different Fortran dialects (most commonly Fortran77 and Fortran90). It has therefore some very language-specific topics that are very briefly summarized here. For a more complete list, consult the Fortran language community.

Good default choices

Here are our suggested default choices for build systems and third party libraries:

Our Fortran Project Template is a simple way to start a new Fortran project with all of the above already set up - just click on the green Use this template button. You can try it out and compare to learn how to adapt this for your legacy Fortran project.

Fortran standards

Fortran has different standards according to its version. Some general remarks are summarized here, loosely based on the Fortran90 documentation, Fortran-lang and own experience:

This list is by no means complete, there are many constructs in Fortran legacy code that require specific techniques for adaption, but this is beyond the scope of this guideline.

Tooling

Good tools make it easier to develop good code. Some tools have been named above, here are some more recommendations:

The Fortran ecosystem does not benefit from a vast library usage as is the case in ie. Python. Make use of BLAS/LAPACK calls whenever possible, same applies to FFTs. For more specific operations such as solution of differential equations, different libraries exist.

Other recommendations