diff --git a/components/omega/OmegaBuild.cmake b/components/omega/OmegaBuild.cmake index bcbec9e954d4..2d4eb54fe10d 100644 --- a/components/omega/OmegaBuild.cmake +++ b/components/omega/OmegaBuild.cmake @@ -28,6 +28,7 @@ macro(common) option(OMEGA_LOG_FLUSH "Turn on unbuffered logging (default OFF)." OFF) option(OMEGA_TEST_CDASH "Turn on CDash support (default ON)." ON) option(OMEGA_EXTERNAL_PROF "Integration of Omega timers with external profiling tools (default OFF)." OFF) + option(OMEGA_DISABLE_FP_CONTRACT "Disable floating point contraction on GPU architectures (default ON)." ON) if("${OMEGA_BUILD_TYPE}" STREQUAL "Debug" OR "${OMEGA_BUILD_TYPE}" STREQUAL "DEBUG") set(OMEGA_DEBUG ON) diff --git a/components/omega/src/CMakeLists.txt b/components/omega/src/CMakeLists.txt index a2f1ae537f58..288318ae2066 100644 --- a/components/omega/src/CMakeLists.txt +++ b/components/omega/src/CMakeLists.txt @@ -27,6 +27,25 @@ target_compile_definitions( OMEGA_VECTOR_LENGTH=${OMEGA_VECTOR_LENGTH} ) +# Disable floating point contraction (e.g. fused multiply-add) for GPU +# architectures. Needed for ERS and PEM test to pass COMPARE step. +# Controlled by OMEGA_DISABLE_FP_CONTRACT (default ON) +if (OMEGA_DISABLE_FP_CONTRACT) + if (OMEGA_ARCH STREQUAL "CUDA") + target_compile_options(OmegaLibFlags INTERFACE + $<$:--fmad=false -Xcompiler -ffp-contract=off> + ) + elseif (OMEGA_ARCH STREQUAL "HIP") + target_compile_options(OmegaLibFlags INTERFACE + $<$:-ffp-contract=off> + ) + elseif (OMEGA_ARCH STREQUAL "SYCL") + target_compile_options(OmegaLibFlags INTERFACE + $<$:-fp-model=precise -ffp-contract=off> + ) + endif() +endif() + if(OMEGA_SINGLE_PRECISION) target_compile_definitions( OmegaLibFlags