diff --git a/CMakeLists.txt b/CMakeLists.txt index a1a54197e263a54596c97079b7c3eac915735cee..1c645bbdcf9122d0e5b66a3f659ae489c03f9b53 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 443e7f38de75ebf3abc14344c3be5b16ab4e3def..56ba89fe26fe86e183d43113f1dfdd9b2bc83285 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 73364e84616dc8c858c2688facb5e854a0ffb90e..4531db121b1effef363f4d55eba8ae15ae0822f0 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).