Page tree
Skip to end of metadata
Go to start of metadata


This three day course is targeted at scientists with little or no knowledge of the Fortran programming language, but need it for participation in projects using a Fortran code base, for development of their own codes, and for getting acquainted with additional tools like debugger and syntax checker as well as handling of compilers and libraries. The language is for the most part treated at the level of the Fortran 95 standard; features from Fortran 2003 or Fortran 2008 are limited to improvements on the elementary level. Advanced Fortran features like object-oriented programming or coarrays will be covered in a follow-on course in autumn.

To consolidate the lecture material, each day's approximately 4.5 hours of lecture are complemented by 3 hours of hands-on sessions.


Reinhold Bader, Nisarg Patel (LRZ)

Lecture notes

from the virtual workshop "Programming with Fortran", from February 22 - 24, 2021, that provides an introduction to the language. Please contact one of the tutors (Bader_at_lrz_dot_de, Patel_at_lrz_dot_de) if questions about any of the materials provided below arise.

Environment to use for the Exercises

This should be prepared in advance, before the course starts.

  • Please use your own laptop or institute cluster for the hands-on sessions. On your laptop or PC you should run either a Linux distribution, or a Microsoft Linux for Windows subsystem.
  • A recent version of the gfortran compiler should be installed. Alternatively, the Intel compiler (ifort, most recent version available for free) can be used.
  • Linux installation should include the BLAS library or (alternatively) the Intel MKL library (which contains a tuned BLAS implementation; the MKLROOT environment variable should be appropriately set to the base directory of the MKL installation).
  • It may be useful to have further tools like gdb and valgrind installed.
  • Of course, you can use your favourite editor to create new Fortran source files. We recommend either vi, emacs, or geany.


The exercise document describes the problems to be solved. The following ZIP package contains both some code examples and the skeleton codes that provide starting points for many of the exercises:

The ZIP package for the solutions to the exercises are separated into one per course day:

Please unpack all the above ZIP files within the same folder, using the unzip command. Note that the Makefiles in the examples may need minor modifications to fit the specifics of your environment.

Further information about the language

For quick reference on selected language elements you may also consult the documentation provided by the compiler vendors, e.g. here for Intel and GNU, but be aware also of non-portable vendor extensions:

A draft of the Fortran 2018 standard is available in PDF format at

It is recommended to use this document for reference, e.g., looking up standard intrinsic procedure (these are in section 16.9) as well as syntax definitions. As far as the general language rules are concerned, the document is rather hard to read and therefore unsuitable as a guide for learning the language semantics.

Copyright and Licensing

The copyright for this work is owned by Leibniz Supercomputing Centre.

This work is licensed under the Creative Commons Attribution Non-Commercial 3.0 Unported License. To view a copy of this license, visit When attributing this work, please use the following text block:

  • Programming with Fortran, Leibniz Supercomputing Centre, 2009-21. Available under a Creative Commons Attribution Non-Commercial 3.0 Unported License.

  • No labels