Skip to content

Commit

Permalink
deploy: fc4d6f9
Browse files Browse the repository at this point in the history
  • Loading branch information
blindij committed Sep 19, 2024
0 parents commit 71f5c9a
Show file tree
Hide file tree
Showing 555 changed files with 124,168 additions and 0 deletions.
Empty file added .nojekyll
Empty file.
Binary file added _images/gh_action_commit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _images/gl_action_commit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _images/gl_green_check_mark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _images/green_check_mark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _images/python_application.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _images/testing_group_work.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
107 changes: 107 additions & 0 deletions _sources/code/fortran/build_pFUnit.md.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
---
orphan: true
---

# Example installation of pFUnit and pFUnit_demos

## Set up the environment

Installing pFUnit requires Git, a Fortran compiler and CMake.

### On a cluster

On an HPC cluster you might need to add a few environment modules. For
example, on [Tetralith](https://www.nsc.liu.se/systems/tetralith/) you
would do:

```bash
module add git/2.19.3-nsc1-gcc-system
module add CMake/3.16.4-nsc1
export FC=/software/sse/manual/mpprun/4.1.3/nsc-wrappers/ifort
```

### On own computer

If you don't have [CMake](https://cmake.org/) or a Fortran compiler
installed yet, one option is to install them into a conda environment
by first saving the following into a file `environment.yml`:

```yaml
name: compilers
channels:
- conda-forge
dependencies:
- cmake
- compilers
```

followed by installing the packages into a new environment:
```bash
conda env create -f environment.yml
```
and finally activating the environment:
```bash
conda activate compilers
```

For good measure, set the `FC` variable to point to your
Fortran compiler (adjust path as needed):
```bash
export FC=$HOME/miniconda3/envs/compilers/bin/gfortran
```

## Clone the pFUnit repository

```bash
git clone --recursive [email protected]:Goddard-Fortran-Ecosystem/pFUnit.git
cd pFUnit
```

## Configure with Cmake

```bash
mkdir build
cd build
cmake ..
```

## Build and install

The following will install pFUnit into a directory `installed` under
the `build` directory.

```bash
make tests
make install
```

## Compiling with pFUnit

When compiling with pFUnit, set:
```bash
export PFUNIT_DIR=$HOME/path/to/pFUnit/build/installed
```

and run CMake with `-DCMAKE_PREFIX_PATH=$PFUNIT_DIR`.


## Clone the pFUnit_demos repository

This is for testing and learning purposes.

```bash
git clone [email protected]:Goddard-Fortran-Ecosystem/pFUnit_demos.git
```

### Try out the Trivial, Basic, and MPI examples

```bash
cd pFUnit_demos
export PFUNIT_DIR=~pFUnit/build/installed/PFUNIT-4.2
cd Trivial
./build_with_cmake_and_run.x
cd ../Basic
./build_with_cmake_and_run.x
cd ../MPI
./build_with_cmake_and_run.x
´´´
5 changes: 5 additions & 0 deletions _sources/concepts.md.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
orphan: true
---

This page has been merged with [Motivation](motivation)
39 changes: 39 additions & 0 deletions _sources/conclusions.md.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Conclusions and recommendations

## The basics

- Learn one test framework well enough for basics
- Explore and use the good tools that exist out there
- An incomplete list of testing frameworks can be found in the [Quick Reference](quick-reference)
- Start with some basics
- Some simple thing that test all parts
- Automate tests
- Faster feedback and reduce the number of surprises


## Going more in-depth

- Strike a healthy balance between unit tests and integration tests
- As the code gets larger and the chance of undetected bugs
increases, tests should increase
- When adding new functionality, also add tests
- When you discover and fix a bug, also commit a test against this bug
- Use code coverage analysis to identify untested or unused code
- If you make your code easier to test, it becomes more modular


## Ways to get started

You probably won't do everything perfectly when you start off... But
what are some of the easy starting points?

- Do you have some single functions that are easy to test, but hard to
verify just by looking at them? Add unit tests.

- Do you have data analysis or simulation of some sort? Make an
end-to-end test with sample data, or sample parameters. This is
useful as an example anyway.

- A local testing framework + GitHub actions is very easy! And works
well in the background - you do whatever you want and get an email
if you break things. It's actually pretty freeing.
Loading

0 comments on commit 71f5c9a

Please sign in to comment.