]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix deal_II_exceptions::internal::abort [[noexcept]] attribute for old Kokkos 17212/head
authorDaniel Arndt <arndtd@ornl.gov>
Fri, 5 Jul 2024 14:59:24 +0000 (10:59 -0400)
committerDaniel Arndt <arndtd@ornl.gov>
Fri, 5 Jul 2024 15:05:13 +0000 (11:05 -0400)
source/base/exceptions.cc

index 50cd791f1ddd8158b618389a1c77b849cc527e01..918bb9c181ea26a675e20e9ba4180453622f8b2b 100644 (file)
@@ -520,8 +520,19 @@ namespace deal_II_exceptions
       // Let's abort the program here. On the host, we need to call std::abort,
       // on devices we need to do something different. Kokkos::abort() does
       // the right thing in all circumstances.
-      Kokkos::abort(
-        "Abort() was called during dealing with an assertion or exception.");
+      if constexpr (std::is_same_v<Kokkos::DefaultExecutionSpace,
+                                   Kokkos::DefaultHostExecutionSpace>)
+        {
+          // FIXME_KOKKOS Older Kokkos versions don't declare Kokkos::abort as
+          // [[noreturn]]. In case Kokkos is only configured with host backends,
+          // we can just use std::abort instead.
+          std::abort();
+        }
+      else
+        {
+          Kokkos::abort(
+            "Abort() was called during dealing with an assertion or exception.");
+        }
     }
 
 

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.