From: Daniel Arndt Date: Wed, 11 Jan 2023 20:03:48 +0000 (+0000) Subject: Fix OpenMP flag for Kokkos >= 4.0.00 X-Git-Tag: v9.5.0-rc1~652^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F14671%2Fhead;p=dealii.git Fix OpenMP flag for Kokkos >= 4.0.00 --- 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