From 9d81c5eba766ec143bbccf33542897d5397b8b98 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 13 Sep 2022 23:29:15 +0200 Subject: [PATCH 1/2] flush to zero could be problematic https://www.heise.de/news/Python-Compiler-Optionen-koennen-bei-Gleitkommaberechnungen-zu-Fehlern-fuehren-7257654.html --- cmake/Compiler-Intel.cmake | 4 ++-- cmake/Compiler-IntelLLVM.cmake | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmake/Compiler-Intel.cmake b/cmake/Compiler-Intel.cmake index 4125aa8ef..b8aa2609e 100644 --- a/cmake/Compiler-Intel.cmake +++ b/cmake/Compiler-Intel.cmake @@ -29,8 +29,8 @@ set (LINKER_FLAGS "${LINKER_FLAGS} -shared-intel") set (COMPILE_FLAGS "${COMPILE_FLAGS} -fpp") # preprocessor -set (COMPILE_FLAGS "${COMPILE_FLAGS} -ftz") -# flush underflow to zero, automatically set if -O[1,2,3] +set (COMPILE_FLAGS "${COMPILE_FLAGS} -no-ftz") +# disable flush underflow to zero, will be set if -O[1,2,3] set (COMPILE_FLAGS "${COMPILE_FLAGS} -diag-disable") # disables warnings ... diff --git a/cmake/Compiler-IntelLLVM.cmake b/cmake/Compiler-IntelLLVM.cmake index bd0f07ee8..57a14a322 100644 --- a/cmake/Compiler-IntelLLVM.cmake +++ b/cmake/Compiler-IntelLLVM.cmake @@ -29,8 +29,8 @@ set (LINKER_FLAGS "${LINKER_FLAGS} -shared-intel") set (COMPILE_FLAGS "${COMPILE_FLAGS} -fpp") # preprocessor -set (COMPILE_FLAGS "${COMPILE_FLAGS} -ftz") -# flush underflow to zero, automatically set if -O[1,2,3] +set (COMPILE_FLAGS "${COMPILE_FLAGS} -no-ftz") +# disable flush underflow to zero, will be set if -O[1,2,3] set (COMPILE_FLAGS "${COMPILE_FLAGS} -diag-disable") # disables warnings ... From 15cdeffcf1a892d233579351ae6c5ccf1b1172a3 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 14 Sep 2022 00:27:49 +0200 Subject: [PATCH 2/2] avoid trapping of underflows --- cmake/Compiler-Intel.cmake | 4 ++-- cmake/Compiler-IntelLLVM.cmake | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmake/Compiler-Intel.cmake b/cmake/Compiler-Intel.cmake index b8aa2609e..69aee45ae 100644 --- a/cmake/Compiler-Intel.cmake +++ b/cmake/Compiler-Intel.cmake @@ -95,8 +95,8 @@ set (DEBUG_FLAGS "${DEBUG_FLAGS},uninit") # ... for uninitialized variables. set (DEBUG_FLAGS "${DEBUG_FLAGS} -ftrapuv") # ... initializes stack local variables to an unusual value to aid error detection -set (DEBUG_FLAGS "${DEBUG_FLAGS} -fpe-all=0") -# ... capture all floating-point exceptions, sets -ftz automatically +set (DEBUG_FLAGS "${DEBUG_FLAGS} -fpe-all=0 -ftz") +# ... capture all floating-point exceptions, need to overwrite -no-ftz # disable due to compiler bug https://community.intel.com/t5/Intel-Fortran-Compiler/false-positive-stand-f18-and-IEEE-SELECTED-REAL-KIND/m-p/1227336 #set (DEBUG_FLAGS "${DEBUG_FLAGS} -warn") diff --git a/cmake/Compiler-IntelLLVM.cmake b/cmake/Compiler-IntelLLVM.cmake index 57a14a322..5056c2b37 100644 --- a/cmake/Compiler-IntelLLVM.cmake +++ b/cmake/Compiler-IntelLLVM.cmake @@ -95,8 +95,8 @@ set (DEBUG_FLAGS "${DEBUG_FLAGS},uninit") # ... for uninitialized variables. set (DEBUG_FLAGS "${DEBUG_FLAGS} -ftrapuv") # ... initializes stack local variables to an unusual value to aid error detection -set (DEBUG_FLAGS "${DEBUG_FLAGS} -fpe-all=0") -# ... capture all floating-point exceptions, sets -ftz automatically +set (DEBUG_FLAGS "${DEBUG_FLAGS} -fpe-all=0 -ftz") +# ... capture all floating-point exceptions, need to overwrite -no-ftz # disable due to compiler bug https://community.intel.com/t5/Intel-Fortran-Compiler/false-positive-stand-f18-and-IEEE-SELECTED-REAL-KIND/m-p/1227336 #set (DEBUG_FLAGS "${DEBUG_FLAGS} -warn")