Skip to content

Commit 72307b7

Browse files
author
Damian Rouson
authored
Merge pull request #56 from sourceryinstitute/update-readme
Update README.md with usage patterns and benefits
2 parents 16a1d99 + 68904a8 commit 72307b7

File tree

1 file changed

+55
-19
lines changed

1 file changed

+55
-19
lines changed

README.md

Lines changed: 55 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,37 +11,60 @@ Overview
1111
DAG is a Fortran 2018 library for creating and manipulating directed acyclic graphs (DAGs).
1212
DAG is based on a fork of [daglib by Jacob Williams], refactored to
1313

14-
* Adopt a functional programming pattern based on (mostly) pure function constructors
15-
and component getters but no setters. When compilers cooperate, we recommend using
16-
`associate` to assign names to constructor results to avoid unnecessary copies.
14+
* Adopt a functional programming pattern based on (mostly) pure functions.
1715
* Add build system and test harness automated by [fpm],
1816
* Add unit testing written with [Vegetables],
1917
* Add continuous-integration testing and documentation deployment via [GitHub Actions],
2018
* Add [documentation] generated by [FORD],
2119
* Add runtime assertion-checking using [Assert], and
22-
* Add [JSON] file input/output using [jsonff].
23-
24-
Constructor results contain an private index array that describes a topologically sorting
25-
of the vertices in a DAG.
20+
* Add [JSON] file input/output using [jsonff].
21+
* Ensure that dag objects always have a valid state that includes a topological
22+
ordering stored without mutating vertices or vertex arrays.
23+
24+
Usage
25+
-----
26+
When compilers cooperate, we recommend using `associate` to assign names to
27+
dag's user-defined structure constructor results. See the [example]
28+
subdirectory for demonstrations of how we use `associate` instead of the
29+
declare-and-define style that is much more common in Fortran
30+
and other imperative programming languages. Associating a name instead of
31+
declaring an object and then later defining it offers several potential
32+
advantages:
33+
34+
* It prevents the accidental use of declared-but-undefined data.
35+
* It provides immutable state, which in turn
36+
- prevents the mistaken overwriting of data and
37+
- enables some possible compiler optimizations.
38+
39+
_Caveat emptor_: your mileage may vary. Compiler support for `associate` is
40+
evolving and compiler might or might not exploit optimizatio opportunities.
41+
When weird things happen, resort to declaring and subsequently defining
42+
objects by assigning a constructor function result to the declared object.
2643

2744
Prerequisites
2845
-------------
29-
The [fpm] package manager automatically downloads and builds all dependencies.
30-
See [fpm.toml] for a complete list, including version numbers.
46+
The [fpm] package manager automatically downloads and builds all
47+
dependencies. See [fpm.toml] for a complete list, including version numbers.
48+
49+
Downloading
50+
-----------
51+
Obtain dag by downloading the [latest release] or cloning the repository as
52+
follows:
3153

32-
Downloading, building and testing
33-
--------------------
34-
With [fpm] installed, clone
3554
```
3655
git clone [email protected]:sourceryinstitute/dag
3756
```
38-
### Serial build and testing
39-
Build and test the `dag` library with in a `bash`-like shell as follows:
57+
58+
Building and testing
59+
--------------------
60+
### Building and testing for serial execution
61+
Build and test `dag` in a `bash`-like shell as follows:
4062
```
4163
fpm test
4264
```
43-
### Parallel building and testing with the gfortran/OpenCoarrays
44-
Build and test the `dag` library with in a `bash`-like shell as follows:
65+
### Building and testing for parallel execution
66+
With [gfortran] and [OpenCoarrays] installed, build and test `dag` in a
67+
`bash`-like shell as follows:
4568
```
4669
fpm test --compiler caf --runner "cafrun -n 2"
4770
```
@@ -52,7 +75,6 @@ Please report any test failures by submitting an [issue] on the DAG repository.
5275

5376
Examples
5477
--------
55-
5678
The [example] subdirectory provides the following examples:
5779

5880
* [print-to-json.f90] - constructs and prints it a JSON representation the DAG.
@@ -73,16 +95,30 @@ fpm run --example read-from-json > dag.json
7395
fpm run --example dag-to-dot > feats-dag.dot
7496
dot -Tpdf -o feats.pdf feats.dot
7597
```
76-
which should produce the graph below.
98+
which should produce the following graph below:
7799

78100
![feats-dependencies](https://user-images.githubusercontent.com/13108868/133311851-721b7cda-1d10-4ee1-a51d-6169ca624839.png)
79101

80-
81102
License
82103
-------
83104

84105
This library is released under a [BSD-3 license].
85106

107+
Acknowledgments
108+
----------------
109+
110+
| | |
111+
|-|-|
112+
| We gratefully acknowledge support from [NASA Langley Research Center] under contract number 80NSSC20P2246. | <img src="https://user-images.githubusercontent.com/13108868/112893191-304ce180-908f-11eb-8bea-e0cab5322aa8.png" alt="NASA logo" width="100">|
113+
114+
Donate
115+
------
116+
If you find this software useful, please consider donating code or
117+
[currency](http://bit.ly/donate-to-sourcery-institute) to aid in development efforts.
118+
119+
[NASA Langley Research Center]: https://www.nasa.gov/langley
120+
[latest release]: https://github.com/sourceryinstitute/dag/releases/latest
121+
86122
[daglib by Jacob Williams]: https://github.com/jacobwilliams/daglib
87123
[GraphViz]: https://www.graphviz.org
88124
[OpenCoarrays]: https://github.com/sourceryinstitute/opencoarrays

0 commit comments

Comments
 (0)