Skip to content

Commit ed05ba4

Browse files
committed
Update README with fpm instructions
1 parent 0387913 commit ed05ba4

File tree

1 file changed

+35
-15
lines changed

1 file changed

+35
-15
lines changed

README.md

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,8 @@ Read the paper [here](https://arxiv.org/abs/1902.06714).
88

99
* [Features](https://github.com/modern-fortran/neural-fortran#features)
1010
* [Getting started](https://github.com/modern-fortran/neural-fortran#getting-started)
11-
- [Building in serial mode](https://github.com/modern-fortran/neural-fortran#building-in-serial-mode)
12-
- [Building in parallel mode](https://github.com/modern-fortran/neural-fortran#building-in-parallel-mode)
13-
- [Building with a different compiler](https://github.com/modern-fortran/neural-fortran#building-with-a-different-compiler)
14-
- [Building with BLAS or MKL](https://github.com/modern-fortran/neural-fortran#building-with-blas-or-mkl)
15-
- [Building in double or quad precision](https://github.com/modern-fortran/neural-fortran#building-in-double-or-quad-precision)
16-
- [Building in debug mode](https://github.com/modern-fortran/neural-fortran#building-in-debug-mode)
11+
- [Building with fpm](https://github.com/modern-fortran/neural-fortran#building-with-fpm)
12+
- [Building with CMake](https://github.com/modern-fortran/neural-fortran#building-with-cmake)
1713
* [Examples](https://github.com/modern-fortran/neural-fortran#examples)
1814
- [Creating a network](https://github.com/modern-fortran/neural-fortran#creating-a-network)
1915
- [Training the network](https://github.com/modern-fortran/neural-fortran#training-the-network)
@@ -36,18 +32,41 @@ Get the code:
3632

3733
```
3834
git clone https://github.com/modern-fortran/neural-fortran
35+
cd neural-fortran
3936
```
4037

4138
Dependencies:
4239

4340
* Fortran 2018-compatible compiler
44-
* OpenCoarrays (optional, for parallel execution, gfortran only)
41+
* OpenCoarrays (optional, for parallel execution, GFortran only)
4542
* BLAS, MKL (optional)
4643

47-
### Building in serial mode
44+
### Building with fpm
45+
46+
#### Building in serial mode
47+
48+
```
49+
fpm build --flag "-cpp -O3 -ffast-math fcoarrays=single"
50+
```
51+
52+
#### Building in parallel mode
53+
54+
If you use GFortran and want to run neural-fortran in parallel,
55+
you must first install [OpenCoarrays](https://github.com/sourceryinstitute/OpenCoarrays).
56+
Once installed, use the compiler wrappers `caf` and `cafrun` to build and execute
57+
in parallel, respectively:
58+
59+
```
60+
fpm build --compiler caf --flag "-cpp -DCAF -O3 -ffast-math"
61+
```
62+
63+
See [Fortran Package Manager](https://github.com/fortran-lang/fpm) for more info on fpm.
64+
65+
### Building with CMake
66+
67+
#### Building in serial mode
4868

4969
```
50-
cd neural-fortran
5170
mkdir build
5271
cd build
5372
cmake .. -DSERIAL=1
@@ -56,20 +75,21 @@ make
5675

5776
Tests and examples will be built in the `bin/` directory.
5877

59-
### Building in parallel mode
78+
#### Building in parallel mode
6079

61-
If you use gfortran and want to build neural-fortran in parallel mode,
80+
If you use GFortran and want to run neural-fortran in parallel,
6281
you must first install [OpenCoarrays](https://github.com/sourceryinstitute/OpenCoarrays).
6382
Once installed, use the compiler wrappers `caf` and `cafrun` to build and execute
6483
in parallel, respectively:
6584

85+
6686
```
6787
FC=caf cmake ..
6888
make
6989
cafrun -n 4 bin/example_mnist # run MNIST example on 4 cores
7090
```
7191

72-
### Building with a different compiler
92+
#### Building with a different compiler
7393

7494
If you want to build with a different compiler, such as Intel Fortran,
7595
specify `FC` when issuing `cmake`:
@@ -78,7 +98,7 @@ specify `FC` when issuing `cmake`:
7898
FC=ifort cmake ..
7999
```
80100

81-
### Building with BLAS or MKL
101+
#### Building with BLAS or MKL
82102

83103
To use an external BLAS or MKL library for `matmul` calls,
84104
run cmake like this:
@@ -91,7 +111,7 @@ where the value of `-DBLAS` should point to the desired BLAS implementation,
91111
which has to be available in the linking path.
92112
This option is currently available only with gfortran.
93113

94-
### Building in double or quad precision
114+
#### Building in double or quad precision
95115

96116
By default, neural-fortran is built in single precision mode
97117
(32-bit floating point numbers). Alternatively, you can configure to build
@@ -107,7 +127,7 @@ or
107127
cmake .. -DREAL=128
108128
```
109129

110-
### Building in debug mode
130+
#### Building in debug mode
111131

112132
To build with debugging flags enabled, type:
113133

0 commit comments

Comments
 (0)