Skip to content

Commit

Permalink
Update build instructions for -fno-frontend-optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
milancurcic committed May 3, 2022
1 parent 3d2b148 commit 6ccb92a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ if(CMAKE_Fortran_COMPILER_ID MATCHES GNU)
message(STATUS "Configuring build to use BLAS from ${BLAS}")
endif()

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

# compiler flags for ifort
Expand Down
27 changes: 25 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,23 @@ Compilers tested include:
fpm build
```

By default, without specifying the build profile, fpm will build neural-fortran
using the debug compiler flags, and without optimization.
To build optimized code, build with the release profile:

```
fpm build --profile release
```

If you're using GFortran, make sure to also pass an additional flag:

```
fpm build --profile release --flag "-fno-frontend-optimize"
```

The `-fno-frontend-optimize` disables some optimizations that may be harmful
when building neural-fortran.

#### Building in parallel mode

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

```
fpm build --compiler caf
fpm build --compiler caf --profile release --flag "-fno-frontend-optimize"
```

#### Testing with fpm
Expand All @@ -68,7 +85,7 @@ fpm test
```

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

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

The MNIST example uses [curl](https://curl.se/) to download the dataset,
so make sure you have it installed on your system.
Most Linux OSs have it out of the box.
The dataset will be downloaded only the first time you run the example in any
given directory.

## API documentation

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

0 comments on commit 6ccb92a

Please sign in to comment.