diff --git a/CMakeLists.txt b/CMakeLists.txt index 37f1cfe80e468fa7d8c50a7f57ab7de7b01a2f51..44e40b639c2328b5512ad4c557a877d4d9cbec8f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,6 +62,12 @@ if(SYSTEM_CRAY) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -dynamic") endif() +# Cray systems +set(TARGET_KNL OFF CACHE BOOL "target Intel KNL architecture") +if(TARGET_KNL) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXXOPT_KNL}") +endif() + # targets for extermal dependencies include(ExternalProject) externalproject_add(modparser diff --git a/cmake/CompilerOptions.cmake b/cmake/CompilerOptions.cmake index 167ae04818f6c2eb791704de08d7bd99adb449fb..6dc09b961cc6a71ce69b1bf9cba5d6821e6949e8 100644 --- a/cmake/CompilerOptions.cmake +++ b/cmake/CompilerOptions.cmake @@ -13,10 +13,21 @@ if(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang") set(CXXOPT_WALL "${CXXOPT_WALL} -Wno-missing-braces") endif() +if(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU") + + # compiler flags for generating KNL-specific AVX512 instructions + # supported in gcc 4.9.x and later + #set(CXXOPT_KNL "-mavx512f") + set(CXXOPT_KNL "-march=knl") +endif() + if(${CMAKE_CXX_COMPILER_ID} MATCHES "Intel") # Disable warning for unused template parameter # this is raised by a templated function in the json library set(CXXOPT_WALL "${CXXOPT_WALL} -wd488") + + # compiler flags for generating KNL-specific AVX512 instructions + set(CXXOPT_KNL "-xMIC-AVX512") endif()