You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+29-7Lines changed: 29 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# UCL ARC Fortran Tooling Recommendations and Examples
2
2
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).
4
4
5
5
## Topics covered
6
6
@@ -16,7 +16,7 @@ This repository aims to improve Fortran best practices within UCL and the wider
16
16
- profiling and tracing
17
17
-[testing](./testing)
18
18
19
-
## ARC Fortran projects
19
+
## ARC Fortran projects
20
20
21
21
| Name | Start | End | Repo | Opportunity | Tools | Lessons |
22
22
| --- | --- | --- | --- | --- | --- | --- |
@@ -25,11 +25,12 @@ This repository aims to improve Fortran best practices within UCL and the wider
25
25
| ALPS | Aug 2022 | Jul 2023 |[GitHub](https://github.com/danielver02/ALPS)|[#691](https://github.com/UCL-ARC/research-software-opportunities/issues/691)| Autotools, Ford ||
| 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)) ||
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
+
33
34
-`mesh_generator` generates a basic square 2D triangular mesh (see [mesh_generator.f90](./src/mesh_generator/mesh_generator.f90) for more details).
34
35
-`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).
35
36
@@ -38,55 +39,71 @@ There are two src codes within this repository [mesh_generator](./src/mesh_gener
38
39
A bash script is provided for building ([build.sh](./build.sh)). However, there are some instructions below for building without this script.
39
40
40
41
### CMake
42
+
41
43
>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`.
42
44
43
45
One build system we are utilising cmake (see [CMakeLists.txt](./CMakeLists.txt)). Therefore, to build this repository, please run the following
If you have built using FPM, you can run the mesh generator via FPM
92
+
79
93
```sh
80
94
fpm run poisson -- <path_to_mesh_file>
81
95
```
82
96
83
97
## Running the tests
98
+
84
99
If you have built using CMake, you can run the tests by running the following from within the `build-cmake` directory.
100
+
85
101
```sh
86
102
ctest
87
103
```
88
104
89
105
If you have built using fpm, you can run the tests by running the following from the root of the repo
106
+
90
107
```sh
91
108
fpm test
92
109
```
@@ -96,16 +113,21 @@ fpm test
96
113
[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.
97
114
pre-commit works by running a provided set of checks every time a `git commit` is attempted.
98
115
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
100
117
be installed globaly on MacOS using home brew
118
+
101
119
```sh
102
120
brew install pre-commit
103
-
```
121
+
```
122
+
104
123
or with pip via
124
+
105
125
```sh
106
126
/path/to/python3 -m pip install pre-commit
107
127
```
128
+
108
129
Then, from the root of the repo, you start using pre-commit by running
Copy file name to clipboardExpand all lines: debugging/mdb.md
+24-12Lines changed: 24 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -7,50 +7,60 @@ Python >= 3.10
7
7
## Installation
8
8
9
9
Clone the repository
10
-
```
10
+
11
+
```sh
11
12
git clone https://github.com/TomMelt/mdb.git
12
13
cd mdb
13
14
```
14
15
15
16
Create a virtual Python virtual environment
16
-
```
17
+
18
+
```sh
17
19
python3 -m venv $HOME/mdb-venv
18
20
```
19
21
20
22
Activate the virtual environement
21
-
```
23
+
24
+
```sh
22
25
source$HOME/mdb-venv/bin/activate
23
26
```
24
27
25
28
Install mdb and the optional dependency with pip3
26
-
```
29
+
30
+
```sh
27
31
pip3 install .
28
32
pip3 install termgraph
29
33
```
30
34
31
35
## Notes
32
36
33
37
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.
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/).
19
21
20
22
### pre-commit
21
23
22
24
We have also integrated Fortitude with pre-commit. To set this up, follow the [instructions on the main README.md](../README.md#pre-commit).
23
25
Once this is setup, if you then try and commit a poorly formatted Fortran file...
Copy file name to clipboardExpand all lines: testing/README.md
+5-3Lines changed: 5 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,10 @@
1
1
# 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.
3
2
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.
5
4
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
7
8
8
9
- pytest (Python)
9
10
- QtTest (Qt in c++)
@@ -14,6 +15,7 @@ These will be used as the basis for what the recommended Fortran unit testing to
14
15
## Running all of the tests
15
16
16
17
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
+
17
19
```sh
18
20
$ ctest
19
21
Test project /Users/connoraird/work/fortran-tooling/build
0 commit comments