A grab bag of useful tricks in Fortran 2023.
-:/+-
./oydddy/.
./sdmNNmmdh/.
/odNNmNmyshdh/.
-+ymNNmmms...ohy.
.+odmNNmdmm+. ...
-+sdmNNNmdmmo.
/+ydmNNNmddmms-
-+ohmmNNNNmddmmy:
/+ohmmNNNNmdhdmmy/.
.++shdmNNNNNmdhdmmh/.
:/+shdmmNNNNmdhhmmmy/.
.+/+shdmmNNNNNmdhdmmm##.............
-//+shdmmNNNNNmdhyyy##--sssssssssssso+-.
..-##/+shdmmmNNNNmhs/##//+sdhhhyyhddhso+++:
..:oyh## /+shdmmmNNNds##syyyyhhhhhhhdho-.
.:oyhhdmh##/+shddmddy+##+hdysoosyys/-..
./ssssyhdmd:-##//////##ndifmdhyooo+-
:ooo+oosyhdmdyo+######ydmNNNNNmhs/.
:+++///++osyhhhdmmmmmNNNNNNNNmdo-
+++//////+oossshddmmmmmNNNmdy/.
.///////+++oosyhhddmmmmddy/.
.:////+++ossyyhhhhhs+:.
---..........--
This library gathers software that developers at Archaeologic Inc. and Sourcery Institute find useful across many of our projects, including in courses that we teach. Most code starts here because it is too limited in capability to release as a standalone package but too distinct in purpose to fold into other existing packages. Over time, when code that starts here grows in capability, a new repository is born and the corresponding code is removed from the Sourcery repository. Examples include the Assert and Emulators libraries. Following the practice of semantic versioning, code removal causes an increment in the major version number.
test_t
is a parent type to extend when defining unit tests,test_description_t
encapsulates scalar test functions and test descriptoins,vector_test_description
: encapsulates array-valued test functions and test descriptions.test_result_t
encapsulates test deescriptions and boolean (pass/fail) outcomes, andSee the Sourcery GitHub Pages site for HTML documentation generated with [ford
]:
gfortran
) 13.1.0See fpm manifest for the dependencies and developer dependencies,
that fpm automatically downloads and builds via the fpm
command provided in
the "Downloding, Building, and Testing" section below.
git clone git@github.com:sourceryinstitute/sourcery
Executing fpm test -- --help
prints the following message:
Usage: fpm test -- [--help] | [--contains <substring>]
where square brackets ([]) denote optional arguments, a pipe (|) separates alternative arguments,
angular brackets (<>) denote a user-provided value, and passing a substring limits execution to
the tests with test subjects or test descriptions containing the user-specified substring.
gfortran
) compilerWith recent versions of GNU Fortran (gfortran) and OpenCoarrays installed,
execute the following command in a zsh
or bash
-like shell:
fpm test
With recent versions of gfortran
and OpenCoarrays installed,
execute the following command in a zsh
or bash
-like shell:
fpm test --compiler caf --runner "cafrun -n 4"
Substitute the desired number of images for the 4
above.
ifx
) compilerfpm test --compiler ifx --flag "-coarray"
nagfor
) compilerfpm test --compiler nagfor --flag -fpp
Because fpm
uses the compiler name to determine the compiler identity and because
CCE provides one compiler wrapper, ftn
, for invoking all compilers, you will
need to invoke ftn
in a shell script named to identify CCE compiler. For example,
place a script named crayftn.sh
in your PATH with the following contents and with
executable privileges set appropriately:
#!/bin/bash
ftn $@
Then build and test Sourcery with the command
fpm test --compiler crayftn.sh
To use Sourcery with other compilers, please submit an issue or pull request.
After installing ford
, execute the following command in a zsh
or bash
-like
shell:
ford doc/ford-documentation.md
after which opening subdirectory doc/html/index.html
in a browser displays the
documentation.