]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix OpenMP flag for Kokkos >= 4.0.00 14671/head
authorDaniel Arndt <arndtd@ornl.gov>
Wed, 11 Jan 2023 20:03:48 +0000 (20:03 +0000)
committerDaniel Arndt <arndtd@ornl.gov>
Wed, 11 Jan 2023 20:04:29 +0000 (20:04 +0000)
cmake/modules/FindDEAL_II_KOKKOS.cmake

index bbe1f4054dc84213f069d319ff77c035e8fe780c..19a357f4fa05a2468708f95bf3ec4a831f329b11 100644 (file)
@@ -47,6 +47,12 @@ else()
       string(REGEX REPLACE "\\$<\\$<COMPILE_LANGUAGE:CXX>:([^>]*)>" "\\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

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.