From d6733b261250bc3cda59b8bf0532b26dcb9a41ca Mon Sep 17 00:00:00 2001 From: Berenger Bramas Date: Thu, 28 Jul 2016 14:27:40 +0200 Subject: [PATCH] CMake update -- make it works with intel (16) --- CMakeLists.txt | 8 +++++++- CMakeModules/GetCompilerInfos.cmake | 2 +- README.md | 9 ++++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a1a5419..1c645bb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -137,7 +137,7 @@ if(NOT INASTEMP_AS_SUBPROJECT) SET( INASTEMP_EXTRA_CXX_FLAGS_DEBUG "-O0" CACHE STRING "These flags are added to the usual ones for DEBUG" ) set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${INASTEMP_EXTRA_CXX_FLAGS_DEBUG}") - set(INASTEMP_CXX_FLAGS "${INASTEMP_CXX_FLAGS} -fpic -Wextra -Wnon-virtual-dtor -Wshadow -Wpointer-arith -Wcast-qual -Wconversion -Wall -Wno-sign-conversion -pedantic -Wold-style-cast -Woverloaded-virtual -Wpointer-arith -Wcast-qual -Wconversion -Wno-error") + set(INASTEMP_CXX_FLAGS "${INASTEMP_CXX_FLAGS} -fpic -Wextra -Wnon-virtual-dtor -Wshadow -Wpointer-arith -Wcast-qual -Wconversion -Wall -Wno-sign-conversion -pedantic -Woverloaded-virtual -Wpointer-arith -Wcast-qual -Wconversion -Wno-error") if(CMAKE_SIZEOF_VOID_P EQUAL 8) set(INASTEMP_CXX_FLAGS "${INASTEMP_CXX_FLAGS} -m64") @@ -149,6 +149,12 @@ if(NOT INASTEMP_AS_SUBPROJECT) endif(INASTEMP_ATTACHE_SOURCE) endif() +if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "icpc.*$") + set(INASTEMP_CXX_FLAGS "${INASTEMP_CXX_FLAGS} -diag-disable 2304 -diag-disable 10121 -diag-disable 10120") +else() + set(INASTEMP_CXX_FLAGS "${INASTEMP_CXX_FLAGS} -Wold-style-cast") +endif() + #=========================================================================== # Generate config #=========================================================================== diff --git a/CMakeModules/GetCompilerInfos.cmake b/CMakeModules/GetCompilerInfos.cmake index 443e7f3..56ba89f 100644 --- a/CMakeModules/GetCompilerInfos.cmake +++ b/CMakeModules/GetCompilerInfos.cmake @@ -85,7 +85,7 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") set(SSSE3_FLAGS "-mssse3 ${ARCH_NATIVE_FLAG}") set(SSE41_FLAGS "-msse4 -msse4.1 ${ARCH_NATIVE_FLAG}") set(SSE42_FLAGS "-msse4 -msse4.2 ${ARCH_NATIVE_FLAG}") - set(AVX_FLAGS "-mAVX ${ARCH_NATIVE_FLAG}") + set(AVX_FLAGS "-march=core-avx-i ${ARCH_NATIVE_FLAG}") set(AVX2_FLAGS "-march=core-avx2 ${ARCH_NATIVE_FLAG}") set(AVX512KNL_FLAGS "-xCOMMON-AVX512 -xMIC-AVX512 ${ARCH_NATIVE_FLAG}") endif() diff --git a/README.md b/README.md index 73364e8..4531db1 100644 --- a/README.md +++ b/README.md @@ -138,11 +138,18 @@ Such that, if one wants to compile only some files with these specific flags, it ### Compilers support Inastemp was developed and tested using the following compilers on the x86_64 architecture. -- Gcc 6.1 (earlier versions if AVX512/KNL is not used) +- Gcc 6.1 (earlier versions if AVX512/KNL is not used, like 4.9) - Clang 3.5 - Intel 16.0 Earlier versions may work as well. +- Intel special flags +We pass `-diag-disable 2304 -diag-disable 10121 -diag-disable 10120` to intel compiler to remove the implicit conversion warnings between Inastemp classes. +In fact, we voluntarily want implicit conversion because it helps us to factorize and reduce the number of lines drastically. + +User can add the following flags to push for more inlining `-inline-forceinline -no-inline-max-total-size` for intel compiler. +However, it looks like such options do not work for several compiler versions, and thus we do not want to add them by default. + ### Multiple hardwares compilation Inastemp is not designed to compile a binary targeting multiple hardwares (like having an execution path for the different possibilities). -- GitLab