Skip to content

Commit 319aa5d

Browse files
committed
Fix markdownlint
1 parent 1702f55 commit 319aa5d

File tree

4 files changed

+63
-24
lines changed

4 files changed

+63
-24
lines changed

README.md

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# UCL ARC Fortran Tooling Recommendations and Examples
22

3-
This repository aims to improve Fortran best practices within UCL and the wider Fortran community by documenting a growing list of Fortran tools recommended by [UCL ARC](https://ucl.ac.uk/arc).
3+
This repository aims to improve Fortran best practices within UCL and the wider Fortran community by documenting a growing list of Fortran tools recommended by [UCL ARC](https://ucl.ac.uk/arc).
44

55
## Topics covered
66

@@ -16,7 +16,7 @@ This repository aims to improve Fortran best practices within UCL and the wider
1616
- profiling and tracing
1717
- [testing](./testing)
1818

19-
## ARC Fortran projects
19+
## ARC Fortran projects
2020

2121
| Name | Start | End | Repo | Opportunity | Tools | Lessons |
2222
| --- | --- | --- | --- | --- | --- | --- |
@@ -25,11 +25,12 @@ This repository aims to improve Fortran best practices within UCL and the wider
2525
| ALPS | Aug 2022 | Jul 2023 | [GitHub](https://github.com/danielver02/ALPS) | [#691](https://github.com/UCL-ARC/research-software-opportunities/issues/691) | Autotools, Ford | |
2626
| FruitDemand | Apr 2021 | Mar 2023 | | [#382](https://github.com/UCL-ARC/research-software-opportunities/issues/382) | Make, Ford, PFUnit | |
2727
| Trove | Jan 2021 | Aug 2021 | [GitHub](https://github.com/Trovemaster/TROVE/tree/merge-develop-mpi) | [#404](https://github.com/UCL-ARC/research-software-opportunities/issues/404) | Make, pFUnit (see the [PR](https://github.com/Trovemaster/TROVE/pull/44/files#diff-beda42571c095172ab63437d050612a571d0d9ddd3ad4f2aecbce907a9b7e3d0)) | |
28-
| Zacros | Jan 2021 | Sep 2022 | | [#349](https://github.com/UCL-ARC/research-software-opportunities/issues/349) & older | CMake, CTest | |
28+
| Zacros | Jan 2021 | Sep 2022 | | [#349](https://github.com/UCL-ARC/research-software-opportunities/issues/349) & older | CMake, CTest | |
2929

3030
## src code
3131

32-
There are two src codes within this repository [mesh_generator](./src/mesh_generator/) and [poisson](./src/poisson/). These are designed to work together.
32+
There are two src codes within this repository [mesh_generator](./src/mesh_generator/) and [poisson](./src/poisson/). These are designed to work together.
33+
3334
- `mesh_generator` generates a basic square 2D triangular mesh (see [mesh_generator.f90](./src/mesh_generator/mesh_generator.f90) for more details).
3435
- `poisson` is a solver which finds the solution of the steady-state heat conduction equation represented by the Poisson equation over a 2D traingular mesh (see [poisson.f90](./src/poisson/poisson.f90) for more details).
3536

@@ -38,55 +39,71 @@ There are two src codes within this repository [mesh_generator](./src/mesh_gener
3839
A bash script is provided for building ([build.sh](./build.sh)). However, there are some instructions below for building without this script.
3940

4041
### CMake
42+
4143
>Note: we have some [PFunit tests](./testing/pFUnit/) which require a local version of PFunit to be pre-built on your device. Once built, the path to the PFunit `installed` dir will need to be passed via `-DCMAKE_PREFIX_PATH`.
4244
4345
One build system we are utilising cmake (see [CMakeLists.txt](./CMakeLists.txt)). Therefore, to build this repository, please run the following
46+
4447
```sh
4548
cmake -DCMAKE_PREFIX_PATH=/path/to/pfunit/installed/dir -B build
46-
```
49+
```
50+
4751
This will create a [build](./build) directory from within which the project can be compiled...
52+
4853
```sh
4954
cmake --build build
5055
```
56+
5157
This will produce executables for the two src codes, `fortran-tooling-mesh-generator` and `fortran-tooling-poisson`.
5258

5359
### FPM
60+
5461
To build the project using FPM, from the root of the repo, run
62+
5563
```sh
5664
fpm build
5765
```
5866

5967
## Running the src
6068

6169
### Mesh generator
70+
6271
If you have built using CMake, you can run the mesh generator by directly calling the executable
72+
6373
```sh
6474
./build/fortran-tooling-mesh-generator <box_size> <edge_size>
6575
```
6676

6777
If you have built using FPM, you can run the mesh generator via FPM
78+
6879
```sh
6980
fpm run mesh_generator -- <box_size> <edge_size>
7081
```
7182

7283
### Poisson solver
84+
7385
If you have built using CMake, you can run the poisson solver by directly calling the executable
86+
7487
```sh
7588
./build/fortran-tooling-poisson <path_to_mesh_file>
7689
```
7790

7891
If you have built using FPM, you can run the mesh generator via FPM
92+
7993
```sh
8094
fpm run poisson -- <path_to_mesh_file>
8195
```
8296

8397
## Running the tests
98+
8499
If you have built using CMake, you can run the tests by running the following from within the `build-cmake` directory.
100+
85101
```sh
86102
ctest
87103
```
88104

89105
If you have built using fpm, you can run the tests by running the following from the root of the repo
106+
90107
```sh
91108
fpm test
92109
```
@@ -96,16 +113,21 @@ fpm test
96113
[pre-commit](https://pre-commit.com/) is utilised within this repo. pre-commit is a tool to help enforce formatting standards as early as possible.
97114
pre-commit works by running a provided set of checks every time a `git commit` is attempted.
98115

99-
To utilise pre-commit, it must be installed locally. This can be done in several ways. As stated above to minimise non-Fortran build systems, pre-commit can
116+
To utilise pre-commit, it must be installed locally. This can be done in several ways. As stated above to minimise non-Fortran build systems, pre-commit can
100117
be installed globaly on MacOS using home brew
118+
101119
```sh
102120
brew install pre-commit
103-
```
121+
```
122+
104123
or with pip via
124+
105125
```sh
106126
/path/to/python3 -m pip install pre-commit
107127
```
128+
108129
Then, from the root of the repo, you start using pre-commit by running
130+
109131
```sh
110132
pre-commit install
111133
```

debugging/mdb.md

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,50 +7,60 @@ Python >= 3.10
77
## Installation
88

99
Clone the repository
10-
```
10+
11+
```sh
1112
git clone https://github.com/TomMelt/mdb.git
1213
cd mdb
1314
```
1415

1516
Create a virtual Python virtual environment
16-
```
17+
18+
```sh
1719
python3 -m venv $HOME/mdb-venv
1820
```
1921

2022
Activate the virtual environement
21-
```
23+
24+
```sh
2225
source $HOME/mdb-venv/bin/activate
2326
```
2427

2528
Install mdb and the optional dependency with pip3
26-
```
29+
30+
```sh
2731
pip3 install .
2832
pip3 install termgraph
2933
```
3034

3135
## Notes
3236

3337
As part of the CONQUEST project. I (Connor Aird) tried using mdb on the UCL cluster, Myriad. I installed mdb following the above guide within an interactive session with the following modules loaded.
34-
```
38+
39+
```sh
3540
Currently Loaded Modulefiles:
3641
1) beta-modules 3) compilers/intel/2022.2 5) libxc/6.2.2/intel-2022 7) openssl/1.1.1u 9) gerun 11) emacs/28.1
3742
2) gcc-libs/10.2.0 4) mpi/intel/2021.6.0/intel 6) cmake/3.21.1 8) python/3.11.4 10) git/2.41.0-lfs-3.3.0 12) userscripts/1.4.0
38-
```
39-
40-
I then launched an mdb sessions in the background using
4143
```
44+
45+
I then launched an mdb sessions in the background using
46+
47+
```sh
4248
mdb launch -b gdb -n 4 -t ./Conquest
4349
Ctrl+z
4450
bg
4551
```
52+
4653
Then, attached to the session, which appeared to be successful.
47-
```
54+
55+
```sh
4856
(mdb-venv) [ccaecai@node-d00a-124 np-4-debug]$ mdb attach
4957
mdb - mpi debugger - built on various backends. Type ? for more info. To exit interactive mode type "q", "quit", "Ctrl+D" or "Ctrl+]".
5058
(mdb 0-3)
5159
```
60+
5261
Adding a breakpoint seems to be successful,
53-
```
62+
63+
```sh
5464
(mdb 0-3) command break exx_kernel_default.f90:204
5565
0: Breakpoint 2 at 0x7ee299: file exx_kernel_default.f90, line 204.
5666
************************************************************************
@@ -60,8 +70,10 @@ Adding a breakpoint seems to be successful,
6070
************************************************************************
6171
3: Breakpoint 2 at 0x7ee299: file exx_kernel_default.f90, line 204.
6272
```
73+
6374
However, trying to run until hitting this breakpoint results in an error
64-
```
75+
76+
```sh
6577
(mdb 0-3) command c
6678
0: Continuing.
6779
0: [cli_0]: write_line error; fd=9 buf=:cmd=init pmi_version=1 pmi_subversion=1
@@ -146,4 +158,4 @@ However, trying to run until hitting this breakpoint results in an error
146158
3: MPIR_Err_return_comm (comm_ptr=0x7fffffff1100, fcname=0x0, errcode=1090831) at ../../src/mpi/errhan/errutil.c:309
147159
3: 309 ../../src/mpi/errhan/errutil.c: No such file or directory.
148160
3: Missing separate debuginfos, use: debuginfo-install numactl-libs-2.0.12-5.el7.x86_64
149-
```
161+
```

