Skip to content

Commit 03b5f72

Browse files
committed
added strict floating point and regnerated examples w/ it
1 parent b2de66e commit 03b5f72

File tree

73 files changed

+2448
-2415
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+2448
-2415
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/bash
22

33
. ./mfc.sh load -c f -m g
4-
./mfc.sh build -j 8 --gpu
4+
./mfc.sh build --strict -j 8 --gpu

.github/workflows/phoenix/test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ if [ "$job_device" == "gpu" ]; then
55
build_opts="--gpu"
66
fi
77

8-
./mfc.sh build -j 8 $build_opts
8+
./mfc.sh build --strict -j 8 $build_opts
99

1010
n_test_threads=8
1111

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ jobs:
8383
- name: Build
8484
run: |
8585
if [ '${{ matrix.intel }}' == 'true' ]; then . /opt/intel/oneapi/setvars.sh; fi
86-
/bin/bash mfc.sh build -j $(nproc) --${{ matrix.debug }} --${{ matrix.mpi }}
86+
/bin/bash mfc.sh build --strict -j $(nproc) --${{ matrix.debug }} --${{ matrix.mpi }}
8787
8888
- name: Test
8989
run: |

CMakeLists.txt

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ option(MFC_MPI "Build with MPI" ON
2020
option(MFC_OpenACC "Build with OpenACC" OFF)
2121
option(MFC_GCov "Build with GCov" OFF)
2222
option(MFC_Unified "Build with unified CPU & GPU memory (GH-200 only)" OFF)
23+
option(MFC_Strict "Build with strict floating point operations" OFF)
2324
option(MFC_PRE_PROCESS "Build pre_process" OFF)
2425
option(MFC_SIMULATION "Build simulation" OFF)
2526
option(MFC_POST_PROCESS "Build post_process" OFF)
@@ -136,6 +137,14 @@ if (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
136137
)
137138
endif()
138139

140+
if (MFC_Strict)
141+
add_compile_options(
142+
-ffloat-store
143+
-frounding-math
144+
-fsignaling-nans
145+
)
146+
endif()
147+
139148
if (CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER 10)
140149
add_compile_options(
141150
$<$<COMPILE_LANGUAGE:Fortran>:-fallow-invalid-boz>
@@ -163,6 +172,16 @@ elseif (CMAKE_Fortran_COMPILER_ID STREQUAL "Cray")
163172
)
164173
add_link_options("SHELL: -K trap=fp" "SHELL: -G2")
165174
endif()
175+
176+
if (MFC_Strict)
177+
add_compile_options(
178+
"SHELL:-h flex_mp=intolerant"
179+
"SHELL:-hp0" "SHELL:-hfp0"
180+
"SHELL:-h vector0"
181+
"SHELL:-fp0"
182+
)
183+
endif()
184+
166185
elseif (CMAKE_Fortran_COMPILER_ID STREQUAL "Flang")
167186
add_compile_options(
168187
$<$<COMPILE_LANGUAGE:Fortran>:-Mfreeform>
@@ -175,6 +194,10 @@ elseif (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
175194
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
176195
add_compile_options(-g -Og -traceback -debug)
177196
endif()
197+
198+
if (MFC_Strict)
199+
add_compile_options(-fp-model strict)
200+
endif()
178201
elseif ((CMAKE_Fortran_COMPILER_ID STREQUAL "NVHPC") OR (CMAKE_Fortran_COMPILER_ID STREQUAL "PGI"))
179202
add_compile_options(
180203
$<$<COMPILE_LANGUAGE:Fortran>:-Mfreeform>
@@ -186,13 +209,15 @@ elseif ((CMAKE_Fortran_COMPILER_ID STREQUAL "NVHPC") OR (CMAKE_Fortran_COMPILER_
186209
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
187210
add_compile_options(
188211
$<$<COMPILE_LANGUAGE:Fortran>:-O0>
212+
-C
213+
-g
214+
-O0
215+
-traceback
216+
-Minform=inform
217+
-Mbounds
189218
)
190219
endif()
191220

192-
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
193-
add_compile_options(-C -g -O0 -traceback -Minform=inform -Mbounds)
194-
endif()
195-
196221
if (DEFINED ENV{MFC_CUDA_CC})
197222
string(REGEX MATCHALL "[0-9]+" MFC_CUDA_CC $ENV{MFC_CUDA_CC})
198223
message(STATUS "Found $MFC_CUDA_CC specified. GPU code will be generated for ${MFC_CUDA_CC}.")
@@ -219,6 +244,11 @@ if (CMAKE_BUILD_TYPE STREQUAL "Release")
219244
message(STATUS "Performing IPO using -Mextract followed by -Minline")
220245
set(NVHPC_USE_TWO_PASS_IPO TRUE)
221246
endif()
247+
248+
if (MFC_Strict)
249+
add_compile_options(-Kieee)
250+
endif()
251+
222252
else()
223253
CHECK_IPO_SUPPORTED(RESULT SUPPORTS_IPO OUTPUT IPO_ERROR)
224254
if (SUPPORTS_IPO)

docs/documentation/getting-started.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ MFC can be built with support for various (compile-time) features:
122122
| **Debug** | `--debug` | `--no-debug` | Off | Requests the compiler build MFC in debug mode. |
123123
| **GCov** | `--gcov` | `--no-gcov` | Off | Builds MFC with coverage flags on. |
124124
| **Unified Memory** | `--unified` | `--no-unified` | Off | Builds MFC with unified CPU/GPU memory (GH-200 superchip only) |
125+
| **Strict** | `--strict` | `--no-strict` | off | Builds MFC with strict floating point operations |
125126

126127
_⚠️ The `--gpu` option requires that your compiler supports OpenACC for Fortran for your target GPU architecture._
127128

tests/0083C150/golden-metadata.txt

Lines changed: 37 additions & 37 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)