ENDIF()
IF(DEAL_II_TRILINOS_WITH_KOKKOS)
+ CHECK_SYMBOL_EXISTS(
+ "KOKKOS_ENABLE_CUDA"
+ "Kokkos_Macros.hpp"
+ DEAL_II_KOKKOS_CUDA_EXISTS
+ )
+ IF(DEAL_II_KOKKOS_CUDA_EXISTS)
+ # We need to disable SIMD vectorization for CUDA device code.
+ # Otherwise, nvcc compilers from version 9 on will emit an error message like:
+ # "[...] contains a vector, which is not supported in device code". We
+ # would like to set the variable in check_01_cpu_feature but at that point
+ # we don't know if CUDA support is enabled in Kokkos
+ SET(DEAL_II_VECTORIZATION_WIDTH_IN_BITS 0)
+ ENDIF()
+
CHECK_SYMBOL_EXISTS(
"KOKKOS_ENABLE_CUDA_LAMBDA"
"Kokkos_Macros.hpp"
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})
+
+ # We need to disable SIMD vectorization for CUDA device code.
+ # Otherwise, nvcc compilers from version 9 on will emit an error message like:
+ # "[...] contains a vector, which is not supported in device code". We
+ # would like to set the variable in check_01_cpu_feature but at that point
+ # we don't know if CUDA support is enabled in Kokkos
+ IF(Kokkos_ENABLE_CUDA)
+ SET(DEAL_II_VECTORIZATION_WIDTH_IN_BITS 0)
+ IF(DEAL_II_WITH_KOKKOS_BACKEND)
+ # Require lambda support to use Kokkos as a backend
+ KOKKOS_CHECK(OPTIONS CUDA_LAMBDA)
+ ENDIF()
ENDIF()
DEAL_II_FIND_LIBRARY(KOKKOS_CORE_LIBRARY
LIBRARIES REQUIRED KOKKOS_CORE_LIBRARY KOKKOS_CONTAINERS_LIBRARY
INCLUDE_DIRS REQUIRED KOKKOS_INSTALL_INCLUDE_DIR
USER_INCLUDE_DIRS REQUIRED KOKKOS_INSTALL_INCLUDE_DIR
+ CXX_FLAGS OPTIONAL KOKKOS_COMPILE_FLAGS
LINKER_FLAGS OPTIONAL KOKKOS_EXTRA_LD_FLAGS
CLEAR KOKKOS_DIR KOKKOS_CORE_LIBRARY KOKKOS_CONTAINERS_LIBRARY
)