From: Daniel Arndt Date: Thu, 2 Feb 2023 20:57:44 +0000 (-0500) Subject: Wrap Kokkos::abort X-Git-Tag: v9.5.0-rc1~584^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F14753%2Fhead;p=dealii.git Wrap Kokkos::abort --- diff --git a/include/deal.II/base/exceptions.h b/include/deal.II/base/exceptions.h index af4fe88c84..71c7889bd7 100644 --- a/include/deal.II/base/exceptions.h +++ b/include/deal.II/base/exceptions.h @@ -18,6 +18,8 @@ #include +#include + #include #include #include @@ -28,10 +30,6 @@ # include #endif -DEAL_II_DISABLE_EXTRA_DIAGNOSTICS -#include -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*/ diff --git a/include/deal.II/base/kokkos.h b/include/deal.II/base/kokkos.h index a070b33381..29023986c0 100644 --- a/include/deal.II/base/kokkos.h +++ b/include/deal.II/base/kokkos.h @@ -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 diff --git a/include/deal.II/base/tensor.h b/include/deal.II/base/tensor.h index edc17553f0..1dc1dd9a12 100644 --- a/include/deal.II/base/tensor.h +++ b/include/deal.II/base/tensor.h @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -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!\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!\n"); # endif # endif diff --git a/source/base/kokkos.cc b/source/base/kokkos.cc index 5ea3b374c1..417efa5dec 100644 --- a/source/base/kokkos.cc +++ b/source/base/kokkos.cc @@ -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