Skip to content
Snippets Groups Projects
Commit abcc5a8c authored by Matteo Cicuttin's avatar Matteo Cicuttin
Browse files

Added code to disable denormals.

parent b0149f8f
No related branches found
No related tags found
No related merge requests found
...@@ -32,6 +32,11 @@ if (ENABLE_ITERTIME_OUTPUT) ...@@ -32,6 +32,11 @@ if (ENABLE_ITERTIME_OUTPUT)
add_definitions(-DSAVE_ITERTIME) add_definitions(-DSAVE_ITERTIME)
endif() endif()
option(ENABLE_DAZ_FTZ "Enable Denormals Are Zero and Flush To Zero flags" ON)
if (ENABLE_DAZ_FTZ)
add_definitions(-DDISALLOW_DENORMALS)
endif()
option(ENABLE_KOKKOS "Enable Kokkos" OFF) option(ENABLE_KOKKOS "Enable Kokkos" OFF)
if (ENABLE_KOKKOS) if (ENABLE_KOKKOS)
FetchContent_Declare(kokkos FetchContent_Declare(kokkos
...@@ -67,7 +72,7 @@ endif() ...@@ -67,7 +72,7 @@ endif()
option(ENABLE_VECTORIZER_REMARKS "Enable Clang vectorizer remarks" ON) option(ENABLE_VECTORIZER_REMARKS "Enable Clang vectorizer remarks" ON)
if (ENABLE_VECTORIZER_REMARKS) if (ENABLE_VECTORIZER_REMARKS)
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Rpass=loop-vectorize") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Rpass=loop-vectorize")
endif() endif()
endif() endif()
......
...@@ -8,8 +8,17 @@ ...@@ -8,8 +8,17 @@
#include "fd_wave_cuda.hpp" #include "fd_wave_cuda.hpp"
#endif #endif
int main(void) #include <pmmintrin.h>
#include <xmmintrin.h>
int main(int argc, char **argv)
{ {
#ifdef DISALLOW_DENORMALS
_MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON);
_MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON);
#endif
_MM_SET_EXCEPTION_MASK(_MM_GET_EXCEPTION_MASK() & ~_MM_MASK_INVALID);
#ifdef SINGLE_PRECISION #ifdef SINGLE_PRECISION
using T = float; using T = float;
std::ofstream ofs("timings-float.txt"); std::ofstream ofs("timings-float.txt");
...@@ -34,7 +43,7 @@ int main(void) ...@@ -34,7 +43,7 @@ int main(void)
for (size_t sz = 128; sz <= 1024; sz *= 2) for (size_t sz = 128; sz <= 1024; sz *= 2)
{ {
wave_equation_context<T> wec(sz, sz, 1, 0.1, 0.001, 5000); wave_equation_context<T> wec(sz, sz, 1, 0.1, 0.0001, 5000);
ofs << sz << " "; ofs << sz << " ";
wec.init(); wec.init();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment