Summary and Setup

Description

Fortran (a contraction of Formula Translation) was the first programming language to have a standard (in 1954), but has changed significantly over the years. More recent standards (the latest being Fortran 2023) come under the umbrella term “Modern Fortran”. Fortran retains very great significance in many areas of scientific and numerical computing, particularly for applications such as quantum chemistry, plasmas, engineering and fluid dynamics, and in numerical weather prediction and climate models.

This intermediate course concentrates on some of the more recent features which are central to Modern Fortran. Attendees should be familiar with the basics of Fortran programming which might be covered in an introductory course, e.g., the one at,

https://epcced.github.io/2026-03-02-Fortran-intro/

So, attendees should be comfortable writing structured Fortran programs based on modules and procedures, and have a sound grounding in variables, logic, flow-of-control, and so on. Some knowledge of Fortran I/O is assumed.

There are two main topics in this intermediate course: the facilities in Fortran for abstraction and polymorphism provided by classes and interfaces, and the facilities for formal interoperability with ANSI C. The course will cover type extension (“classes” and “inheritance”), type-bound procedures (“methods”), generic procedures (“polymorphism”), and so on. The standard iso_c_binding module provides facilities for interoperability with C; this allow the communication of Fortran entities with direct analogues C, and also Fortran objects (particularly arrays) which have no direct analogue in C.

Further language features concerning arrays, pointers, and facilities for structured programming using submodules will also be covered along the way.

Knowledge of the object-oriented paradigm would be useful, but is not essential. Knowledge of C is required for the material on C/Fortran interoperation. The course will allow programmers interested in working on larger, structured, software projects to make use of (almost) a full complement of Modern Fortran features.

The course requires a Fortran compiler, for which a local machine or laptop may be appropriate [1]. If you do not have access to a Fortran compiler, course training accounts on ARCHER2 will be available which provide access to various compilers. Use of a text editor will be required (some may prefer an IDE, but we do not intend to consider or support IDEs).

[1] This may typically be gfortran, freely available as part of the GNU Compiler Collection (GCC). See e.g., https://gcc.gnu.org/wiki/GFortranBinaries


General Information

Requirements: Participants must have a working laptop or desktop computer with a Mac, Linux, or Windows operating system (not a tablet, Chromebook, etc.) that they have administrative privileges on. They should have access to a terminal (Mac and Linux users should have a terminal installed by default; Windows users should get either MobaXterm or PuTTY. They are also required to abide by the ARCHER2 Training Code of Conduct.

Prerequisite

Prerequisites

You should have used remote HPC facilities before. In particular, you should be happy with connecting using SSH, know what a batch scheduling system is and be familiar with using the Linux command line. You should also be happy editing plain text files in a remote terminal (or, alternatively, editing them on your local system and copying them to the remote HPC system using scp).


Please try to complete the following setup tasks ahead of the lesson.

Create appropriate SAFE accounts


Course attendees should have received instructions on how to set up an Archer SAFE account. Details are available in the [ARCHER2 documentation][archer2-quickstart].

This will allow you to obtain a machine account which will be used for the course. (If you already have a machine account, it is possible to use that, although you may not have access to the course queue reservation.)

Any problems encountered will be addressed as the first part of the course.