Modern Fortran Programming on Gadi
This document is a short introduction of modern Fortran for scientific computing. We focus on compiling and running parallel modern Fortran programs on Gadi. We will look into the basic language syntax, learn array-focused features, and compile with Gadi-supported compilers. However, this is not a programming language course - we don’t cover programming concepts in depth.
Note
This project is under active development.
Contents
- Tutorial
- Fortran Programming Basics
- What we cover
- Compile and run
- Source form
- Types and declarations
- Operators (overview)
- Input and output
- If and case
- Loops
- Declaring arrays
- Array constructors and assignments
- Declaration and Rank
- Column-Major Order (Crucial!)
- Initialisation
- Accessing Elements and Slicing
- Matrix Arithmetic vs. Element-wise
- Dynamic Allocation
- Summary Table
- Intrinsic procedures (basics)
- Intrinsic procedures (linear algebra)
- Intrinsic procedures (reductions)
- Intrinsic procedures (location querying)
- The
element-wisemasks andwhereconstruct - Syntax
- The Independence Contract
- Basic Anatomy
- How to Import Modules
- Controlling Namespace (
only) - Subroutines vs functions
- Subroutines
- Functions
- Arguments and Intent (The Contract)
- Pass-By-Reference
- Modules and Interfaces
- The File Extensions
- The “Header” Difference (.mod files)
- Dependency Management (Makefiles)
- Fortran Programming Basics