CMAKE: Add option to disable FMA operations.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
This commit is contained in:
parent
a343a400e6
commit
540c98bc27
@ -15,25 +15,22 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
|||||||
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
|
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
|
||||||
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
|
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
|
||||||
STRING "Choose the type of build." FORCE)
|
STRING "Choose the type of build." FORCE)
|
||||||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
|
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU")
|
if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU")
|
||||||
add_compile_options("$<$<CONFIG:RELEASE>:-march=native;-pipe;-fno-tree-vectorize;-fno-unsafe-math-optimizations;-frounding-math;-fsignaling-nans;-finline-limit=10000;-fdiagnostics-color=always>")
|
add_compile_options("$<$<CONFIG:RELEASE>:-march=native;-pipe;-fno-tree-vectorize;-fno-unsafe-math-optimizations;-frounding-math;-fsignaling-nans;-finline-limit=10000;-fdiagnostics-color=always>")
|
||||||
add_compile_options("$<$<CONFIG:DEBUG>:-Og;-pedantic;-fcheck=all;-W;-Wall;-Wno-unused-dummy-argument>")
|
add_compile_options("$<$<CONFIG:DEBUG>:-Og;-pedantic;-fcheck=all;-W;-Wall;-Wno-unused-dummy-argument>")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_Fortran_COMPILER_ID MATCHES "Intel")
|
if(CMAKE_Fortran_COMPILER_ID MATCHES "Intel")
|
||||||
add_compile_options("$<$<CONFIG:RELEASE>:-xHost;-fp-model=source;-heap-arrays;-ip;-unroll-aggressive;-simd;-qopt-prefetch;-use-intel-optimized-headers;-finline-limit=1000;-fno-omit-frame-pointer>")
|
add_compile_options("$<$<CONFIG:RELEASE>:-xHost;-fp-model=source;-heap-arrays;-ip;-unroll-aggressive;-simd;-qopt-prefetch;-use-intel-optimized-headers;-finline-limit=1000;-fno-omit-frame-pointer>")
|
||||||
add_compile_options("$<$<CONFIG:DEBUG>:-O>")
|
add_compile_options("$<$<CONFIG:DEBUG>:-O>")
|
||||||
add_compile_options(-assume byterecl)
|
add_compile_options(-assume byterecl)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_Fortran_COMPILER_ID MATCHES "PGI")
|
if(CMAKE_Fortran_COMPILER_ID MATCHES "PGI")
|
||||||
add_compile_options("$<$<CONFIG:RELEASE>:-fastsse;-O4;-Mvect=simd;-Minline=maxsize:1000>")
|
add_compile_options("$<$<CONFIG:RELEASE>:-fastsse;-O4;-Mvect=simd;-Minline=maxsize:1000>")
|
||||||
add_compile_options("$<$<CONFIG:DEBUG>:-O;-Minfo=all>")
|
add_compile_options("$<$<CONFIG:DEBUG>:-O;-Minfo=all>")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_Fortran_COMPILER_ID MATCHES "NVHPC")
|
if(CMAKE_Fortran_COMPILER_ID MATCHES "NVHPC")
|
||||||
add_compile_options("$<$<CONFIG:RELEASE>:-fast;-O4;-Minline>")
|
add_compile_options("$<$<CONFIG:RELEASE>:-fast;-O4;-Minline>")
|
||||||
add_compile_options("$<$<CONFIG:DEBUG>:-Mbounds;-Mchkptr;-Minfo=all>")
|
add_compile_options("$<$<CONFIG:DEBUG>:-Mbounds;-Mchkptr;-Minfo=all>")
|
||||||
@ -42,14 +39,14 @@ endif()
|
|||||||
file(GLOB_RECURSE sources sources/*.F90)
|
file(GLOB_RECURSE sources sources/*.F90)
|
||||||
add_executable(amun.x ${sources})
|
add_executable(amun.x ${sources})
|
||||||
|
|
||||||
option(ENABLE_3D "Enables 3D domains" OFF)
|
option(ENABLE_3D "Enables 3D domains." OFF)
|
||||||
if(ENABLE_3D)
|
if(ENABLE_3D)
|
||||||
target_compile_definitions(amun.x PRIVATE NDIMS=3)
|
target_compile_definitions(amun.x PRIVATE NDIMS=3)
|
||||||
else()
|
else()
|
||||||
target_compile_definitions(amun.x PRIVATE NDIMS=2)
|
target_compile_definitions(amun.x PRIVATE NDIMS=2)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
option(ENABLE_HDF5 "Enable HDF5 support" OFF)
|
option(ENABLE_HDF5 "Enable HDF5 support." OFF)
|
||||||
if(ENABLE_HDF5)
|
if(ENABLE_HDF5)
|
||||||
find_package(HDF5 COMPONENTS Fortran)
|
find_package(HDF5 COMPONENTS Fortran)
|
||||||
if(HDF5_Fortran_FOUND)
|
if(HDF5_Fortran_FOUND)
|
||||||
@ -59,7 +56,7 @@ if(ENABLE_HDF5)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
option(ENABLE_MPI "Enable MPI support" ON)
|
option(ENABLE_MPI "Enable MPI support." ON)
|
||||||
if(ENABLE_MPI)
|
if(ENABLE_MPI)
|
||||||
find_package(MPI COMPONENTS Fortran)
|
find_package(MPI COMPONENTS Fortran)
|
||||||
if(MPI_Fortran_FOUND)
|
if(MPI_Fortran_FOUND)
|
||||||
@ -69,7 +66,7 @@ if(ENABLE_MPI)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
option(ENABLE_OPENMP "Enable OpenMP support" ON)
|
option(ENABLE_OPENMP "Enable OpenMP support." ON)
|
||||||
if(ENABLE_OPENMP)
|
if(ENABLE_OPENMP)
|
||||||
find_package(OpenMP COMPONENTS Fortran)
|
find_package(OpenMP COMPONENTS Fortran)
|
||||||
if(OpenMP_Fortran_FOUND)
|
if(OpenMP_Fortran_FOUND)
|
||||||
@ -79,12 +76,28 @@ if(ENABLE_OPENMP)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
option(ENABLE_SIGNALS "Enables signal handler support" ON)
|
option(DISABLE_FMA "Disable FMA operations for slightly slower, but symmetric floating-point arithmetics." OFF)
|
||||||
|
if(DISABLE_FMA)
|
||||||
|
if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU")
|
||||||
|
target_compile_options(amun.x PRIVATE "-mno-fma;-mno-fma4")
|
||||||
|
endif()
|
||||||
|
if(CMAKE_Fortran_COMPILER_ID MATCHES "Intel")
|
||||||
|
target_compile_options(amun.x PRIVATE "-no-fma")
|
||||||
|
endif()
|
||||||
|
if(CMAKE_Fortran_COMPILER_ID MATCHES "PGI")
|
||||||
|
target_compile_options(amun.x PRIVATE "-Mnofma")
|
||||||
|
endif()
|
||||||
|
if(CMAKE_Fortran_COMPILER_ID MATCHES "NVHPC")
|
||||||
|
target_compile_options(amun.x PRIVATE "-Mnofma")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
option(ENABLE_SIGNALS "Enables signal handler support." ON)
|
||||||
if(ENABLE_SIGNALS)
|
if(ENABLE_SIGNALS)
|
||||||
target_compile_definitions(amun.x PRIVATE SIGNALS)
|
target_compile_definitions(amun.x PRIVATE SIGNALS)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
option(ENABLE_ZSTD "Enable Zstandard compression support" ON)
|
option(ENABLE_ZSTD "Enable Zstandard compression support." ON)
|
||||||
if(ENABLE_ZSTD)
|
if(ENABLE_ZSTD)
|
||||||
include(FindPkgConfig)
|
include(FindPkgConfig)
|
||||||
pkg_search_module(ZSTD QUIET libzstd)
|
pkg_search_module(ZSTD QUIET libzstd)
|
||||||
@ -94,7 +107,7 @@ if(ENABLE_ZSTD)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
option(ENABLE_LZ4 "Enable LZ4 compression support" ON)
|
option(ENABLE_LZ4 "Enable LZ4 compression support." ON)
|
||||||
if(ENABLE_LZ4)
|
if(ENABLE_LZ4)
|
||||||
include(FindPkgConfig)
|
include(FindPkgConfig)
|
||||||
pkg_search_module(LZ4 QUIET liblz4)
|
pkg_search_module(LZ4 QUIET liblz4)
|
||||||
@ -104,7 +117,7 @@ if(ENABLE_LZ4)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
option(ENABLE_LZMA "Enable LZMA compression support" ON)
|
option(ENABLE_LZMA "Enable LZMA compression support." ON)
|
||||||
if(ENABLE_LZMA)
|
if(ENABLE_LZMA)
|
||||||
include(FindPkgConfig)
|
include(FindPkgConfig)
|
||||||
pkg_search_module(LZMA QUIET liblzma)
|
pkg_search_module(LZMA QUIET liblzma)
|
||||||
@ -114,7 +127,7 @@ if(ENABLE_LZMA)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
option(ENABLE_XXHASH "Enable system's XXHASH library" ON)
|
option(ENABLE_XXHASH "Enable system's XXHASH library." ON)
|
||||||
if(ENABLE_XXHASH)
|
if(ENABLE_XXHASH)
|
||||||
include(FindPkgConfig)
|
include(FindPkgConfig)
|
||||||
pkg_search_module(XXHASH QUIET libxxhash)
|
pkg_search_module(XXHASH QUIET libxxhash)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user