Commit d8680972 authored by COULAUD Olivier's avatar COULAUD Olivier

New name for the options now ScalFMM rather SCALFMM, Fix problems on MAcOS and...

New name for the options now ScalFMM rather SCALFMM, Fix problems on MAcOS and improvements in CMakeLists.txt.mine
parent d43f61a0
......@@ -5,16 +5,7 @@ STRING(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" insource)
if(insource)
MESSAGE(FATAL_ERROR "${PROJECT_NAME} requires an out of source build. Goto ./Build and tapes cmake ../")
endif(insource)
# MPI option has to be set before project, cannot be changed in the cache!
if( SCALFMM_USE_MPI )
include(CMakeForceCompiler)
CMAKE_FORCE_C_COMPILER(mpicc "MPI C Compiler")
CMAKE_FORCE_CXX_COMPILER(mpicxx "MPI C++ Compiler")
else()
MESSAGE(STATUS "Remove CMake cache and run cmake .. -DSCALFMM_USE_MPI=ON to enable MPI" )
endif(SCALFMM_USE_MPI)
#
# Project Infos
project(ScalFMM)
#===========================================================================
......@@ -33,33 +24,42 @@ SET(ScalFMM_VERSION "${ScalFMM_MAJOR_VERSION}.${ScalFMM_MINOR_VERSION}.${ScalFM
# -----------------------
ENABLE_LANGUAGE(CXX )
MESSAGE(STATUS " CXX ${CMAKE_CXX_COMPILER_ID}" )
#
# MPI option has to be set before project, cannot be changed in the cache!
if( ScalFMM_USE_MPI )
include(CMakeForceCompiler)
CMAKE_FORCE_C_COMPILER(mpicc "MPI C Compiler")
CMAKE_FORCE_CXX_COMPILER(mpicxx "MPI C++ Compiler")
else()
MESSAGE(STATUS "Remove CMake cache and run cmake .. -DSCALFMM_USE_MPI=ON to enable MPI" )
endif(ScalFMM_USE_MPI)
#
# 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" OFF )
OPTION( SCALFMM_USE_TRACE "Set to ON to print trace or use itac trace" OFF )
OPTION( SCALFMM_BUILD_TESTS "Set to ON to build fonctionnalities Tests" OFF )
OPTION( SCALFMM_BUILD_UTESTS "Set to ON to build UTests" OFF )
OPTION( SCALFMM_BUILD_DEBUG "Set to ON to build in Debug" OFF )
OPTION( SCALFMM_USE_MEM_STATS "Set to ON to profile memory" OFF )
OPTION( SCALFMM_USE_DOUBLE_PRECISION "Set to ON to compile in double precision" ON )
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_SSE "Set to ON to compile with sse support" ON )
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" OFF )
OPTION( ScalFMM_USE_TRACE "Set to ON to print trace or use itac trace" OFF )
OPTION( ScalFMM_BUILD_TESTS "Set to ON to build fonctionnalities Tests" OFF )
OPTION( ScalFMM_BUILD_UTESTS "Set to ON to build UTests" OFF )
OPTION( ScalFMM_BUILD_DEBUG "Set to ON to build in Debug" OFF )
OPTION( ScalFMM_USE_MEM_STATS "Set to ON to profile memory" OFF )
OPTION( ScalFMM_USE_DOUBLE_PRECISION "Set to ON to compile in double precision" ON )
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_SSE "Set to ON to compile with sse support" ON )
#
SET(SCALFMM_LIBRARIES "")
# 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_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}")
endif()
# Debug
MESSAGE( STATUS "SCALFMM_BUILD_DEBUG = ${SCALFMM_BUILD_DEBUG}" )
if( SCALFMM_BUILD_DEBUG )
MESSAGE( STATUS "ScalFMM_BUILD_DEBUG = ${ScalFMM_BUILD_DEBUG}" )
if( ScalfMM_BUILD_DEBUG )
SET(CMAKE_BUILD_TYPE Debug)
ADD_DEFINITIONS(-O0)
else()
......@@ -74,28 +74,28 @@ else()
endif()
# Attach source code to exec
MESSAGE( STATUS "SCALFMM_ATTACHE_SOURCE = ${SCALFMM_ATTACHE_SOURCE}" )
if( SCALFMM_ATTACHE_SOURCE )
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." )
ADD_DEFINITIONS(-g)
endif()
# Trace
MESSAGE( STATUS "SCALFMM_USE_TRACE = ${SCALFMM_USE_TRACE}" )
if( SCALFMM_USE_TRACE )
OPTION( SCALFMM_USE_ITAC "Set to ON to use itac trace" OFF )
if( SCALFMM_USE_ITAC )
MESSAGE( STATUS "ScalFMM_USE_TRACE = ${ScalFMM_USE_TRACE}" )
if( ScalFMM_USE_TRACE )
OPTION( ScalFMM_USE_ITAC "Set to ON to use itac trace" OFF )
if( ScaLFMM_USE_ITAC )
ADD_DEFINITIONS(-I$VT_ROOT/include -trace)
endif()
endif()
# Blas option
if( SCALFMM_USE_BLAS )
OPTION( SCALFMM_USE_MKL_AS_BLAS "Set to ON to use MKL CBLAS" OFF )
if( SCALFMM_USE_MKL_AS_BLAS )
if( ScalFMM_USE_BLAS )
OPTION( ScalFMM_USE_MKL_AS_BLAS "Set to ON to use MKL CBLAS" OFF )
if( ScalFMM_USE_MKL_AS_BLAS )
SET(BLAS_LIBRARIES "-L$ENV{MKLROOT}/lib -lmkl_intel_lp64 -lmkl_sequential -lmkl_core" CACHE STRING "Set your MKL flags")
elseif(SCALFMM_USE_EXTERNAL_BLAS)
MESSAGE(STATUS "BLAS SET BY EXTERNAL PROGRAM = ${BLAS_LIBRARIES}")
elseif(ScalFMM_USE_EXTERNAL_BLAS)
MESSAGE(STATUS "BLAS SET BY EXTERNAL PROGRAM = ${BLAS_LIBRARIES}")
else()
#INCLUDE(FindBLAS)
#INCLUDE(FindLAPACK)
......@@ -112,17 +112,21 @@ CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/Src/ScalFmmConfig.h.cmake
${CMAKE_BINARY_DIR}/Src/ScalFmmConfig.h )
# Compile optimization
SET(SCALFMM_FLAGS_OPTI "-m64 -Ofast -flto -march=native -funroll-loops -ftree-vectorize" CACHE STRING "Set your optimization flags.")
IF( APPLE )
SET(SCALFMM_FLAGS_OPTI "-m64 -Ofast -march=native -funroll-loops -ftree-vectorize" CACHE STRING "Set your optimization flags.")
ELSE()
SET(SCALFMM_FLAGS_OPTI "-m64 -Ofast -flto -march=native -funroll-loops -ftree-vectorize" CACHE STRING "Set your optimization flags.")
ENDIF()
ADD_DEFINITIONS(${SCALFMM_FLAGS_OPTI})
# Use SSE
MESSAGE( STATUS "SCALFMM_USE_SSE = ${SCALFMM_USE_SSE}" )
if( SCALFMM_USE_SSE )
MESSAGE( STATUS "ScalFMM_USE_SSE = ${ScalFMM_USE_SSE}" )
if( ScalFMM_USE_SSE )
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse -msse2 -msse3 -mfpmath=sse")
endif()
# Use Mem stats
MESSAGE( STATUS "SCALFMM_USE_MEM_STATS = ${SCALFMM_USE_MEM_STATS}" )
MESSAGE( STATUS "ScalFMM_USE_MEM_STATS = ${ScalFMM_USE_MEM_STATS}" )
# Add CBLAS
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CBLAS_LIBRARIES}")
......@@ -134,14 +138,14 @@ add_subdirectory(Src)
set(scalfmm_lib scalfmm)
# Build - Tests
MESSAGE( STATUS "SCALFMM_BUILD_TESTS = ${SCALFMM_BUILD_TESTS}" )
if( SCALFMM_BUILD_TESTS )
MESSAGE( STATUS "ScalFMM_BUILD_TESTS = ${ScalFMM_BUILD_TESTS}" )
if( ScalFMM_BUILD_TESTS )
add_subdirectory(Tests)
endif()
# Build - UTests
MESSAGE( STATUS "SCALFMM_BUILD_UTESTS = ${SCALFMM_BUILD_UTESTS}" )
if( SCALFMM_BUILD_UTESTS )
MESSAGE( STATUS "ScalFMM_BUILD_UTESTS = ${ScalFMM_BUILD_UTESTS}" )
if( ScalFMM_BUILD_UTESTS )
ENABLE_TESTING()
add_subdirectory(UTests)
endif()
......@@ -150,7 +154,7 @@ endif()
add_subdirectory(Doc)
# Build - Addons
if( SCALFMM_USE_ADDONS )
if( ScalFMM_USE_ADDONS )
file(GLOB all_addons ./Addons/*)
foreach(addon_name ${all_addons})
......@@ -173,7 +177,7 @@ endif()
# Build and export cmake files
#===========================================================================
#
MESSAGE(STATUS "ScalFMM_BINARY_DIR: "${Scalfmm_BINARY_DIR})
MESSAGE(STATUS "ScalFMM_BINARY_DIR: " ${ScalFMM_BINARY_DIR})
CONFIGURE_FILE(${ScalFMM_SOURCE_DIR}/ScalFMMConfig.cmake.in
${ScalFMM_BINARY_DIR}/ScalFMMConfig.cmake
@ONLY IMMEDIATE
......
......@@ -25,16 +25,26 @@ SET(ScalFMM_BUILD_TYPE "@CMAKE_BUILD_TYPE@")
#
# ScalFMM Options
#
SET(ScalFMM_USE_MPI "@SCALFMM_USE_MPI@")
SET(ScalFMM_USE_BLAS "@SCALFMM_USE_BLAS@")
SET(ScalFMM_USE_MKL "@SCALFMM_USE_MKL_AS_BLAS@")
SET(ScalFMM_USE_DOUBLE_PRECISION "@SCALFMM_USE_DOUBLE_PRECISION@")
SET(ScalFMM_USE_MEM_STATS "@SCALFMM_USE_MEM_STATS@")
#
#
#
SET(ScalFMM_LIBRARIES -L${ScalFMM_LIBRARIES_DIR} -l${ScalFMM_LIBRARY_NAME} ${ScalFMM_LIBRARIES_ADD} )
SET(ScalFMM_INCLUDE_DIRS ${ScalFMM_INCLUDE_DIR}
SET(ScalFMM_USE_MPI "@ScalFMM_USE_MPI@")
SET(ScalFMM_USE_BLAS "@ScaLFMM_USE_BLAS@")
SET(ScalFMM_USE_MKL "@ScalFMM_USE_MKL_AS_BLAS@")
SET(ScalFMM_USE_DOUBLE_PRECISION "@ScalFMM_USE_DOUBLE_PRECISION@")
SET(ScalFMM_USE_MEM_STATS "@ScalFMM_USE_MEM_STATS@")
SET(ScalFMM_USE_SSE "@ScalFMM_USE_SSE@")
SET(ScalFMM_FLAGS "@ScaLFMM_FLAGS_OPTI@")
SET(ScalFMM_USE_ADDONS "@ScalFMM_USE_ADDONS@")
#SET(ScalFMM_FLAGS "@@")
#SET(ScalFMM_FLAGS "@@")
#SET(ScalFMM_FLAGS "@@")
#
#
IF(ScalFMM_USE_ADDONS)
SET(ScalFMM_LIBRARIES "-L${ScalFMM_LIBRARIES_DIR} -l${ScalFMM_LIBRARY_NAME} ${ScalFMM_LIBRARIES_ADD}" )
ELSE()
SET(ScalFMM_LIBRARIES "-L${ScalFMM_LIBRARIES_DIR} -l${ScalFMM_LIBRARY_NAME}" )
ENDIF()
SET(ScalFMM_INCLUDE_DIRS ${ScalFMM_INCLUDE_DIR}
${ScalFMM_INCLUDE_DIR}/Utils
${ScalFMM_INCLUDE_DIR}/Components
${ScalFMM_INCLUDE_DIR}/Arranger
......
......@@ -32,6 +32,7 @@ target_link_libraries(
# Adding the entire project dir as an include dir
INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/Src
${CMAKE_BINARY_DIR}/Src
)
......
......@@ -17,8 +17,8 @@
#define FBASICPARTICLECONTAINER_HPP
#include "FAbstractParticleContainer.hpp"
#include "FMath.hpp"
#include "FPoint.hpp"
#include "../Utils/FMath.hpp"
#include "../Utils/FPoint.hpp"
#include <type_traits>
/**
......@@ -105,7 +105,7 @@ public:
* @brief getPositions
* @return a FReal*[3] to get access to the positions
*/
const FReal* getPositions() const {
const FReal*const* getPositions() const {
return positions;
}
......
......@@ -127,7 +127,7 @@ public:
}
FReal getEnergy() const{
return 0.0;
return static_cast<FReal>(0.0);
}
/**
......@@ -272,11 +272,11 @@ public:
* @return box width
*/
FReal getBoxWidth() const{
return this->boxWidth;
return static_cast<FReal>(this->boxWidth);
}
FReal getEnergy() const{
return this->energy;
return static_cast<FReal>(this->energy);
}
/**
......@@ -307,11 +307,11 @@ public:
removeWarning = fread(&size, sizeof(int), 1, file);
if(size != 60) printf("Error in loader ewal Size %d should be %d\n", size, 60);
inPosition->setPosition( x, y ,z);
inForces[0] = fx;
inForces[1] = fy;
inForces[2] = fz;
*inPhysicalValue = charge;
inPosition->setPosition( static_cast<FReal>(x), static_cast<FReal>(y) ,static_cast<FReal>(z));
inForces[0] = static_cast<FReal>(fx);
inForces[1] = static_cast<FReal>(fy);
inForces[2] = static_cast<FReal>(fz);
*inPhysicalValue = static_cast<FReal>(charge);
*inIndex = index;
}
......
......@@ -15,34 +15,34 @@
// Blas
///////////////////////////////////////////////////////
#cmakedefine SCALFMM_USE_BLAS
#cmakedefine SCALFMM_USE_MKL_AS_BLAS
#cmakedefine ScalFMM_USE_BLAS
#cmakedefine ScalFMM_USE_MKL_AS_BLAS
///////////////////////////////////////////////////////
// MPI
///////////////////////////////////////////////////////
#cmakedefine SCALFMM_USE_MPI
#cmakedefine ScalFMM_USE_MPI
///////////////////////////////////////////////////////
// Trace & Itac
///////////////////////////////////////////////////////
#cmakedefine SCALFMM_USE_TRACE
#cmakedefine SCALFMM_USE_ITAC
#cmakedefine SCALFMM_USE_EZTRACE
#cmakedefine ScalFMM_USE_TRACE
#cmakedefine ScalFMM_USE_ITAC
#cmakedefine ScalFMM_USE_EZTRACE
///////////////////////////////////////////////////////
// Memory trace
///////////////////////////////////////////////////////
#cmakedefine SCALFMM_USE_MEM_STATS
#cmakedefine ScalFMM_USE_MEM_STATS
///////////////////////////////////////////////////////
// Double precision
///////////////////////////////////////////////////////
#cmakedefine SCALFMM_USE_DOUBLE_PRECISION
#cmakedefine ScalFMM_USE_DOUBLE_PRECISION
///////////////////////////////////////////////////////
// CUDA
......@@ -60,6 +60,6 @@
// SSE
///////////////////////////////////////////////////////
#cmakedefine SCALFMM_USE_SSE
#cmakedefine ScalFMM_USE_SSE
#endif // CONFIG_H
......@@ -51,7 +51,7 @@
// Types
///////////////////////////////////////////////////////
#ifdef SCALFMM_USE_DOUBLE_PRECISION
#ifdef ScalFMM_USE_DOUBLE_PRECISION
typedef double FReal;
#else
typedef float FReal;
......@@ -88,11 +88,11 @@ typedef long long MortonIndex;
///////////////////////////////////////////////////////
#ifdef __GNUC__
#define Prefetch_Read(X) __builtin_prefetch(X)
#define Prefetch_Read(X) __builtin_prefetch(X)
#define Prefetch_Write(X) __builtin_prefetch(X,1,1)
#else
#ifdef __INTEL_COMPILER
#define Prefetch_Read(X) _mm_prefetch(X,_MM_HINT_T0)
#define Prefetch_Read(X) _mm_prefetch(X,_MM_HINT_T0)
#define Prefetch_Write(X) _mm_prefetch(X,_MM_HINT_T0)
#else
#warning compiler is not defined
......
......@@ -33,7 +33,7 @@ foreach(exec ${source_tests_files})
# Test Blas dependency
file(STRINGS "${exec}" lines_blas REGEX "@FUSE_BLAS")
if(lines_blas)
if( NOT SCALFMM_USE_BLAS )
if( NOT ScalFMM_USE_BLAS )
MESSAGE( STATUS "This needs BLAS = ${exec}" )
set(compile_exec "FALSE")
endif()
......@@ -42,7 +42,7 @@ foreach(exec ${source_tests_files})
# Test MPI dependency
file(STRINGS "${exec}" lines_mpi REGEX "@FUSE_MPI")
if(lines_mpi)
if( NOT SCALFMM_USE_MPI )
if( NOT ScalFMM_USE_MPI )
MESSAGE( STATUS "This needs MPI = ${exec}" )
set(compile_exec "FALSE")
endif()
......
......@@ -31,7 +31,7 @@ foreach(exec ${source_tests_files})
# Test Blas dependency
file(STRINGS "${exec}" lines_blas REGEX "@FUSE_BLAS")
if(lines_blas)
if( NOT SCALFMM_USE_BLAS )
if( NOT ScalFMM_USE_BLAS )
MESSAGE( STATUS "This needs BLAS = ${exec}" )
set(compile_exec "FALSE")
endif()
......@@ -40,7 +40,7 @@ foreach(exec ${source_tests_files})
# Test MPI dependency
file(STRINGS "${exec}" lines_mpi REGEX "@FUSE_MPI")
if(lines_mpi)
if( NOT SCALFMM_USE_MPI )
if( NOT ScalFMM_USE_MPI )
MESSAGE( STATUS "This needs MPI = ${exec}" )
set(compile_exec "FALSE")
endif()
......
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