From f96f1f919ab9b59b169ceefdae76b66324b937c9 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Wed, 11 Jan 2023 20:03:48 +0000 Subject: [PATCH] Fix OpenMP flag for Kokkos >= 4.0.00 --- cmake/modules/FindDEAL_II_KOKKOS.cmake | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmake/modules/FindDEAL_II_KOKKOS.cmake b/cmake/modules/FindDEAL_II_KOKKOS.cmake index bbe1f4054d..19a357f4fa 100644 --- a/cmake/modules/FindDEAL_II_KOKKOS.cmake +++ b/cmake/modules/FindDEAL_II_KOKKOS.cmake @@ -47,6 +47,12 @@ else() string(REGEX REPLACE "\\$<\\$:([^>]*)>" "\\1" KOKKOS_COMPILE_FLAGS "${KOKKOS_COMPILE_FLAGS_FULL}") string(REPLACE ";" " " KOKKOS_COMPILE_FLAGS "${KOKKOS_COMPILE_FLAGS}") + # Kokkos links transitively with OpenMP so that we need to find OpenMP again. + # Since we are not using target_link_libraries, we have to extract the compile flag manually. + if(Kokkos_VERSION VERSION_GREATER_EQUAL 4.0.00 AND Kokkos_ENABLE_OPENMP) + string(APPEND KOKKOS_COMPILE_FLAGS " ${OpenMP_CXX_FLAGS}") + endif() + # 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 -- 2.39.5