...
 
Commits (100)
image: hpclib/hiepacs
before_script:
- source /usr/share/modules/init/bash && source /usr/local/share/spack/setup-env.sh && spack load cmake
variables:
GIT_SUBMODULE_STRATEGY: normal
stages:
- build
- pages
- test
- sonar
......@@ -19,8 +23,8 @@ build:
- cd Build && cmake ..
-DSCALFMM_USE_LOG=ON
-DSCALFMM_USE_ASSERT=ON
-DSCALFMM_USE_SSE=OFF
-DSCALFMM_USE_AVX=OFF
-DINASTEMP_USE_AVX2=OFF
-DINASTEMP_USE_AVX=OFF
-DSCALFMM_USE_BLAS=ON
-DSCALFMM_USE_FFT=ON
-DSCALFMM_USE_MPI=ON
......@@ -29,8 +33,8 @@ build:
-DSCALFMM_BUILD_TESTS=ON
-DSCALFMM_BUILD_UTESTS=ON
-DCMAKE_VERBOSE_MAKEFILE=ON
-DCMAKE_C_COMPILER=gcc-6
-DCMAKE_CXX_COMPILER=g++-6
-DCMAKE_C_COMPILER=gcc
-DCMAKE_CXX_COMPILER=g++
- make -j5 2>&1 |tee scalfmm-build.log
doc:
......@@ -43,9 +47,22 @@ doc:
script:
- cd Build && cmake ..
-DSCALFMM_BUILD_DOC=ON
-DCMAKE_C_COMPILER=gcc-6
-DCMAKE_CXX_COMPILER=g++-6
- make doc
-DCMAKE_C_COMPILER=gcc
-DCMAKE_CXX_COMPILER=g++
- make doc
pages:
stage: pages
dependencies:
- doc
artifacts:
paths:
- public
script:
- mkdir public
- mv Build/Doc/html/* public/
only:
- master
test:
stage: test
......@@ -57,7 +74,7 @@ test:
paths:
- Build/
script:
- (cd Build && OMP_NUM_THREADS=4 ctest --no-compress-output -V -j 5 -D ExperimentalBuild -D ExperimentalTest -D ExperimentalCoverage -D ExperimentalSubmit)
- (cd Build && OMP_NUM_THREADS=4 ctest --no-compress-output -VV -j 5 -D ExperimentalBuild -D ExperimentalTest -D ExperimentalCoverage -D ExperimentalSubmit)
sonar:
stage: sonar
......@@ -78,4 +95,4 @@ sonar:
- source ./Utils/scripts/analysis.sh
- sonar-scanner |tee sonar.log;
only:
- develop@solverstack/ScalFMM
\ No newline at end of file
- master@solverstack/ScalFMM
[submodule "CMakeModules/morse_cmake"]
path = CMakeModules/morse_cmake
url = https://gitlab.inria.fr/solverstack/morse_cmake.git
[submodule "inastemp"]
path = inastemp
url = https://gitlab.inria.fr/coulaud/inastemp.git
cmake_minimum_required (VERSION 2.8.3 FATAL_ERROR)
cmake_minimum_required (VERSION 3.10.0 FATAL_ERROR)
if(CMAKE_MAJOR_VERSION GREATER 1 AND CMAKE_MINOR_VERSION GREATER 7 AND CMAKE_PATCH_VERSION GREATER 11)
cmake_policy(SET CMP0022 OLD)
endif()
cmake_policy(SET CMP0004 NEW)
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
#===========================================================================
#
# Project Declaration
#===========================================================================
project(SCALFMM C CXX )
#--------------------
project(scalfmm CXX)
# check if compiling into source directories
string(COMPARE EQUAL "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}" insource)
if(insource)
message(FATAL_ERROR "${PROJECT_NAME} requires an out of source build. Goto ./Build and tapes cmake ../")
endif(insource)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/)
SET(SCALFMM_CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/)
#
# Adds the CMAKE_DEPENDENT_OPTION command
INCLUDE(CMakeDependentOption)
# Add to check CPU info
include(GetCpuInfos)
GetCpuInfos()
#
#===========================================================================
# Version Number
#===========================================================================
# --------------
# SCALFMM version number. An even minor number corresponds to releases.
set(SCALFMM_MAJOR_VERSION 2)
set(SCALFMM_MINOR_VERSION 0)
set(SCALFMM_PATCH_VERSION rc0)
set(SCALFMM_VERSION "${SCALFMM_MAJOR_VERSION}.${SCALFMM_MINOR_VERSION}.${SCALFMM_PATCH_VERSION}" )
set(${CMAKE_PROJECT_NAME}_MAJOR_VERSION 2)
set(${CMAKE_PROJECT_NAME}_MINOR_VERSION 0)
set(${CMAKE_PROJECT_NAME}_PATCH_VERSION rc0)
set(${CMAKE_PROJECT_NAME}_VERSION "${${CMAKE_PROJECT_NAME}_MAJOR_VERSION}.${${CMAKE_PROJECT_NAME}_MINOR_VERSION}.${${CMAKE_PROJECT_NAME}_PATCH_VERSION}" )
SET(CXX_STANDARD_REQUIRED ON)
SET(CMAKE_CXX_STANDARD 14)
#
# Set global c++ support
# ----------------------
set(CMAKE_CXX_STANDARD 14)
set( MORSE_DISTRIB_DIR "" CACHE PATH "Directory of MORSE distribution")
#
# Update cmake path
# -----------------
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/)
if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/morse_cmake")
#
# Creating main lib
# -----------------
list(APPEND SCALFMM_SOURCES FAlgorithmTimers.cpp FLog.cpp FMemStats.cpp FSignalHandler.cpp)
list(TRANSFORM SCALFMM_SOURCES PREPEND "${CMAKE_CURRENT_SOURCE_DIR}/src/")
add_library(${CMAKE_PROJECT_NAME} STATIC ${SCALFMM_SOURCES})
# Set library includes
# --------------------
target_include_directories(${CMAKE_PROJECT_NAME} PUBLIC
$<BUILD_INTERFACE:${${CMAKE_PROJECT_NAME}_BINARY_DIR}/include>
$<BUILD_INTERFACE:${${CMAKE_PROJECT_NAME}_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
if(MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/morse_cmake")
# Add extra cmake module path and initialize morse cmake modules
# --------------------------------------------------------------
......@@ -52,8 +55,12 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/morse_
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/morse_cmake/modules)
set(MORSE_CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/morse_cmake/modules )
endif()
include(MorseInit)
# Set the RPATH config
# These options allow all installed executables to run correctly
# when installed to the install diretory
# --------------------
# use, i.e. don't skip the full RPATH for the build tree
set(CMAKE_SKIP_BUILD_RPATH FALSE)
......@@ -62,339 +69,192 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/morse_
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
# the RPATH to be used when installing
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
# add the automatically determined parts of the RPATH
# which point to directories outside the build tree to the install RPATH
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# Build ScalFmm as static or dynamic lib
# --------------------------------------
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
# option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
#
# Options
#
option( SCALFMM_USE_MPI "Set to ON to build ScaFMM with MPI" OFF )
option( SCALFMM_USE_BLAS "Set to ON to build ScaFMM with BLAS" ON )
option( SCALFMM_USE_FFT "Set to ON to build ScaFMM with FFTW" ON )
option( SCALFMM_BUILD_EXAMPLES "Set to ON to compile examples " ON )
option( SCALFMM_BUILD_TESTS "Set to ON to build functionalities Tests" OFF )
option( SCALFMM_BUILD_UTESTS "Set to ON to build UTests" OFF )
option( SCALFMM_INSTALL_DATA "Set to ON to include the data when proceeding to the installtion " OFF )
# Cmake options for dependencies
option( SCALFMM_USE_MPI "Set to ON to build ScaFMM with MPI" OFF )
option( SCALFMM_USE_BLAS "Set to ON to build ScaFMM with BLAS" ON )
option( SCALFMM_USE_FFT "Set to ON to build ScaFMM with FFTW" OFF )
option( SCALFMM_USE_STARPU "Set to ON to build SCALFMM with StarPU" OFF )
# Cmake options that impact the build tree
option( SCALFMM_BUILD_EXAMPLES "Set to ON to compile examples " ON )
option( SCALFMM_BUILD_TESTS "Set to ON to build functionalities Tests" OFF )
option( SCALFMM_BUILD_UTESTS "Set to ON to build UTests" OFF )
option( SCALFMM_BUILD_UTILS "Set to ON to build utils Tests" OFF )
option( SCALFMM_BUILD_DOC "Set to ON to build the Doxygen documentation " OFF )
option( SCALFMM_BUILD_DEBUG "Set to ON to build in Debug" OFF )
# Cmake options to install additional content
option( SCALFMM_INSTALL_DATA "Set to ON to include the data when proceeding to the installtion " OFF )
# Cmake options related to trace, logging and statistics
option( SCALFMM_USE_LOG "Set to ON to print output debug information" OFF )
option( SCALFMM_USE_MEM_STATS "Set to ON to profile memory" OFF )
option( SCALFMM_ATTACHE_SOURCE "Set to ON to compile with -g" OFF )
option( SCALFMM_USE_ADDONS "Set to ON to compile add ons" OFF )
option( SCALFMM_USE_SIGNALS "Set to ON to catch various signal an print backtrace" OFF )
option( SCALFMM_USE_ASSERT "Set to ON to enable safe tests during execution" ON )
option( SCALFMM_USE_MIC_NATIVE "Set to ON to compile in native mode for MIC" OFF )
option( SCALFMM_ONLY_DEVEL "Set to ON to compile Development tools (only scalfmm team)" OFF )
option( SCALFMM_USE_EZTRACE "Set to ON to compile with eztrace framwork" OFF )
option( SCALFMM_USE_STARPU "Set to ON to build SCALFMM with StarPU" OFF )
option( SCALFMM_BUILD_UTILS "Set to ON to build utils Tests" OFF )
#
# VECTORISATION
#
if( APPLE ) # to fix problem with GCC and avx
CMAKE_DEPENDENT_OPTION( SCALFMM_USE_SSE "Set to ON to compile with SSE support (and use intrinsec SSE P2P)" ON "CPUOPTION_SSE3;NOT CPUOPTION_AVX2" OFF )
CMAKE_DEPENDENT_OPTION( SCALFMM_USE_AVX "Set to ON to compile with AVX support (and use intrinsec AVX P2P)" OFF "CPUOPTION_AVX; NOT CPUOPTION_AVX2" OFF )
else(APPLE)
CMAKE_DEPENDENT_OPTION( SCALFMM_USE_SSE "Set to ON to compile with SSE support (and use intrinsec SSE P2P)" ON "CPUOPTION_SSE3;NOT CPUOPTION_AVX;NOT CPUOPTION_AVX2" OFF )
CMAKE_DEPENDENT_OPTION( SCALFMM_USE_AVX "Set to ON to compile with AVX support (and use intrinsec AVX P2P)" ON "CPUOPTION_AVX; NOT CPUOPTION_AVX2" OFF )
endif(APPLE)
CMAKE_DEPENDENT_OPTION( SCALFMM_USE_AVX2 "Set to ON to compile with AVX support (and use intrinsec AVX2 P2P)" ON "CPUOPTION_AVX2" OFF )
if( SCALFMM_ONLY_DEVEL )
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
option( SCALFMM_USE_OMP4 "Set to ON to disable the gcc/intel omp4" OFF )
else()
option( SCALFMM_USE_OMP4 "Set to ON to disable the gcc/intel omp4" ON )
endif()
option( SCALFMM_TIME_OMPTASKS "Set to ON to time omp4 tasks and generate output file" OFF )
# SIMGRID and peformance models options
option( SCALFMM_SIMGRID_NODATA "Set to ON to avoid the allocation of numerical parts in the group tree" OFF )
option( STARPU_SIMGRID_MLR_MODELS "Set to ON to enable MLR models need for calibration and simulation" OFF )
# OPENMP 4/5 support
message(WARNING "OpenMP_VERSION: ${OpenMP_VERSION}")
option( OPENMP_SUPPORT_PRIORITY "Set to ON to enable tasks priority (OMP4.x/KSTAR/StarPU compiler only)" OFF )
# STARPU options
CMAKE_DEPENDENT_OPTION(OPENMP_SUPPORT_COMMUTE "Set to ON to let tasks commute (KSTAR/StarPU compiler only)" OFF
"SCALFMM_USE_STARPU" OFF)
CMAKE_DEPENDENT_OPTION(OPENMP_SUPPORT_TASK_NAME "Set to ON to enable a taskname clause for tasks (KSTAR/StarPU compiler only)" OFF
"SCALFMM_USE_STARPU" OFF)
CMAKE_DEPENDENT_OPTION(SCALFMM_STARPU_USE_COMMUTE "Set to ON to enable commute with StarPU" ON "SCALFMM_USE_STARPU" OFF)
CMAKE_DEPENDENT_OPTION(SCALFMM_STARPU_USE_REDUX "Set to ON to enable redux with StarPU" OFF "SCALFMM_USE_STARPU" OFF)
CMAKE_DEPENDENT_OPTION(SCALFMM_STARPU_USE_PRIO "Set to ON to enable priority with StarPU" ON "SCALFMM_USE_STARPU" OFF)
CMAKE_DEPENDENT_OPTION(SCALFMM_STARPU_FORCE_NO_SCHEDULER "Set to ON to disable heteroprio even if supported" OFF "SCALFMM_USE_STARPU" OFF)
CMAKE_DEPENDENT_OPTION(SCALFMM_USE_STARPU_EXTRACT "Set to ON to enable extract with StarPU mpi implicit" ON "SCALFMM_USE_STARPU" OFF)
endif()
message(STATUS "AVANT ${CMAKE_CXX_COMPILER_ID}" )
#
# MPI
#
if( SCALFMM_USE_MPI )
try_compile(COMPILE_INTEL ${CMAKE_CURRENT_BINARY_DIR}
${SCALFMM_CMAKE_MODULE_PATH}/compileTestIntel.cpp
COMPILE_DEFINITIONS "${CMAKE_CXX_FLAGS}")
if (COMPILE_INTEL)
set(CMAKE_CXX_COMPILER_ID "Intel")
endif()
endif()
message(STATUS "CXX ${CMAKE_CXX_COMPILER_ID}" )
# Set scalfmm to default libraries
set(SCALFMM_LIBRARIES "")
set(SCALFMM_CXX_FLAGS "-fpic -Wall")
# set(SCALFMM_CXX_FLAGS "${SCALFMM_CXX_FLAGS} -I${CMAKE_CURRENT_SOURCE_DIR}/Contribs")
#
#
# Test if openmp is here
#
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}")
else(OPENMP_FOUND)
message(WARNING "OPENMP NOT FOUND")
endif(OPENMP_FOUND)
message(STATUS "SCALFMM_BUILD_DEBUG = ${SCALFMM_BUILD_DEBUG}" )
#
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(SCALFMM_CXX_FLAGS "${SCALFMM_CXX_FLAGS} -m64")
endif()
##############################################################################
# Compile options #
##############################################################################
# -xHost -mfpmath=sse
# -Wall Wnosign-conversion
#
# Set a fixed template depth
# Compilers don't use the same default for template-depth, we can enforce the same one everywhere.
# The magic number comes from GCC's default: https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Dialect-Options.html#C_002b_002b-Dialect-Options
set(SCALFMM_CXX_FLAGS "${SCALFMM_CXX_FLAGS} -ftemplate-depth=900")
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
# INTEL
IF (APPLE)
IF( CPUOPTION_SSE42 )
set(SSE_FLAGS "-msse4 -mfpmath=sse") # -mtune=native -march=native
ELSEIF (CPUOPTION_SSE3)
set(SSE_FLAGS "-msse3 -mfpmath=sse") # -mtune=native -march=native
ENDIF (CPUOPTION_SSE42)
else(APPLE)
set(AVX_FLAGS "-fp-model source -march=native -axCORE-AVX2,CORE-AVX-I,AVX") #-mavx
set(AVX2_FLAGS "-march=native -axCORE-AVX2,CORE-AVX-I,AVX") #-march=core-avx2
set(SSE_FLAGS "-axSSE4.2 -march=native")
endif(APPLE)
set(SCALFMM_CXX_FLAGS "${SCALFMM_CXX_FLAGS} -fma -align -finline-functions")
#-Wshadow -Wpointer-arith -Wcast-qual -Wconversion -Wall -Wnosign-conversion ")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "XL")
set(SCALFMM_CXX_FLAGS "${SCALFMM_CXX_FLAGS} -mcpu=power8 -mtune=power8")
else() #if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# NOT INTEL
if(NOT SCALFMM_USE_MPI)
include(CheckCCompilerFlag)
check_c_compiler_flag(-Wzero-as-null-pointer-constant HAS_WZERO_NULL_PTR_FLAG)
if(HAS_WZERO_NULL_PTR_FLAG)
set(SCALFMM_CXX_FLAGS "${SCALFMM_CXX_FLAGS} -Wzero-as-null-pointer-constant")
endif()
else()
include(CheckCCompilerFlag)
check_c_compiler_flag(-Wno-literal-suffix HAS_NO_LITERAL_SUFFIX_FLAG)
if(HAS_NO_LITERAL_SUFFIX_FLAG)
set(SCALFMM_CXX_FLAGS "${SCALFMM_CXX_FLAGS} -Wno-literal-suffix")
endif()
endif()
IF (APPLE)
# set(SSE_FLAGS "-msse4 -mfpmath=sse") # -mtune=native -march=native
IF( CPUOPTION_SSE42 )
set(SSE_FLAGS "-msse4 -mfpmath=sse") # -mtune=native -march=native
ELSEIF (CPUOPTION_SSE3)
set(SSE_FLAGS "-msse3 -mfpmath=sse") # -mtune=native -march=native
ENDIF (CPUOPTION_SSE42)
set(AVX_FLAGS "-mtune=native -march=avx")
set(AVX2_FLAGS "-mtune=native -march=native -mmic")
else(APPLE)
set(SSE_FLAGS "-mtune=native -march=native")
set(AVX_FLAGS "-mtune=native -march=native")
set(AVX2_FLAGS "-mtune=native -march=native -mmic")
endif(APPLE)
endif()
# Cmake options related to the targeted architecture
option( SCALFMM_USE_MIC_NATIVE "Set to ON to compile in native mode for MIC" OFF )
##############################################################################
# FUSE list #
##############################################################################
set(FUSE_LIST "")
#set(FUSE_LIST " MPI;BLAS;FFT;STARPU;CUDA;OPENCL;OMP4;SSE;AVX;AVX2;MIC;MPI2")
# then do list(APPEND FUSE_LIST "BLAS") to protect from FUSE_BLAS
# list(APPEND FUSE_LIST "MPI")
##############################################################################
# Debug flags #
##############################################################################
#
if( SCALFMM_BUILD_DEBUG )
#
# Compile Debug flags
#
set(CMAKE_BUILD_TYPE Debug)
ADD_DEFINITIONS(-O0)
if( APPLE )
set(SCALFMM_FLAGS_OPTI_DEBUG "-funroll-loops" CACHE STRING
"Set your optimization flags for debug mode.")
else(APPLE)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
set(SCALFMM_FLAGS_OPTI_DEBUG "-fp-model strict -funroll-loops" CACHE STRING
"Set your optimization flags for debug mode.")
else()
set(SCALFMM_FLAGS_OPTI_DEBUG "-funroll-loops" CACHE STRING
"Set your optimization flags for debug mode.")
# Set scalfmm global lists
# ------------------------
list(APPEND SCALFMM_CXX_FLAGS -fpic -Wall)
# TODO: Find new way to resolve dependencies...
# Set FUSE LIST
# -------------
set(FUSE_LIST "") # Construct during configure
set(FUSE_DEP_AVAILABLE "MPI;CUDA;STARPU;OMP4;BLAS;FFT;OPENCL") # List to compare against when compiling tests, etc...
#
# OpenMP
# ------
if(NOT OpenMP_CXX_FOUND)
find_package(OpenMP)
if(OpenMP_CXX_FOUND)
target_link_libraries(${CMAKE_PROJECT_NAME} PUBLIC OpenMP::OpenMP_CXX)
list(APPEND SCALFMM_LIBRARIES OpenMP)
if(OpenMP_CXX_VERSION_MAJOR GREATER_EQUAL 4)
list(APPEND FUSE_LIST OMP4)
endif()
endif(APPLE)
# ADD_DEFINITIONS(${SCALFMM_FLAGS_OPTI_DEBUG})
set(SCALFMM_CXX_FLAGS "${SCALFMM_CXX_FLAGS} ${SCALFMM_FLAGS_OPTI_DEBUG}")
set(CMAKE_CXX_FLAGS_TYPE "${CMAKE_CXX_FLAGS_DEBUG}")
else()
##############################################################################
# Release flags #
##############################################################################
set(CMAKE_BUILD_TYPE Release)
set(CMAKE_CXX_FLAGS_TYPE "${CMAKE_CXX_FLAGS_RELEASE}")
# if compiler is intel add -ip
else(OpenMP_CXX_FOUND)
message(WARNING "OPENMP NOT FOUND")
endif(OpenMP_CXX_FOUND)
endif(NOT OpenMP_CXX_FOUND)
#
# Inastemp
# --------
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/inastemp")
# Set option() CMP0077 to old for inastemp...
set(CMAKE_POLICY_DEFAULT_CMP0077 OLD)
set(INASTEMP_JUST_LIB TRUE)
set(INASTEMP_DO_INSTALL TRUE)
# Create target
add_subdirectory(inastemp)
add_library(inastemp INTERFACE)
target_include_directories(inastemp INTERFACE
$<BUILD_INTERFACE:${INASTEMP_SOURCE_DIR}/Src>
$<BUILD_INTERFACE:${INASTEMP_BINARY_DIR}/Src>
$<INSTALL_INTERFACE:include>
)
string(REPLACE " -" ";-" INASTEMP_FLAGS "${INASTEMP_CXX_FLAGS}")
list(REMOVE_DUPLICATES INASTEMP_FLAGS)
target_compile_options(inastemp INTERFACE ${INASTEMP_FLAGS})
target_link_libraries(${CMAKE_PROJECT_NAME} PUBLIC inastemp)
message(STATUS "Inastemp flags : ${INASTEMP_FLAGS}")
message(WARNING "Inastemp configures compile flags according to the current architure "
"you are compiling on. If you target a different machine, be carefull "
"with the available SIMD instruction set supported."
"Thus, use INASTEMP_USE_XXX to target the correct instruction set.")
else(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/inastemp")
message(STATUS "Inastemp is not available.")
message(STATUS "Please, initialize all git submodule.")
message(FATAL_ERROR "Exit : Inastemp dependency not found.")
endif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/inastemp")
#
# Specific Debug flags
# --------------------
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
list(APPEND SCALFMM_CXX_FLAGS -funroll-loops)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
set(SCALFMM_CXX_FLAGS "${SCALFMM_CXX_FLAGS} -ipo -fstrict-aliasing ")# -no-prec-div -no-prec-sqrt")
list(APPEND SCALFMM_CXX_FLAGS -fp-model\ strict)
endif()
# Compile optimization
if(APPLE)
set(SCALFMM_FLAGS_OPTI_RELEASE "-funroll-loops" CACHE STRING
"Set your optimization flags for release mode.")
else(APPLE)
# Not apple system - Check the compiler flags
endif()
#
# Specific Release flags
# ----------------------
if(CMAKE_BUILD_TYPE STREQUAL "Release")
list(APPEND SCALFMM_CXX_FLAGS -funroll-loops)
if(NOT APPLE)
list(APPEND -ftree-vectorize)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
#set(SCALFMM_FLAGS_OPTI_RELEASE "-fp-model precise -fp-model source -fimf-precision=low -funroll-loops -ftree-vectorize"
set(SCALFMM_FLAGS_OPTI_RELEASE "-funroll-loops -ftree-vectorize"
CACHE STRING "Set your optimization flags for release mode.")
# set(SCALFMM_FLAGS_OPTI_RELEASE "-funroll-loops -ftree-vectorize" CACHE STRING
# "Set your optimization flags for release mode.")
else()
set(SCALFMM_FLAGS_OPTI_RELEASE "-ffast-math -funroll-loops -ftree-vectorize" CACHE STRING
"Set your optimization flags for release mode.")
list(APPEND SCALFMM_CXX_FLAGS -ipo -fstrict-aliasing)
endif()
endif(APPLE)
#
set(SCALFMM_CXX_FLAGS "${SCALFMM_CXX_FLAGS} ${SCALFMM_FLAGS_OPTI_RELEASE}")
list(APPEND SCALFMM_CXX_FLAGS -ffast-math -ftree-vectorize)
endif(NOT APPLE)
endif()
MESSAGE(STATUS " %%%%%%%%%% SCALFMM_CXX_FLAGS ${SCALFMM_CXX_FLAGS} %%%%%%%%%%%%%")
MESSAGE(STATUS " %%%%%%%%%% CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE} %%%%%%%%%%%%%")
#
##############################################################################
# Attach source code to exec #
##############################################################################
message(STATUS "SCALFMM_ATTACHE_SOURCE = ${SCALFMM_ATTACHE_SOURCE}" )
if( SCALFMM_ATTACHE_SOURCE )
message(STATUS "Option -g is used, the code is attached to the binary." )
set(SCALFMM_CXX_FLAGS "${SCALFMM_CXX_FLAGS} -g")
endif(SCALFMM_ATTACHE_SOURCE)
#
##############################################################################
# find MPI #
##############################################################################
#
if( SCALFMM_USE_MPI )
find_package(MPI REQUIRED)
if(MPI_FOUND)
if (MPI_CXX_FOUND)
# message("MPI_CXX is in the place")
if (MPI_CXX_INCLUDE_PATH)
include_directories( ${MPI_CXX_INCLUDE_PATH} )
endif()
if (MPI_CXX_COMPILE_FLAGS)
set(SCALFMM_CXX_FLAGS "${SCALFMM_CXX_FLAGS} ${MPI_CXX_COMPILE_FLAGS}")
endif()
if (MPI_CXX_INCLUDE_PATH)
set(SCALFMM_INCLUDES "${SCALFMM_INCLUDES};${MPI_CXX_INCLUDE_PATH}")
endif()
if (MPI_CXX_LINK_FLAGS)
list(APPEND "CMAKE_EXE_LINKER_FLAGS ${MPI_CXX_LINK_FLAGS}")
endif()
if (MPI_CXX_LIBRARIES)
set(SCALFMM_LIBRARIES "${SCALFMM_LIBRARIES};${MPI_CXX_LIBRARIES}")
endif()
else (MPI_CXX_FOUND)
message(FATAL_ERROR "MPI_CXX is required but was not found. "
"Please provide an MPI compiler in your environment."
"Note that you can give the path to your MPI installation "
"by setting MPI_DIR cmake variable.")
endif (MPI_CXX_FOUND)
else(MPI_FOUND)
endif(MPI_FOUND)
endif( SCALFMM_USE_MPI)
list(APPEND FUSE_LIST "MPI")
#
##############################################################################
# Blas option #
##############################################################################
#
if( SCALFMM_USE_BLAS )
# if(APPLE) # In order to use QT-creator on macos
# list(APPEND CMAKE_REQUIRED_INCLUDES $ENV{MKLROOT}/include)
# endif()
# include(FortranCInterface)
# # Define a Fortran interface file (FCMangle.hpp)
# FortranCInterface_HEADER( ${CMAKE_CURRENT_SOURCE_DIR}/Src/FCMangle.hpp
# MACRO_NAMESPACE "PM_"
# SYMBOL_NAMESPACE "PM_"
# SYMBOLS init testPPM:init)
message(STATUS "CMAKE_CXX_COMPILER_ID STREQUAL ${CMAKE_CXX_COMPILER_ID}")
option( SCALFMM_USE_MKL_AS_BLAS "Set to ON to use MKL BLAS/LAPACK" OFF )
option( SCALFMM_USE_ESSL_AS_BLAS "Set to ON to use ESSL BLAS/LAPACK" OFF )
# MPI
# ---
if(SCALFMM_USE_MPI)
if(NOT MPI_FOUND)
try_compile(COMPILE_INTEL ${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/compileTestIntel.cpp
COMPILE_DEFINITIONS "${CMAKE_CXX_FLAGS}")
if(COMPILE_INTEL)
set(CMAKE_CXX_COMPILER_ID "Intel")
endif()
message(STATUS "CXX ${CMAKE_CXX_COMPILER_ID}" )
find_package(MPI REQUIRED)
if(MPI_CXX_FOUND)
target_link_libraries(${CMAKE_PROJECT_NAME} PUBLIC MPI::MPI_CXX)
list(APPEND SCALFMM_LIBRARIES MPI)
list(APPEND FUSE_LIST MPI)
target_sources(${CMAKE_PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/FMpi.cpp)
else(MPI_CXX_FOUND)
message(FATAL_ERROR "MPI_CXX is required but was not found. "
"Please provide an MPI compiler in your environment."
"Note that you can give the path to your MPI installation "
"by setting MPI_DIR cmake variable.")
endif(MPI_CXX_FOUND)
endif(NOT MPI_FOUND)
endif(SCALFMM_USE_MPI)
#
# Blas options
# ------------
if(SCALFMM_USE_BLAS)
option( SCALFMM_USE_MKL_AS_BLAS "Set to ON to use MKL BLAS/LAPACK" OFF )
option( SCALFMM_USE_ESSL_AS_BLAS "Set to ON to use ESSL BLAS/LAPACK" OFF )
option( SCALFMM_USE_EXTERNAL_BLAS "Set to ON to use external BLAS. Please, set BLAS_LIBRARIES variable." OFF )
if( SCALFMM_USE_MKL_AS_BLAS )
set(BLA_VENDOR "Intel10_64lp_seq")
find_package(BLAS ) # not REQUIRED
unset(LAPACK_LIBRARIES)
if (BLAS_LIBRARIES)
set(BLASLAPACK_LIBRARIES ${BLAS_LIBRARIES})
endif()
elseif(SCALFMM_USE_ESSL_AS_BLAS)
set(BLA_VENDOR "IBMESSL")
find_package(BLAS QUIET) # not REQUIRED
find_package(LAPACK QUIET) # not REQUIRED
if (LAPACK_LIBRARIES)
set(BLASLAPACK_LIBRARIES "${LAPACK_LIBRARIES}")
endif()
if (BLAS_LIBRARIES)
list(APPEND BLASLAPACK_LIBRARIES ${BLAS_LIBRARIES})
endif()
elseif(SCALFMM_USE_EXTERNAL_BLAS)
message(STATUS "BLAS SET BY EXTERNAL PROGRAM = ${BLAS_LIBRARIES}")
list(APPEND BLASLAPACK_LIBRARIES "${BLAS_LIBRARIES}")
else()
find_package(BLAS) # not REQUIRED
find_package(LAPACK) # not REQUIRED
set(BLASLAPACK_LIBRARIES)
if (LAPACK_LIBRARIES)
set(BLASLAPACK_LIBRARIES "${LAPACK_LIBRARIES}")
endif()
if (BLAS_LIBRARIES)
list(APPEND BLASLAPACK_LIBRARIES "${BLAS_LIBRARIES}")
endif()
endif()
if(BLAS_FOUND)
set(SCALFMM_LIBRARIES "${SCALFMM_LIBRARIES};${BLASLAPACK_LIBRARIES}")
if(BLAS_LIBRARY_DIRS)
# the RPATH to be used when installing
list(APPEND CMAKE_INSTALL_RPATH "${BLAS_LIBRARY_DIRS}")
endif()
if(LAPACK_FOUND AND LAPACK_LIBRARY_DIRS)
# the RPATH to be used when installing
list(APPEND CMAKE_INSTALL_RPATH "${LAPACK_LIBRARY_DIRS}")
target_link_libraries(${CMAKE_PROJECT_NAME} PUBLIC blas::blas)
list(APPEND SCALFMM_LIBRARIES BLAS)
list(APPEND FUSE_LIST BLAS)
if(LAPACK_FOUND)
target_link_libraries(${CMAKE_PROJECT_NAME} PUBLIC lapack::lapack)
list(APPEND SCALFMM_LIBRARIES LAPACK)
endif()
message (STATUS "check BLAS Fortran mangling")
message (STATUS "Check BLAS Fortran mangling")
# add options to let the user be able to force a behavior
option( SCALFMM_BLAS_ADD_ "Set to ON to force calls to BLAS Fortran symbols with _ (ex: dgemm_)" ON )
option( SCALFMM_BLAS_UPCASE "Set to ON to force calls to BLAS Fortran symbols in capital (ex: DGEMM)" OFF )
......@@ -443,7 +303,7 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/morse_
endif()
endif (NOT SCALFMM_BLAS_ADD_ AND NOT SCALFMM_BLAS_UPCASE AND NOT SCALFMM_BLAS_NOCHANGE)
else()
MESSAGE(WARNING "BLAS: ${BLAS-FOUND}")
MESSAGE(WARNING "BLAS: ${BLAS_FOUND}")
message(WARNING "BLAS has not been found, SCALFMM will continue to compile but some applications will be disabled.")
message(WARNING "If you have BLAS set BLAS_LIBDIR, BLAS_INCDIR or BLAS_DIR (CMake variables using -D or environment variables).")
......@@ -451,52 +311,42 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/morse_
endif()
endif(SCALFMM_USE_BLAS)
list(APPEND FUSE_LIST "BLAS")
#
# FFT option
#
# FFT options
# -----------
CMAKE_DEPENDENT_OPTION(SCALFMM_USE_MKL_AS_FFTW "Set to ON to use MKL FFTW" ON "SCALFMM_USE_FFT;SCALFMM_USE_MKL_AS_BLAS" OFF )
CMAKE_DEPENDENT_OPTION(SCALFMM_USE_ESSL_AS_FFTW "Set to ON to use ESSL FFTW" ON "SCALFMM_USE_FFT;SCALFMM_USE_ESSL_AS_BLAS" OFF )
if( SCALFMM_USE_FFT )
if(SCALFMM_USE_FFT)
message(STATUS "SCALFMM USE FFT Configure:")
# The package find_package(FFTW) can be used with the following COMPONENTS:
# MKL, ESSL, THREADS|OMP and/or SIMPLE|LONG|QUAD
# Default will find the real double precision fftw library version without THREADS|OMP
if( SCALFMM_USE_MKL_AS_FFTW )
if(SCALFMM_USE_MKL_AS_FFTW)
message(STATUS " SCALFMM USE FFT from MKL")
find_package(FFTW COMPONENTS MKL)
set(BLA_VENDOR "Intel10_64lp_seq")
if(NOT TARGET blas::blas)
find_package(FFTW COMPONENTS MKL)
else()
set(FFTW_FOUND 1)
find_package(FFTW COMPONENTS MKL QUIET)
target_include_directories(${CMAKE_PROJECT_NAME} PUBLIC ${FFTW_INCLUDE_DIRS})
endif()
elseif (SCALFMM_USE_ESSL_AS_FFTW)
message(STATUS " SCALFMM USE FFT from ESSL ")
find_package(FFTW COMPONENTS ESSL)
add_definitions(-DSCALFMM_USE_ESSL_AS_FFTW)
else()
message(STATUS " SCALFMM USE FFTW")
find_package(FFTW COMPONENTS SIMPLE)
endif()
if(FFTW_FOUND)
if (FFTW_LIBRARY_DIRS_DEP)
set(FFT_LIBRARIES "-L${FFTW_LIBRARY_DIRS_DEP};" CACHE STRING "Set your MKL flags")
endif()
if (FFTW_LIBRARIES_DEP)
foreach (fft_lib ${FFTW_LIBRARIES_DEP})
set(FFT_LIBRARIES "${FFT_LIBRARIES};${fft_lib};")
endforeach()
endif()
set(FFT_INCLUDES "${FFTW_INCLUDE_DIRS_DEP}" )
if (FFT_LIBRARIES)
set(SCALFMM_LIBRARIES "${SCALFMM_LIBRARIES};${FFT_LIBRARIES}")
endif()
if(FFTW_LIBRARY_DIRS)
# the RPATH to be used when installing
list(APPEND CMAKE_INSTALL_RPATH "${FFTW_LIBRARY_DIRS}")
endif()
if (FFT_INCLUDES)
set(SCALFMM_INCLUDES "${SCALFMM_INCLUDES}; ${FFT_INCLUDES}")
list(APPEND FUSE_LIST FFT)
if(NOT SCALFMM_USE_MKL_AS_FFTW)
target_link_libraries(${CMAKE_PROJECT_NAME} PUBLIC fftw::fftw)
list(APPEND SCALFMM_LIBRARIES FFTW)
endif()
else(FFTW_FOUND)
message(WARNING "FFTW has not been found, SCALFMM will continue to compile but some applications will be disabled.")
......@@ -505,501 +355,279 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/morse_
endif(FFTW_FOUND)
endif(SCALFMM_USE_FFT)
message(STATUS "SCALFMM_USE_FFT = ${SCALFMM_USE_FFT}")
if (SCALFMM_INCLUDES)
list(REMOVE_DUPLICATES SCALFMM_INCLUDES)
endif()
if (SCALFMM_LIBRARIES)
list(REMOVE_DUPLICATES SCALFMM_LIBRARIES)
endif()
list(APPEND FUSE_LIST "FFT")
message(STATUS "SCALFMM_USE_FFT = ${SCALFMM_USE_FFT}")
#
# C++ 2011
message( STATUS "CMAKE_SYSTEM: ${CMAKE_SYSTEM} CMAKE_CXX_COMPILER_ID ${CMAKE_CXX_COMPILER_ID} CMAKE_CXX_COMPILER ${NAME}")
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE INTEL_VERSION)
message( STATUS "Intel: ${INTEL_VERSION}")
set(SCALFMM_CXX_FLAGS "${SCALFMM_CXX_FLAGS} -Wall")
else()
# Compile option valid on GCC/G++