formatting/fortitude.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,18 @@ To minimise the amount of non-Fortran build systems/dependency managers, it may
1212
## Usage in this repo
1313

1414
This repo has been formatted with Fortitude. To check this repo with Fortitude, simply run the following from the root of this repository
15+
1516
```sh
1617
fortitude --config-file formatting/fortitude.toml check
1718
```
19+
1820
The config file, [fortitude.toml](./fortitude.toml), we have provided in the above command contains our rules which alter the [default fortitude rules](https://fortitude.readthedocs.io/en/stable/rules/).
1921

2022
### pre-commit
2123

2224
We have also integrated Fortitude with pre-commit. To set this up, follow the [instructions on the main README.md](../README.md#pre-commit).
2325
Once this is setup, if you then try and commit a poorly formatted Fortran file...
26+
2427
```sh
2528
$ git commit -m "Adding a bad commit"
2629
Fortran Tooling hooks....................................................Failed
@@ -42,9 +45,9 @@ Number of errors: 1
4245
For more information about specific rules, run:
4346

4447
fortitude explain X001,Y002,...
45-
4648
```
49+
4750
Fortitude has helpfully alerted us to our mistake. In the above case, we have tried to use a module without specificying which bits of
4851
the module we require via an `only` clause. If we disagree with a rule we can investigate further by searching the rule ID, here the
49-
rule ID is `C121` which has the description `'use' statement missing 'only' clause` and further info can be found on the
52+
rule ID is `C121` which has the description `'use' statement missing 'only' clause` and further info can be found on the
5053
[Fortitude website](https://fortitude.readthedocs.io/en/stable/rules/use-all/)

testing/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# fortran-unit-testing
2-
Fortran code bases often have next to zero test coverage. Any tests implemented are fully end to end and often just check that a single value in some output file is what we expect it to be. Whilst a test like this can catch a breaking change or bug, it will be unlikely to indicate where that breaking change has been introduced. The solution to this issue is unit testing.
32

4-
There are several tools/frameworks written for unit testing Fortran code. However, these are not widely adopted by research codebases. We would like to understand why that is and help to change it.
3+
Fortran code bases often have next to zero test coverage. Any tests implemented are fully end to end and often just check that a single value in some output file is what we expect it to be. Whilst a test like this can catch a breaking change or bug, it will be unlikely to indicate where that breaking change has been introduced. The solution to this issue is unit testing.
54

6-
There are several examples of good unit testing tools for other languages, such as
5+
There are several tools/frameworks written for unit testing Fortran code. However, these are not widely adopted by research codebases. We would like to understand why that is and help to change it.
6+
7+
There are several examples of good unit testing tools for other languages, such as
78

89
- pytest (Python)
910
- QtTest (Qt in c++)
@@ -14,6 +15,7 @@ These will be used as the basis for what the recommended Fortran unit testing to
1415
## Running all of the tests
1516

1617
All of the test can be ran from within the build directory with the command `ctest`. However, there is a known issue that the tests for test-drive itself will also be ran, as shown below.
18+
1719
```sh
1820
$ ctest
1921
Test project /Users/connoraird/work/fortran-tooling/build

0 commit comments

Comments
 (0)