Skip to content
Snippets Groups Projects
Commit a2938487 authored by Timo Koch's avatar Timo Koch
Browse files

[cmake][parallel] Make Dumux find and link against OpenMP, Kokkos and TBB

parent 468e26f5
1 merge request!2909Feature/multithreaded assembly using a coloring scheme
...@@ -17,6 +17,7 @@ find_package(dune-common) ...@@ -17,6 +17,7 @@ find_package(dune-common)
list(APPEND CMAKE_MODULE_PATH ${dune-common_MODULE_PATH} list(APPEND CMAKE_MODULE_PATH ${dune-common_MODULE_PATH}
"${PROJECT_SOURCE_DIR}/cmake/modules") "${PROJECT_SOURCE_DIR}/cmake/modules")
#include the dune macros #include the dune macros
include(DuneMacros) include(DuneMacros)
......
include_guard(GLOBAL)
# set variable for config.h
set(HAVE_KOKKOS ${Kokkos_FOUND})
# perform DUNE-specific setup tasks
if (Kokkos_FOUND)
dune_register_package_flags(
COMPILE_DEFINITIONS ENABLE_KOKKOS=1
LIBRARIES Kokkos::kokkos
)
endif()
include_guard(GLOBAL)
# set variable for config.h
set(HAVE_OPENMP ${OpenMP_FOUND})
# perform DUNE-specific setup tasks
if (OpenMP_FOUND)
dune_register_package_flags(
COMPILE_DEFINITIONS ENABLE_OPENMP=1
LIBRARIES OpenMP::OpenMP_CXX
)
endif()
...@@ -13,3 +13,32 @@ find_package(NLOPT QUIET) ...@@ -13,3 +13,32 @@ find_package(NLOPT QUIET)
find_package(PTScotch QUIET) find_package(PTScotch QUIET)
include(AddPTScotchFlags) include(AddPTScotchFlags)
find_package(PVPython QUIET) find_package(PVPython QUIET)
find_package(Kokkos QUIET)
include(AddKokkosFlags)
# possibly link against TBB
# even if an older version is found
# otherwise we get linker errors
# beacuse of inconsistencies with
# dune-common's TBB setup
find_package(TBB)
include(AddTBBFlags)
# in a second step make sure the
# minimum TBB version required is found
set(DUMUX_MIN_TBB_VERSION 2021)
if(TBB_FOUND)
if(TBB_VERSION_MAJOR VERSION_LESS DUMUX_MIN_TBB_VERSION)
find_package(TBB ${DUMUX_MIN_TBB_VERSION})
# disable TBB manually if required version not found
if(NOT TBB_FOUND)
message(STATUS "Disabling TBB since version requirement not satisfied (>= ${DUMUX_MIN_TBB_VERSION}).")
set(ENABLE_TBB FALSE)
set(HAVE_TBB FALSE)
endif()
endif()
endif()
find_package(OpenMP QUIET)
include(AddOpenMPFlags)
...@@ -70,6 +70,12 @@ ...@@ -70,6 +70,12 @@
/* Define to 1 if quadmath was found */ /* Define to 1 if quadmath was found */
#cmakedefine HAVE_QUAD 1 #cmakedefine HAVE_QUAD 1
/* Set if Kokkos was found */
#cmakedefine HAVE_KOKKOS ENABLE_KOKKOS
/* Set if OpenMP was found */
#cmakedefine HAVE_OPENMP ENABLE_OPENMP
/* end dumux /* end dumux
Everything below here will be overwritten Everything below here will be overwritten
*/ */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment