Self-Assessment Quiz: The Fortran Ecosystem
Twenty questions to confirm you can navigate the ecosystem before Part IV. Aim for 16 or more. Answers and a topic map are at the end — try the whole quiz first.
Question 1
LAPACK and BLAS are written primarily in which language? - A. C - B. Fortran - C. Assembly - D. Python
Question 2
In the BLAS level scheme, a matrix-matrix multiply (gemm) is a:
- A. Level-1 operation (vector-vector)
- B. Level-2 operation (matrix-vector)
- C. Level-3 operation (matrix-matrix)
- D. Level-0 operation (scalar)
Question 3
Decode the LAPACK routine name dsyev.
- A. Double, symmetric, eigenvalues/eigenvectors
- B. Double, general, solve
- C. Single, symmetric, SVD
- D. Double, Hermitian, factorize
Question 4
LAPACK is written once, portably, yet runs fast on many chips because: - A. It is recompiled from scratch for each machine by the user - B. It calls the BLAS interface, and whichever tuned BLAS is installed supplies the fast kernels - C. It contains hand-written assembly for every processor ever made - D. It runs only on supercomputers
Question 5
The reference BLAS from Netlib is slower than OpenBLAS or MKL because the tuned versions: - A. Compute a less accurate answer - B. Use cache blocking and hand-issued vector instructions for the specific hardware - C. Skip most of the arithmetic - D. Are written in Python
Question 6
FFTW is a library for: - A. Solving linear systems - B. Fast Fourier transforms - C. Writing HDF5 files - D. Message passing
Question 7
Which two formats are the standard, portable, self-describing containers for large scientific datasets? - A. CSV and JSON - B. NetCDF and HDF5 - C. TXT and XML - D. ZIP and TAR
Question 8
MPI is best described as:
- A. A single Fortran library you use
- B. A standard/specification with several implementations (MPICH, Open MPI, …) for message passing
- C. A compiler
- D. A file format
Question 9
fpm stands for, and is:
- A. "Fast Program Maker," a profiler
- B. "Fortran Package Manager," a build tool and dependency manager driven by fpm.toml
- C. "Formatted Print Module," an I/O library
- D. "Fortran Physics Model," a solver
Question 10
In an fpm project, a program unit that should become the executable belongs in which directory?
- A. src/
- B. test/
- C. app/
- D. bin/
Question 11
Which fpm command builds (if needed) and runs the executable?
- A. fpm compile
- B. fpm exec
- C. fpm run
- D. fpm start
Question 12
A git dependency in fpm.toml must be written as:
- A. A bare string: stdlib = "https://…"
- B. An inline table: stdlib = { git = "https://…" }
- C. A list: stdlib = ["https://…"]
- D. A comment
Question 13
stdlib is:
- A. Part of the ISO Fortran standard, always available
- B. A community-developed standard library (stats, sorting, strings, I/O, math) you depend on as a package
- C. A replacement for gfortran
- D. A text editor
Question 14
A program using use stdlib_stats, only: mean will not compile with a bare gfortran file.f90 because:
- A. mean is a reserved word
- B. The stdlib_stats module must be compiled and linked first (fpm handles this)
- C. gfortran cannot compile functions
- D. stdlib requires Python
Question 15
fortls is:
- A. A file-listing command
- B. The Fortran Language Server — editor autocomplete, go-to-definition, live diagnostics via LSP
- C. A LAPACK routine
- D. A build system
Question 16
FORD is a tool that:
- A. Runs unit tests
- B. Generates browsable HTML documentation from source and special !!/!> comments
- C. Manages dependencies
- D. Profiles code
Question 17
pFUnit is: - A. A plotting library - B. A unit-testing framework for Fortran (parallel-capable, from NASA Goddard) - C. A package registry - D. A Fourier transform library
Question 18
True or false: adding FORD documentation comments (!!, !>) can break your program's compilation.
Question 19
For a brand-new Fortran library where you control the layout, the lowest-friction build system is: - A. A hand-written Makefile - B. CMake - C. fpm - D. Meson
Question 20
What does this print?
real(dp) :: x(4) = [2.0_dp, 4.0_dp, 6.0_dp, 8.0_dp]
print '(a, f6.2)', 'mean = ', sum(x) / real(size(x), dp)
- A.
mean = 4.00 - B.
mean = 5.00 - C.
mean = 20.00 - D.
mean = 2.50
Answer Key
| Q | Ans | Why |
|---|---|---|
| 1 | B | LAPACK and BLAS reference implementations are Fortran — the floor is Fortran. |
| 2 | C | Matrix-matrix (gemm) is Level 3; $O(n^3)$ flops on $O(n^2)$ data. |
| 3 | A | double · symmetric · ev = eigenvalues/eigenvectors. |
| 4 | B | Portable LAPACK calls the BLAS interface; the installed tuned BLAS supplies speed. |
| 5 | B | Same answer, but blocked for cache and hand-vectorized for the chip. |
| 6 | B | FFTW = Fastest Fourier Transform in the West. |
| 7 | B | NetCDF and HDF5 are the portable, self-describing scientific formats. |
| 8 | B | MPI is a standard with multiple implementations. |
| 9 | B | Fortran Package Manager; manifest is fpm.toml. |
| 10 | C | app/ holds programs (executables); src/ the library; test/ tests. |
| 11 | C | fpm run. |
| 12 | B | A git dependency is an inline table with a git key, not a bare string. |
| 13 | B | stdlib is a community package, not part of the ISO standard. |
| 14 | B | The module must be built/linked first; fpm does that via the dependency. |
| 15 | B | fortls is the Fortran Language Server (LSP). |
| 16 | B | FORD generates HTML docs from source + doc comments. |
| 17 | B | pFUnit is a (parallel-capable) unit-testing framework. |
| 18 | False | Doc markers are ordinary comments; the compiler ignores them. |
| 19 | C | fpm is the least friction for new projects. |
| 20 | A | $(2+4+6+8)/4 = 20/4 = 4.00$; f6.2 prints 4.00. |
Topics to review by question
- Q1–5 → §16.1 (LAPACK/BLAS, the levels, separation of concerns, tuned vs reference).
- Q6–8 → §16.2 (FFTW, NetCDF/HDF5, MPI).
- Q9–12 → §16.3 (fpm: layout, commands, dependency syntax).
- Q13–14 → §16.4 (stdlib and why it needs fpm).
- Q15–19 → §16.5 (fortls, FORD, pFUnit, build systems).
- Q20 → §16.4 / Chapter 5 (array intrinsics; also hand-computed output).
Scored below 16? Reread the flagged sections. The one idea worth over-learning is §16.1's separation of concerns — it explains why you call tuned libraries instead of hand-optimizing, a theme that returns in Chapter 21 and Chapter 29.