#
# Check for modules.
#
- FOREACH(_optional_module EpetraExt MueLu ROL Sacado SEACAS Tpetra Zoltan)
+ FOREACH(_optional_module EpetraExt Kokkos MueLu ROL Sacado SEACAS Tpetra Zoltan)
ITEM_MATCHES(_module_found ${_optional_module} ${Trilinos_PACKAGE_LIST})
IF(_module_found)
MESSAGE(STATUS "Found ${_optional_module}")
ENDFOREACH()
ENDIF()
- IF(DEAL_II_TRILINOS_WITH_TPETRA)
- #
- # Check if Tpetra is usable in fact.
- #
- LIST(APPEND CMAKE_REQUIRED_INCLUDES ${Trilinos_INCLUDE_DIRS})
- LIST(APPEND CMAKE_REQUIRED_INCLUDES ${MPI_CXX_INCLUDE_PATH})
-
+ IF(DEAL_II_TRILINOS_WITH_KOKKOS)
CHECK_SYMBOL_EXISTS(
"KOKKOS_ENABLE_CUDA_LAMBDA"
"Kokkos_Macros.hpp"
ADD_FLAGS(CMAKE_REQUIRED_FLAGS "--expt-extended-lambda")
ENDIF()
+ # We need a recent version of Trilinos to use kokkos_check. We want to use
+ # VERSION_GREATER_EQUAL 13.0 but this requires CMake 3.7
+ IF(TRILINOS_VERSION VERSION_GREATER 12.99)
+ SET(KOKKOS_WITH_OPENMP "")
+ kokkos_check(DEVICES OpenMP RETURN_VALUE KOKKOS_WITH_OPENMP)
+ IF(KOKKOS_WITH_OPENMP)
+ FIND_PACKAGE(OpenMP REQUIRED)
+ ADD_FLAGS(DEAL_II_CXX_FLAGS "${OpenMP_CXX_FLAGS}")
+ ADD_FLAGS(DEAL_II_LINKER_FLAGS "${OpenMP_CXX_FLAGS}")
+ ENDIF()
+ ENDIF()
+ ENDIF()
+
+ IF(DEAL_II_TRILINOS_WITH_TPETRA)
+ #
+ # Check if Tpetra is usable in fact.
+ #
+ LIST(APPEND CMAKE_REQUIRED_INCLUDES ${Trilinos_INCLUDE_DIRS})
+ LIST(APPEND CMAKE_REQUIRED_INCLUDES ${MPI_CXX_INCLUDE_PATH})
+
+
LIST(APPEND CMAKE_REQUIRED_LIBRARIES ${Trilinos_LIBRARIES} ${MPI_LIBRARIES})
CHECK_CXX_SOURCE_COMPILES(
--- /dev/null
+## ---------------------------------------------------------------------
+##
+## Copyright (C) 2021 by the deal.II authors
+##
+## This file is part of the deal.II library.
+##
+## The deal.II library is free software; you can use it, redistribute
+## it, and/or modify it under the terms of the GNU Lesser General
+## Public License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+## The full text of the license can be found in the file LICENSE.md at
+## the top level directory of deal.II.
+##
+## ---------------------------------------------------------------------
+
+#
+# Configuration for Kokkos support in deal.II:
+#
+
+CONFIGURE_FEATURE(KOKKOS)
--- /dev/null
+## ---------------------------------------------------------------------
+##
+## Copyright (C) 2021 by the deal.II authors
+##
+## This file is part of the deal.II library.
+##
+## The deal.II library is free software; you can use it, redistribute
+## it, and/or modify it under the terms of the GNU Lesser General
+## Public License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+## The full text of the license can be found in the file LICENSE.md at
+## the top level directory of deal.II.
+##
+## ---------------------------------------------------------------------
+
+#
+# Configuration for ArborX support in deal.II:
+#
+
+SET(FEATURE_ARBORX_DEPENDS KOKKOS)
+
+CONFIGURE_FEATURE(ARBORX)
--- /dev/null
+## ---------------------------------------------------------------------
+##
+## Copyright (C) 2021 by the deal.II authors
+##
+## This file is part of the deal.II library.
+##
+## The deal.II library is free software; you can use it, redistribute
+## it, and/or modify it under the terms of the GNU Lesser General
+## Public License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+## The full text of the license can be found in the file LICENSE.md at
+## the top level directory of deal.II.
+##
+## ---------------------------------------------------------------------
+
+#
+# Try to find the ArborX library
+#
+# This module exports
+#
+# ARBORX_INCLUDE_DIRS
+# ARBORX_INTERFACE_LINK_FLAGS
+#
+
+SET(ARBORX_DIR "" CACHE PATH "An optional hint to an ArborX installation")
+SET_IF_EMPTY(ARBORX_DIR "$ENV{ARBORX_DIR}")
+
+
+FIND_PACKAGE(ArborX
+ HINTS ${ARBORX_DIR} ${ArborX_DIR} $ENV{ArborX_DIR}
+ )
+
+SET(_libraries "")
+
+IF(ArborX_FOUND)
+ GET_PROPERTY(ARBORX_INSTALL_INCLUDE_DIR TARGET ArborX::ArborX PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
+ENDIF()
+
+DEAL_II_PACKAGE_HANDLE(ARBORX
+ LIBRARIES REQUIRED ${_libraries}
+ INCLUDE_DIRS REQUIRED ARBORX_INSTALL_INCLUDE_DIR
+ USER_INCLUDE_DIRS REQUIRED ARBORX_INSTALL_INCLUDE_DIR
+ CLEAR ARBORX_DIR ${_libraries}
+ )
--- /dev/null
+## ---------------------------------------------------------------------
+##
+## Copyright (C) 2021 by the deal.II authors
+##
+## This file is part of the deal.II library.
+##
+## The deal.II library is free software; you can use it, redistribute
+## it, and/or modify it under the terms of the GNU Lesser General
+## Public License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+## The full text of the license can be found in the file LICENSE.md at
+## the top level directory of deal.II.
+##
+## ---------------------------------------------------------------------
+
+#
+# Try to find the Kokkos library
+#
+# This module exports
+#
+# KOKKOS_INCLUDE_DIRS
+# KOKKOS_INTERFACE_LINK_FLAGS
+#
+
+SET(KOKKOS_DIR "" CACHE PATH "An optional hint to a Kokkos installation")
+SET_IF_EMPTY(KOKKOS_DIR "$ENV{KOKKOS_DIR}")
+
+
+IF(DEAL_II_TRILINOS_WITH_KOKKOS)
+ # Let ArborX know that we have found Kokkos
+ SET(Kokkos_FOUND ON)
+ # Let deal.II know that we have found Kokkos
+ SET(KOKKOS_FOUND ON)
+ELSE()
+ FIND_PACKAGE(Kokkos
+ HINTS ${KOKKOS_DIR} ${Kokkos_DIR} $ENV{Kokkos_DIR}
+ )
+
+ IF(Kokkos_FOUND)
+ # We are only interested in Kokkos if it is not part of Trilinos
+ IF(TARGET Kokkos::kokkos)
+ GET_PROPERTY(KOKKOS_INSTALL_INCLUDE_DIR TARGET Kokkos::kokkos PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
+ GET_PROPERTY(KOKKOS_EXTRA_LD_FLAGS_FULL TARGET Kokkos::kokkoscore PROPERTY INTERFACE_LINK_OPTIONS)
+ STRING(REGEX REPLACE "\\$<\\$<LINK_LANGUAGE:CXX>:([^>]*)>" "\\1" KOKKOS_EXTRA_LD_FLAGS "${KOKKOS_EXTRA_LD_FLAGS_FULL}")
+ GET_PROPERTY(KOKKOS_COMPILE_FLAGS_FULL TARGET Kokkos::kokkoscore PROPERTY INTERFACE_COMPILE_OPTIONS)
+ STRING(REGEX REPLACE "\\$<\\$<COMPILE_LANGUAGE:CXX>:([^>]*)>" "\\1" KOKKOS_COMPILE_FLAGS "${KOKKOS_COMPILE_FLAGS_FULL}")
+ # In serial the flag is empty but ADD_FLAGS does not support adding an empty
+ # flag
+ IF(KOKKOS_COMPILE_FLAGS)
+ ADD_FLAGS(DEAL_II_CXX_FLAGS ${KOKKOS_COMPILE_FLAGS})
+ ENDIF()
+
+ DEAL_II_FIND_LIBRARY(KOKKOS_CORE_LIBRARY
+ NAMES kokkoscore
+ HINTS ${KOKKOS_DIR}/lib ${Kokkos_DIR}/lib $ENV{Kokkos_DIR}/lib
+ PATH_SUFFIXES
+ lib${LIB_SUFFIX} lib64 lib
+ )
+
+ DEAL_II_FIND_LIBRARY(KOKKOS_CONTAINERS_LIBRARY
+ NAMES kokkoscontainers
+ HINTS ${KOKKOS_DIR}/lib ${Kokkos_DIR}/lib $ENV{Kokkos_DIR}/lib
+ PATH_SUFFIXES
+ lib${LIB_SUFFIX} lib64 lib
+ )
+ ELSE()
+ SET(Kokkos_FOUND FALSE)
+ ENDIF()
+ ENDIF()
+
+ DEAL_II_PACKAGE_HANDLE(KOKKOS
+ LIBRARIES REQUIRED KOKKOS_CORE_LIBRARY KOKKOS_CONTAINERS_LIBRARY
+ INCLUDE_DIRS REQUIRED KOKKOS_INSTALL_INCLUDE_DIR
+ USER_INCLUDE_DIRS REQUIRED KOKKOS_INSTALL_INCLUDE_DIR
+ LINKER_FLAGS OPTIONAL KOKKOS_EXTRA_LD_FLAGS
+ CLEAR KOKKOS_DIR KOKKOS_CORE_LIBRARY KOKKOS_CONTAINERS_LIBRARY
+ )
+
+ENDIF()
#cmakedefine DEAL_II_WITH_64BIT_INDICES
#cmakedefine DEAL_II_WITH_ADOLC
#cmakedefine DEAL_II_WITH_ARPACK
+#cmakedefine DEAL_II_WITH_ARBORX
#cmakedefine DEAL_II_WITH_ASSIMP
#cmakedefine DEAL_II_WITH_COMPLEX_VALUES
#cmakedefine DEAL_II_WITH_CUDA
#cmakedefine DEAL_II_WITH_GSL
#cmakedefine DEAL_II_WITH_GMSH
#cmakedefine DEAL_II_WITH_HDF5
+#cmakedefine DEAL_II_WITH_KOKKOS
#cmakedefine DEAL_II_WITH_LAPACK
#cmakedefine LAPACK_WITH_64BIT_BLAS_INDICES
#cmakedefine DEAL_II_LAPACK_WITH_MKL