Fortran numerical loops: do concurrent and array intrinsics
11 steps · about 4 h 35 min · Intermediate
- Operators and flow control — Fortran Programming Language (doc, fortran-lang.org, 20 min)
Start with the official community tutorial on ordinary do loops, then see where do concurrent sits and what it promises.
- Introduction to Modern Fortran: Array expressions and assignments (tutorial, EPCC, University of Edinburgh, 25 min)
Teaches whole-array expressions, reductions, where and any/all, so you can remove many explicit loops first.
- Array Intrinsics (tutorial, University of Virginia Research Computing, 25 min)
Sorts the intrinsics into inquiry, construction and reduction, and explains how the DIM argument changes the result shape of sum.
- Array handling — Fortran Programming Language (guide, fortran-lang.org, 30 min)
Covers masked assignment with where, the forall construct and the full list of reductions, which is useful background for the move to do concurrent.
- Getting started with Fortran (reference, Anne Fouilloux, 20 min)
Gives practice with size, shape, count, sum, minloc and maxloc, including their mask arguments.
- Control Structures (reference, Modern Fortran (dabamos), 15 min)
Shows do concurrent syntax with multiple indices and the Fortran 2018 inline index declaration. It also notes that forall is obsolescent.
- DO CONCURRENT (doc, Intel Fortran Compiler Developer Guide, 20 min)
Reference for the formal header, mask expression and local/shared locality specifiers.
- Parallel programming with Fortran 2008 and 2018 coarrays (tutorial, Coarrays course (coarrays.sourceforge.io), 25 min)
Includes a short, useful comparison of an independent loop body with an order-dependent one, and shows why the restrictions matter.
- Accelerating Fortran DO CONCURRENT with GPUs and the NVIDIA HPC SDK (article, NVIDIA Technical Blog, 25 min)
A worked example of stencil-style loops compiled for multicore CPUs and GPUs, with local clauses.
- Performance Portability of Do Concurrent in Fortran (blog, Jorge Galvez Vallejo, 30 min)
Covers column-major loop order, masks in the loop header and memory-transfer pitfalls, so you can tune loops for real performance.
- Portability of Fortran's 'do concurrent' on GPUs (article, Caplan and Stulajter, arXiv, 40 min)
A research case study on a real 9,000-line code, including the Fortran 2023 reduce clause, as a final reality check.