Skip to content

Commit ff66550

Browse files
Merge pull request #8 from jacobwilliams/develop
Develop
2 parents 443fe83 + d0703c3 commit ff66550

11 files changed

Lines changed: 105 additions & 256 deletions

File tree

.github/workflows/CI.yml

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ jobs:
88
fail-fast: false
99
matrix:
1010
os: [ubuntu-latest]
11-
gcc_v: [9] # Version of GFortran we want to use.
12-
python-version: [3.7]
11+
gcc_v: [10] # Version of GFortran we want to use.
12+
python-version: [3.9]
1313
env:
1414
FC: gfortran-${{ matrix.gcc_v }}
1515
GCC_V: ${{ matrix.gcc_v }}
@@ -29,32 +29,45 @@ jobs:
2929
uses: ts-graphviz/setup-graphviz@v1
3030

3131
- name: Setup Fortran Package Manager
32-
uses: fortran-lang/setup-fpm@v3
32+
uses: fortran-lang/setup-fpm@v4
3333
with:
3434
github-token: ${{ secrets.GITHUB_TOKEN }}
3535

3636
- name: Install Python dependencies
3737
if: contains( matrix.os, 'ubuntu')
3838
run: |
3939
python -m pip install --upgrade pip
40-
pip install ford
40+
pip install matplotlib ford
4141
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
4242
4343
- name: Install GFortran Linux
4444
if: contains( matrix.os, 'ubuntu')
4545
run: |
46-
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
47-
sudo apt-get update
48-
sudo apt-get install -y gcc-${GCC_V} gfortran-${GCC_V}
49-
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_V} 100 \
50-
--slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${GCC_V} \
51-
--slave /usr/bingcov gcov /usr/bin/gcov-${GCC_V}
46+
sudo apt-get install lcov
47+
sudo update-alternatives \
48+
--install /usr/bin/gcc gcc /usr/bin/gcc-${{ matrix.gcc_v }} 100 \
49+
--slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${{ matrix.gcc_v }} \
50+
--slave /usr/bin/gcov gcov /usr/bin/gcov-${{ matrix.gcc_v }}
5251
53-
- name: Compile
54-
run: fpm build --profile release
52+
# - name: Compile
53+
# run: fpm build --profile release
5554

5655
- name: Run tests
57-
run: fpm test
56+
run: fpm test --profile debug --flag -coverage
57+
58+
- name: Create coverage report
59+
run: |
60+
mkdir -p ${{ env.COV_DIR }}
61+
lcov --capture --initial --base-directory . --directory build/gfortran_*/ --output-file ${{ env.COV_DIR }}/coverage.base
62+
lcov --capture --base-directory . --directory build/gfortran_*/ --output-file ${{ env.COV_DIR }}/coverage.capture
63+
lcov --add-tracefile ${{ env.COV_DIR }}/coverage.base --add-tracefile ${{ env.COV_DIR }}/coverage.capture --output-file ${{ env.COV_DIR }}/coverage.info
64+
env:
65+
COV_DIR: build/coverage
66+
67+
- name: Upload coverage report
68+
uses: codecov/codecov-action@v2
69+
with:
70+
files: build/coverage/coverage.info
5871

5972
- name: Build documentation
6073
run: ford ./numdiff.md

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
NumDiff -- Numerical Differentiation Library
22
https://github.com/jacobwilliams/NumDiff
33

4-
Copyright (c) 2016-2021, Jacob Williams
4+
Copyright (c) 2016-2022, Jacob Williams
55
All rights reserved.
66

77
Redistribution and use in source and binary forms, with or without modification,

README.md

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77

88
## Status
99

