@@ -8,19 +8,15 @@ Read the paper [here](https://arxiv.org/abs/1902.06714).
8
8
9
9
* [ Features] ( https://github.com/modern-fortran/neural-fortran#features )
10
10
* [ 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 )
17
13
* [ Examples] ( https://github.com/modern-fortran/neural-fortran#examples )
18
14
- [ Creating a network] ( https://github.com/modern-fortran/neural-fortran#creating-a-network )
19
15
- [ Training the network] ( https://github.com/modern-fortran/neural-fortran#training-the-network )
20
16
- [ Saving and loading from file] ( https://github.com/modern-fortran/neural-fortran#saving-and-loading-from-file )
21
17
- [ MNIST training example] ( https://github.com/modern-fortran/neural-fortran#mnist-training-example )
22
- * [ Contributing] ( https://github.com/modern-fortran/neural-fortran#contributing )
23
- * [ Related projects] ( https://github.com/modern-fortran/neural-fortran#related-projects )
18
+ * [ Contributing] ( https://github.com/modern-fortran/neural-fortran#contributing )
19
+ * [ Related projects] ( https://github.com/modern-fortran/neural-fortran#related-projects )
24
20
25
21
## Features
26
22
@@ -36,18 +32,41 @@ Get the code:
36
32
37
33
```
38
34
git clone https://github.com/modern-fortran/neural-fortran
35
+ cd neural-fortran
39
36
```
40
37
41
38
Dependencies:
42
39
43
40
* Fortran 2018-compatible compiler
44
- * OpenCoarrays (optional, for parallel execution, gfortran only)
41
+ * OpenCoarrays (optional, for parallel execution, GFortran only)
45
42
* BLAS, MKL (optional)
46
43
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
48
68
49
69
```
50
- cd neural-fortran
51
70
mkdir build
52
71
cd build
53
72
cmake .. -DSERIAL=1
56
75
57
76
Tests and examples will be built in the ` bin/ ` directory.
58
77
59
- ### Building in parallel mode
78
+ #### Building in parallel mode
60
79
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,
62
81
you must first install [ OpenCoarrays] ( https://github.com/sourceryinstitute/OpenCoarrays ) .
63
82
Once installed, use the compiler wrappers ` caf ` and ` cafrun ` to build and execute
64
83
in parallel, respectively:
65
84
85
+
66
86
```
67
87
FC=caf cmake ..
68
88
make
69
89
cafrun -n 4 bin/example_mnist # run MNIST example on 4 cores
70
90
```
71
91
72
- ### Building with a different compiler
92
+ #### Building with a different compiler
73
93
74
94
If you want to build with a different compiler, such as Intel Fortran,
75
95
specify ` FC ` when issuing ` cmake ` :
@@ -78,7 +98,7 @@ specify `FC` when issuing `cmake`:
78
98
FC=ifort cmake ..
79
99
```
80
100
81
- ### Building with BLAS or MKL
101
+ #### Building with BLAS or MKL
82
102
83
103
To use an external BLAS or MKL library for ` matmul ` calls,
84
104
run cmake like this:
@@ -91,7 +111,7 @@ where the value of `-DBLAS` should point to the desired BLAS implementation,
91
111
which has to be available in the linking path.
92
112
This option is currently available only with gfortran.
93
113
94
- ### Building in double or quad precision
114
+ #### Building in double or quad precision
95
115
96
116
By default, neural-fortran is built in single precision mode
97
117
(32-bit floating point numbers). Alternatively, you can configure to build
107
127
cmake .. -DREAL=128
108
128
```
109
129
110
- ### Building in debug mode
130
+ #### Building in debug mode
111
131
112
132
To build with debugging flags enabled, type:
113
133
0 commit comments