From: David Wells <drwells@email.unc.edu>
Date: Thu, 22 Jun 2023 15:04:20 +0000 (-0400)
Subject: Add a better error message for Cuda + bundled Kokkos.
X-Git-Tag: v9.5.0-rc1~54^2
X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F15435%2Fhead;p=dealii.git

Add a better error message for Cuda + bundled Kokkos.
---

diff --git a/cmake/configure/configure_40_cuda.cmake b/cmake/configure/configure_40_cuda.cmake
index cf08a36dbe..02700de68e 100644
--- a/cmake/configure/configure_40_cuda.cmake
+++ b/cmake/configure/configure_40_cuda.cmake
@@ -23,7 +23,13 @@
 set(DEAL_II_WITH_CUDA FALSE CACHE BOOL "")
 
 macro(feature_cuda_find_external var)
-  if(NOT Kokkos_ENABLE_CUDA)
+  if(DEAL_II_FEATURE_KOKKOS_BUNDLED_CONFIGURED)
+    set(CUDA_ADDITIONAL_ERROR_STRING
+      ${CUDA_ADDITIONAL_ERROR_STRING}
+      "deal.II's bundled version of Kokkos only supports the Serial backend and therefore cannot be used with Cuda."
+      )
+    set(${var} FALSE)
+  elseif(NOT Kokkos_ENABLE_CUDA)
     set(CUDA_ADDITIONAL_ERROR_STRING
       ${CUDA_ADDITIONAL_ERROR_STRING}
       "deal.II can only be compiled with Cuda support if Kokkos was built with Cuda support!"
@@ -113,7 +119,7 @@ macro(feature_cuda_error_message)
   message(FATAL_ERROR "\n"
     "Could not find any suitable cuda library!\n"
     ${CUDA_ADDITIONAL_ERROR_STRING}
-    "\nPlease ensure that a cuda library is installed on your computer\n"
+    "\nPlease ensure that a cuda library is installed on your computer and deal.II is configured to use an external Kokkos installation.\n"
     )
 endmacro()