Commit f41b1dda authored by COULAUD Olivier's avatar COULAUD Olivier

End cheacj SSE and AVX + Intel options on MAcOS X

parent 1e90d5b7
......@@ -59,6 +59,7 @@ OPTION( ScalFMM_USE_ASSERT "Set to ON to enable safe tests during exec
OPTION( ScalFMM_USE_MIC_NATIVE "Set to ON to compile in native mode for MIC" OFF )
# Set scalfmm to default libraries
SET(SCALFMM_LIBRARIES "")
SET(ScaLFMM_CXX_FLAGS "")
#
# Compile option
#
......@@ -68,9 +69,12 @@ SET(ScaLFMM_CXX_FLAGS "-std=c++11 -Wall -Wshadow -Wpointer-arith -Wcast-qual -Wc
#
find_package (OpenMP)
if(OPENMP_FOUND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
# SET(ScaLFMM_CXX_FLAGS "${ScaLFMM_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
else()
MESSAGE(WARNING "OPENMP NOT FOUND")
endif(OPENMP_FOUND)
MESSAGE(STATUS "ScalFMM_BUILD_DEBUG = ${ScalFMM_BUILD_DEBUG}" )
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
......@@ -186,6 +190,7 @@ IF(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
if( ${NAME} GREATER 0)
if( ${INTEL_VERSION} EQUAL 15. OR ${INTEL_VERSION} GREATER 15.0.0)
MESSAGE( " Intel compiler is icl++ ( version >= 15.0.0)")
SET(INTEL_ICL_COMPILER "ON")
else()
MESSAGE(FATAL_ERROR " Intel compiler should be icl++ ( version >= 15.0.0)")
endif()
......@@ -212,16 +217,29 @@ ENDIF()
MESSAGE( STATUS "ScalFMM_USE_SSE = ${ScalFMM_USE_SSE}" )
if( ScalFMM_USE_SSE )
TRY_COMPILE(COMPILE_RESULT_VAR ${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_MODULE_PATH}/checkSSEpe.cpp )
IF( NOT ${COMPILE_RESULT_VAR})
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__SSEPE_INTEL_COMPILER")
ENDIF()
IF(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse -msse2 -msse3 -mfpmath=sse")
MESSAGE(WARNING "INTEL CXX_FLAG__SSE ${CMAKE_CXX_FLAGS} ")
TRY_COMPILE(COMPILE_SSE ${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_MODULE_PATH}/compileTestSse.cpp )
IF(${COMPILE_SSE})
TRY_COMPILE(COMPILE_RESULT_VAR ${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_MODULE_PATH}/checkSSEpe.cpp )
IF( NOT ${COMPILE_RESULT_VAR})
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__SSEPE_INTEL_COMPILER")
ENDIF()
IF(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
if(INTEL_ICL_COMPILER)
# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -xHost -mfpmath=sse")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.2 ")
MESSAGE(WARNING "Need to check for SSE2 and SSE3 ")
else()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.2")
ENDIF()
MESSAGE(WARNING "INTEL SSE CXX FLAGS: ${CMAKE_CXX_FLAGS} ")
ELSE()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse -msse2 -msse3 -mfpmath=sse")
ENDIF()
ELSE()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse -msse2 -msse3 -mfpmath=sse")
MESSAGE(FATAL_ERROR "SSE NOT SUPPORTED ; Set ScalFMM_USE_SSE to OFF")
ENDIF()
endif()
##################################################################
......@@ -230,19 +248,24 @@ endif()
MESSAGE(STATUS "ScalFMM_USE_AVX = ${ScalFMM_USE_AVX}")
if(ScalFMM_USE_AVX)
TRY_COMPILE(COMPILE_RESULT_VAR ${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_MODULE_PATH}/checkAVXpe.cpp )
IF( NOT ${COMPILE_RESULT_VAR})
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__AVXPE_INTEL_COMPILER")
TRY_COMPILE(COMPILE_AVX ${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_MODULE_PATH}/compileTestAvx.cpp )
IF(${COMPILE_AVX})
TRY_COMPILE(COMPILE_RESULT_AVSPE ${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_MODULE_PATH}/checkAVXpe.cpp )
IF( NOT ${COMPILE_RESULT_AVSPE})
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__AVXPE_INTEL_COMPILER")
ENDIF()
IF(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx")
MESSAGE(WARNING "INTEL AVX CXX FLAGS: ${CMAKE_CXX_FLAGS} ")
ELSE()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse -msse2 -msse3 -mfpmath=sse -mavx")
ENDIF()
IF(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse -msse2 -msse3 -mfpmath=sse -mavx")
MESSAGE(WARNING "INTEL CXX_FLAG__SSE ${CMAKE_CXX_FLAGS} ")
ELSE()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse -msse2 -msse3 -mfpmath=sse -mavx")
ENDIF()
MESSAGE(STATUS ${CMAKE_CXX_FLAGS} )
MESSAGE(STATUS ${CMAKE_CXX_FLAGS} )
ELSE()
MESSAGE(FATAL_ERROR "AVS NOT SUPPORTED ; Set ScalFMM_USE_AVX to OFF")
ENDIF()
endif()
......
#include "../src/Container/instrset.h"
#include "immintrin.h"
int main() {
int iset = instrset_detect();
bool hasAVX = iset >= 7;
printf("Has AVX? %s (iset = %d)\n", hasAVX ? "Yes!" : "No.", iset);
return iset;
__m256d tx, ty ;
tx += ty ;
return 0;
}
#include <x86intrin.h>
#include <xmmintrin.h> // SSE
#include <emmintrin.h> // SSE2
#include <pmmintrin.h> // SSE3
#include <tmmintrin.h> // SSSE3
#include <smmintrin.h> // SSE4
#include <immintrin.h> // AVX
int main(){
{
__m256d res0d, res1d;
res0d = _mm256_hadd_pd(res0d, res1d);
__m256 res0, res1;
res0 = _mm256_hadd_ps(res0, res1);
}
{
__m128d res0d, res1d;
res0d = _mm_hadd_pd(res0d, res1d);
__m128 res0, res1;
res0 = _mm_hadd_ps(res0, res1);
}
return 0;
}
#include <x86intrin.h>
#include <xmmintrin.h> // SSE
#include <emmintrin.h> // SSE2
#include <pmmintrin.h> // SSE3
#ifdef __SSSE3__
#include <tmmintrin.h> //SSSE3
#endif
#ifdef __SSSE4_1__
#include <smmintrin.h> // SSE4
#endif
int main(){
__m128d res0d, res1d;
res0d = _mm_hadd_pd(res0d, res1d);
__m128 res0, res1;
res0 = _mm_hadd_ps(res0, res1);
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment