]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Wrap Kokkos::abort 14753/head
authorDaniel Arndt <arndtd@ornl.gov>
Thu, 2 Feb 2023 20:57:44 +0000 (15:57 -0500)
committerDaniel Arndt <arndtd@ornl.gov>
Thu, 2 Feb 2023 21:59:26 +0000 (21:59 +0000)
include/deal.II/base/exceptions.h
include/deal.II/base/kokkos.h
include/deal.II/base/tensor.h
source/base/kokkos.cc

index af4fe88c84c9354a01b3f4c9a41ccdad976447a2..71c7889bd7f9007dc72ffb9983510dfdf15c904a 100644 (file)
@@ -18,6 +18,8 @@
 
 #include <deal.II/base/config.h>
 
+#include <deal.II/base/kokkos.h>
+
 #include <exception>
 #include <ostream>
 #include <string>
 #  include <cusparse.h>
 #endif
 
-DEAL_II_DISABLE_EXTRA_DIAGNOSTICS
-#include <Kokkos_Core.hpp>
-DEAL_II_ENABLE_EXTRA_DIAGNOSTICS
-
 DEAL_II_NAMESPACE_OPEN
 
 
@@ -1526,7 +1524,7 @@ namespace deal_II_exceptions
           }))                                                                \
           KOKKOS_IF_ON_DEVICE(({                                             \
             if (!(cond))                                                     \
-              Kokkos::abort(#cond);                                          \
+              dealii::internal::kokkos_abort(#cond);                         \
           }))                                                                \
         }
 #    else /*ifdef DEAL_II_HAVE_BUILTIN_EXPECT*/
@@ -1546,7 +1544,7 @@ namespace deal_II_exceptions
           }))                                                                \
           KOKKOS_IF_ON_DEVICE(({                                             \
             if (!(cond))                                                     \
-              Kokkos::abort(#cond);                                          \
+              dealii::internal::kokkos_abort(#cond);                         \
           }))                                                                \
         }
 #    endif /*ifdef DEAL_II_HAVE_BUILTIN_EXPECT*/
@@ -1582,10 +1580,10 @@ namespace deal_II_exceptions
           }
 #      endif /*ifdef DEAL_II_HAVE_BUILTIN_EXPECT*/
 #    else    /*#ifdef KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST*/
-#      define Assert(cond, exc)   \
-        {                         \
-          if (!(cond))            \
-            Kokkos::abort(#cond); \
+#      define Assert(cond, exc)                    \
+        {                                          \
+          if (!(cond))                             \
+            dealii::internal::kokkos_abort(#cond); \
         }
 #    endif /*ifdef KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST*/
 #  endif   /*KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST*/
index a070b3338135da0aa9de2bc2085de109530ef715..29023986c0365c2880f459a74457601c48ed3c62 100644 (file)
@@ -33,6 +33,14 @@ namespace internal
    */
   void
   ensure_kokkos_initialized();
+
+  /**
+   * Calls Kokkos::abort. This wrapper avoids including Kokkos_Core.hpp, which
+   * provides all of Kokkos' functionalities, on the call side.
+   */
+  KOKKOS_FUNCTION void
+  kokkos_abort(const char *error);
+
 } // namespace internal
 
 DEAL_II_NAMESPACE_CLOSE
index edc17553f042fb7b8c24777abb549bf02bc5dbca..1dc1dd9a128c929303676fb37c0bbf88f553f086 100644 (file)
@@ -19,6 +19,7 @@
 #include <deal.II/base/config.h>
 
 #include <deal.II/base/exceptions.h>
+#include <deal.II/base/kokkos.h>
 #include <deal.II/base/numbers.h>
 #include <deal.II/base/table_indices.h>
 #include <deal.II/base/template_constraints.h>
@@ -1165,7 +1166,7 @@ namespace internal
       KOKKOS_IF_ON_DEVICE(({
         (void)val;
         (void)s;
-        Kokkos::abort(
+        dealii::internal::kokkos_abort(
           "This function is not implemented for std::complex<Number>!\n");
       }))
 #  else
@@ -1174,7 +1175,7 @@ namespace internal
 #    else
       (void)val;
       (void)s;
-      Kokkos::abort(
+      dealii::internal::kokkos_abort(
         "This function is not implemented for std::complex<Number>!\n");
 #    endif
 #  endif
index 5ea3b374c15a86b7fb3a1d115402be89e7d36e23..417efa5decee19fe90a950f56514c5ad9f3a16a5 100644 (file)
@@ -41,5 +41,11 @@ namespace internal
         (void)dummy;
       }
   }
+
+  KOKKOS_FUNCTION void
+  kokkos_abort(const char *error)
+  {
+    Kokkos::abort(error);
+  }
 } // namespace internal
 DEAL_II_NAMESPACE_CLOSE

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.