10+
[![GitHub release](https://img.shields.io/github/release/jacobwilliams/NumDiff.svg?style=plastic)](https://github.com/jacobwilliams/NumDiff/releases/latest)
1011
![CI Status](https://github.com/jacobwilliams/NumDiff/actions/workflows/CI.yml/badge.svg)
12+
[![codecov](https://codecov.io/gh/jacobwilliams/NumDiff/branch/master/graph/badge.svg?token=43HK33CSMY)](https://codecov.io/gh/jacobwilliams/NumDiff)
1113

1214
This is currently a work in progress. The goal is a comprehensive library that contains a full suite of computationally efficient implementations of algorithms for sparsity determination and numerical differentiation. This code is hosted on GitHub at: https://github.com/jacobwilliams/NumDiff
1315

@@ -46,42 +48,48 @@ This is currently a work in progress. The goal is a comprehensive library that c
4648

4749
### FPM
4850

49-
A `fmp.toml` file is provided for compiling roots-fortran with the [Fortran Package Manager](https://github.com/fortran-lang/fpm). For example, to build:
51+
A [Fortran Package Manager](https://github.com/fortran-lang/fpm) manifest file is included, so that the library and tests cases can be compiled with FPM. For example:
5052

5153
```
52-
fpm build --profile release
54+
fpm build --profile release
55+
fpm test --profile release
5356
```
5457

55-
And to run the unit tests:
56-
57-
```
58-
fpm test
58+
To use `NumDiff` within your FPM project, add the following to your `fpm.toml` file:
59+
```toml
60+
[dependencies]
61+
NumDiff = { git="https://github.com/jacobwilliams/NumDiff.git" }
5962
```
6063

61-
### FoBiS
64+
To generate the documentation using [FORD](https://github.com/Fortran-FOSS-Programmers/ford), run:
6265

63-
A [FoBiS](https://github.com/szaghi/FoBiS) configuration file (`numdiff.fobis`) is also provided that can also build the library and examples. Use the `mode` flag to indicate what to build. For example:
66+
```
67+
ford numdiff.md
68+
```
6469

65-
* To build all the examples using gfortran: `FoBiS.py build -f numdiff.fobis -mode tests-gnu`
66-
* To build all the examples using ifort: `FoBiS.py build -f numdiff.fobis -mode tests-intel`
67-
* To build a static library using gfortran: `FoBiS.py build -f numdiff.fobis -mode static-gnu`
68-
* To build a static library using ifort: `FoBiS.py build -f numdiff.fobis -mode static-intel`
70+
By default, the library is built with double precision (`real64`) real values. Explicitly specifying the real kind can be done using the following processor flags:
6971

70-
The full set of modes are: `static-gnu`, `static-gnu-debug`, `static-intel`, `static-intel-debug`, `shared-gnu`, `shared-gnu-debug`, `shared-intel`, `shared-intel-debug`, `tests-gnu`, `tests-gnu-debug`, `tests-intel`, `tests-intel-debug`
72+
Preprocessor flag | Kind | Number of bytes
73+
----------------- | ----- | ---------------
74+
`REAL32` | `real(kind=real32)` | 4
75+
`REAL64` | `real(kind=real64)` | 8
76+
`REAL128` | `real(kind=real128)` | 16
7177

72-
To generate the documentation using [ford](https://github.com/Fortran-FOSS-Programmers/ford), run: ```FoBis.py rule --execute makedoc -f numdiff.fobis```
78+
For example, to build a single precision version of the library, use:
7379

74-
To run the test programs, run: ```FoBis.py rule --execute tests -f numdiff.fobis```
80+
```
81+
fpm build --profile release --flag "-DREAL32"
82+
```
7583

7684
## Documentation
7785

78-
The latest API documentation can be found [here](http://jacobwilliams.github.io/NumDiff/). This was generated from the source code using [FORD](https://github.com/Fortran-FOSS-Programmers/ford) (note that the included `build.sh` script will also generate these files).
86+
The latest API documentation can be found [here](https://jacobwilliams.github.io/NumDiff/). This was generated from the source code using [FORD](https://github.com/Fortran-FOSS-Programmers/ford) (note that the included `build.sh` script will also generate these files).
7987

8088
## License
8189

8290
The NumDiff source code and related files and documentation are distributed under a permissive free software [license](https://github.com/jacobwilliams/NumDiff/blob/master/LICENSE) (BSD-style).
8391

8492
## References
8593

86-
* J. Oliver, "An algorithm for numerical differentiation of a function of one real variable", Journal of Computational and Applied Mathematics 6 (2) (1980) 145160. Fortran 77 code from [NIST](ftp://math.nist.gov/pub/repository/diff/src/DIFF)
94+
* J. Oliver, "An algorithm for numerical differentiation of a function of one real variable", Journal of Computational and Applied Mathematics 6 (2) (1980) 145-160. Fortran 77 code from [NIST](ftp://math.nist.gov/pub/repository/diff/src/DIFF)
8795
* Thomas F. Coleman, Burton S. Garbow, Jorge J. More, "Algorithm 618: FORTRAN subroutines for estimating sparse Jacobian Matrices", ACM Transactions on Mathematical Software (TOMS), Volume 10 Issue 3, Sept. 1984, Pages 346-347

build.sh

Lines changed: 0 additions & 52 deletions
This file was deleted.

codecov.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
comment:
2+
layout: header, changes, diff, sunburst
3+
coverage:
4+
ignore:
5+
- test
6+
- doc
7+
status:
8+
patch:
9+
default:
10+
target: 20%
11+
project:
12+
default:
13+
target: 60%

fpm.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name = "NumDiff"
22
version = "1.5.1"
33
author = "Jacob Williams"
44
maintainer = "Jacob Williams"
5-
copyright = "Copyright (c) 2016-2021, Jacob Williams"
5+
copyright = "Copyright (c) 2016-2022, Jacob Williams"
66
license = "BSD-3"
77
description = "Modern Fortran Numerical Differentiation Library"
88
homepage = "https://github.com/jacobwilliams/NumDiff"

numdiff.fobis

Lines changed: 0 additions & 156 deletions
This file was deleted.

0 commit comments

Comments
 (0)