Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Fixed up the floating point flags for gfortran
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed May 24, 2023
1 parent 5245e2b commit e10f09e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
12 changes: 12 additions & 0 deletions cmake/Modules/SetFortranFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}"
SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}"
Fortran "-fno-underscoring" # GNU
)
# Compile code assuming that IEEE signaling NaNs may generate user-visible traps during floating-point operations.
# Setting this option disables optimizations that may change the number of exceptions visible with signaling NaNs.
SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}"
Fortran "-fsignaling-nans " # GNU
)


# Determines whether the current Fortran Standard behavior of the compiler is fully implemented.
SET_COMPILE_FLAG(CMAKE_Fortran_Flags "${CMAKE_Fortran_FLAGS}"
Expand Down Expand Up @@ -208,6 +214,7 @@ SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG}"
SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG}"
Fortran "-init=snan,arrays" # Intel
"/Qinit:snan,arrays" # Intel Windows
"-finit-real=snan" # GNU
)

# Does not generate an interface block for each routine in a source file
Expand Down Expand Up @@ -342,6 +349,11 @@ SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE}"
SET_COMPILE_FLAG(STRICTMATH_FLAGS "${STRICTMATH_FLAGS}"
Fortran "-fp-model=precise" # Intel
"/fp:precise" # Intel Windows
"-fno-unsafe-math-optimizations" # GNU
)
# Disable transformations and optimizations that assume default floating-point rounding behavior.
SET_COMPILE_FLAG(STRICTMATH_FLAGS "${STRICTMATH_FLAGS}"
Fortran "-frounding-math"
)

SET_COMPILE_FLAG(STRICTMATH_FLAGS "${STRICTMATH_FLAGS}"
Expand Down
6 changes: 3 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
# Add the source files
SET(STRICT_MATH_FILES
${SRC}/collision/collision_generate.f90
${SRC}/collision/collision_io.f90
${SRC}/collision/collision_util.f90
${SRC}/fraggle/fraggle_generate.f90
${SRC}/fraggle/fraggle_util.f90
${SRC}/fraggle/fraggle_module.f90
Expand All @@ -31,6 +33,7 @@ SET(STRICT_MATH_FILES
${SRC}/rmvs/rmvs_step.f90
${SRC}/swiftest/swiftest_drift.f90
${SRC}/swiftest/swiftest_gr.f90
${SRC}/swiftest/swiftest_io.f90
${SRC}/swiftest/swiftest_kick.f90
${SRC}/swiftest/swiftest_user.f90
${SRC}/swiftest/swiftest_obl.f90
Expand Down Expand Up @@ -60,10 +63,8 @@ SET(FAST_MATH_FILES
${SRC}/helio/helio_module.f90
${SRC}/symba/symba_module.f90
${SRC}/collision/collision_check.f90
${SRC}/collision/collision_io.f90
${SRC}/collision/collision_regime.f90
${SRC}/collision/collision_resolve.f90
${SRC}/collision/collision_util.f90
${SRC}/encounter/encounter_check.f90
${SRC}/encounter/encounter_io.f90
${SRC}/encounter/encounter_util.f90
Expand All @@ -73,7 +74,6 @@ SET(FAST_MATH_FILES
${SRC}/rmvs/rmvs_encounter_check.f90
${SRC}/rmvs/rmvs_util.f90
${SRC}/swiftest/swiftest_discard.f90
${SRC}/swiftest/swiftest_io.f90
${SRC}/swiftest/swiftest_util.f90
${SRC}/symba/symba_discard.f90
${SRC}/symba/symba_encounter_check.f90
Expand Down
2 changes: 1 addition & 1 deletion src/swiftest/swiftest_io.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1067,7 +1067,7 @@ module subroutine swiftest_io_netcdf_get_valid_masks(self, plmask, tpmask)
if (status == NF90_NOERR) then
allocate(body_status(idmax))
call netcdf_io_check( nf90_get_var(self%id, self%status_varid, body_status, start=[1, tslot], count=[idmax,1]), "swiftest_io_netcdf_get_valid_masks nf90_getvar status_varid" )
lvalid(:) = body_status /= INACTIVE
lvalid(:) = body_status(:) /= INACTIVE
else
status = nf90_inq_varid(self%id, self%rh_varname, self%rh_varid)
if (status == NF90_NOERR) then
Expand Down

0 comments on commit e10f09e

Please sign in to comment.