Skip to content

Commit 549ee97

Browse files
Set Fortran standards and add tests (#145)
* Add tests for different Fortran standards * Set Fortran 2008 to default standard * Update README with Fortran standard * Add dependencies to documentation --------- Co-authored-by: ElliottKasoar <[email protected]>
1 parent df03b49 commit 549ee97

File tree

4 files changed

+20
-2
lines changed

4 files changed

+20
-2
lines changed

.github/workflows/test_suite.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ jobs:
1818
test-suite:
1919
# The type of runner that the job will run on
2020
runs-on: ubuntu-latest
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
std: ["f2008", "f2018"]
2125

2226
# Steps represent a sequence of tasks that will be executed as part of the job
2327
steps:
@@ -45,7 +49,7 @@ jobs:
4549
export BUILD_DIR=$(pwd)/src/build
4650
mkdir ${BUILD_DIR}
4751
cd ${BUILD_DIR}
48-
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${BUILD_DIR} -DCMAKE_BUILD_TESTS=TRUE
52+
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${BUILD_DIR} -DCMAKE_BUILD_TESTS=TRUE -DCMAKE_Fortran_FLAGS="-std=${{ matrix.std }}"
4953
cmake --build .
5054
cmake --install .
5155

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
**_A library for coupling (Py)Torch machine learning models to Fortran_**
44

55
![GitHub](https://img.shields.io/github/license/Cambridge-ICCS/FTorch)
6+
![Fortran](https://img.shields.io/badge/Fortran-2008-purple)
67

78
This repository contains code, utilities, and examples for directly calling PyTorch ML
89
models from Fortran.
@@ -83,7 +84,7 @@ To install the library requires the following to be installed on the system:
8384

8485
* CMake >= 3.1
8586
* [libtorch](https://pytorch.org/cppdocs/installing.html)<sup>*</sup> or [PyTorch](https://pytorch.org/)
86-
* Fortran, C++ (must fully support C++17), and C compilers
87+
* Fortran (2008 standard compliant), C++ (must fully support C++17), and C compilers
8788

8889
<sup>*</sup> _The minimal example provided downloads the CPU-only Linux Nightly binary. [Alternative versions](https://pytorch.org/get-started/locally/) may be required._
8990

pages/cmake.md

+9
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ Installation of FTorch is done by CMake.
66

77
This is controlled by the `CMakeLists.txt` file in `src/`.
88

9+
## Dependencies
10+
11+
To install the library requires the following to be installed on the system:
12+
13+
- CMake >= 3.1
14+
- libtorch or PyTorch
15+
- Fortran (2008 standard compliant), C++ (must fully support C++17), and C compilers
16+
17+
918
## Basic instructions
1019

1120
To build the library, first clone it from GitHub to your local machine and then run:

src/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ set(CMAKE_CXX_STANDARD 17)
1212
set(CMAKE_CXX_STANDARD_REQUIRED ON)
1313
set(CMAKE_CXX_EXTENSIONS OFF)
1414

15+
if(NOT CMAKE_Fortran_FLAGS)
16+
set(CMAKE_Fortran_FLAGS "-std=f2008")
17+
endif()
18+
1519
include(CheckLanguage)
1620
if(ENABLE_CUDA)
1721
check_language(CUDA)

0 commit comments

Comments
 (0)