Skip to content
Snippets Groups Projects
Commit 8cd9cd77 authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Add simple CMake instructions for MPI configuration and compilation

parent 76999127
No related branches found
No related tags found
1 merge request!11Feature/mpi
...@@ -73,6 +73,26 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") ...@@ -73,6 +73,26 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(PASTIS_CXX_FLAGS "${PASTIS_CXX_FLAGS} -Wsign-compare -Wunused -Wunused-member-function -Wunused-private-field") set(PASTIS_CXX_FLAGS "${PASTIS_CXX_FLAGS} -Wsign-compare -Wunused -Wunused-member-function -Wunused-private-field")
endif() endif()
#------------------------------------------------------
# defaults use of MPI
set(PASTIS_ENABLE_MPI AUTO CACHE STRING
"Choose one of: AUTO ON OFF")
if (NOT PASTIS_ENABLE_MPI MATCHES "^(AUTO|ON|OFF)$")
message(FATAL_ERROR "PASTIS_ENABLE_MPI='${PASTIS_ENABLE_MPI}'. Must be set to one of AUTO, ON or OFF")
endif()
# checks for MPI
if (PASTIS_ENABLE_MPI MATCHES "^(AUTO|ON)$")
find_package(MPI)
endif()
if (${MPI_FOUND})
set(PASTIS_CXX_FLAGS "${PASTIS_CXX_FLAGS} ${MPI_CXX_COMPILER_FLAGS}")
include_directories(${MPI_CXX_INCLUDE_DIRS})
elseif(PASTIS_ENABLE_MPI STREQUAL "ON")
message(FATAL_ERROR "Could not find MPI library while requested")
endif()
#------------------------------------------------------ #------------------------------------------------------
...@@ -88,13 +108,13 @@ set(KOKKOS_ENABLE_EXPLICIT_INSTANTIATION OFF CACHE BOOL "") ...@@ -88,13 +108,13 @@ set(KOKKOS_ENABLE_EXPLICIT_INSTANTIATION OFF CACHE BOOL "")
# do not use Kokkos deprecated code # do not use Kokkos deprecated code
set(KOKKOS_ENABLE_DEPRECATED_CODE OFF CACHE BOOL "") set(KOKKOS_ENABLE_DEPRECATED_CODE OFF CACHE BOOL "")
# Kokkso compiler flags # Kokkos compiler flags
add_subdirectory(${PASTIS_SOURCE_DIR}/packages/kokkos) add_subdirectory(${PASTIS_SOURCE_DIR}/packages/kokkos)
include_directories(${Kokkos_INCLUDE_DIRS_RET}) include_directories(${Kokkos_INCLUDE_DIRS_RET})
include(GetKokkosCompilerFlags) include(GetKokkosCompilerFlags)
# sets Kokkos debug flags when non release build # sets Kokkos debug flags when non release build
if (CMAKE_BUILD_TYPE MATCHES "Release") if (CMAKE_BUILD_TYPE MATCHES "^Release$")
set (KOKKOS_ENABLE_DEBUG OFF) set (KOKKOS_ENABLE_DEBUG OFF)
else() else()
set (KOKKOS_ENABLE_DEBUG ON) set (KOKKOS_ENABLE_DEBUG ON)
...@@ -212,5 +232,6 @@ add_executable( ...@@ -212,5 +232,6 @@ add_executable(
target_link_libraries( target_link_libraries(
pastis pastis
kokkos kokkos
${MPI_CXX_LINK_FLAGS} ${MPI_CXX_LIBRARIES}
PastisUtils PastisUtils
PastisMesh) PastisMesh)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment