Skip to content

Commit 6ccb92a

Browse files
committed
Update build instructions for -fno-frontend-optimize
1 parent 3d2b148 commit 6ccb92a

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ if(CMAKE_Fortran_COMPILER_ID MATCHES GNU)
3333
message(STATUS "Configuring build to use BLAS from ${BLAS}")
3434
endif()
3535

36-
set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -g -C -fbacktrace")
37-
set(CMAKE_Fortran_FLAGS_RELEASE "-O3 -ffast-math")
36+
set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -g -fcheck=bounds -fbacktrace")
37+
set(CMAKE_Fortran_FLAGS_RELEASE "-Ofast -fno-frontend-optimize")
3838
endif()
3939

4040
# compiler flags for ifort

README.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,23 @@ Compilers tested include:
5050
fpm build
5151
```
5252

53+
By default, without specifying the build profile, fpm will build neural-fortran
54+
using the debug compiler flags, and without optimization.
55+
To build optimized code, build with the release profile:
56+
57+
```
58+
fpm build --profile release
59+
```
60+
61+
If you're using GFortran, make sure to also pass an additional flag:
62+
63+
```
64+
fpm build --profile release --flag "-fno-frontend-optimize"
65+
```
66+
67+
The `-fno-frontend-optimize` disables some optimizations that may be harmful
68+
when building neural-fortran.
69+
5370
#### Building in parallel mode
5471

5572
If you use GFortran and want to run neural-fortran in parallel,
@@ -58,7 +75,7 @@ Once installed, use the compiler wrappers `caf` and `cafrun` to build and execut
5875
in parallel, respectively:
5976

6077
```
61-
fpm build --compiler caf
78+
fpm build --compiler caf --profile release --flag "-fno-frontend-optimize"
6279
```
6380

6481
#### Testing with fpm
@@ -68,7 +85,7 @@ fpm test
6885
```
6986

7087
For the time being, you need to specify the same compiler flags to `fpm test`
71-
as you did in `fpm build` so that fpm can figure out to use the same build
88+
as you did in `fpm build` so that fpm knows it should use the same build
7289
profile.
7390

7491
See [Fortran Package Manager](https://github.com/fortran-lang/fpm) for more info on fpm.
@@ -149,6 +166,12 @@ examples, in increasing level of complexity:
149166
2. [sine](example/sine.f90): Approximating a sine function
150167
3. [mnist](example/mnist.f90): Hand-written digit recognition using the MNIST dataset
151168

169+
The MNIST example uses [curl](https://curl.se/) to download the dataset,
170+
so make sure you have it installed on your system.
171+
Most Linux OSs have it out of the box.
172+
The dataset will be downloaded only the first time you run the example in any
173+
given directory.
174+
152175
## API documentation
153176

154177
API documentation can be generated with [FORD](https://github.com/Fortran-FOSS-Programmers/ford/).

0 commit comments

Comments
 (0)