17 #ifndef KOKKOS_ABORT_HPP
18 #define KOKKOS_ABORT_HPP
20 #include <Kokkos_Macros.hpp>
21 #include <Kokkos_Printf.hpp>
22 #ifdef KOKKOS_ENABLE_CUDA
23 #include <Cuda/Kokkos_Cuda_abort.hpp>
25 #ifdef KOKKOS_ENABLE_HIP
26 #include <HIP/Kokkos_HIP_Abort.hpp>
28 #ifdef KOKKOS_ENABLE_SYCL
29 #include <SYCL/Kokkos_SYCL_Abort.hpp>
35 [[noreturn]]
void host_abort(
const char *
const);
37 #if defined(KOKKOS_ENABLE_CUDA) && defined(__CUDA_ARCH__)
39 #if defined(KOKKOS_ENABLE_DEBUG_BOUNDS_CHECK)
42 #define KOKKOS_IMPL_ABORT_NORETURN
45 #define KOKKOS_IMPL_ABORT_NORETURN [[noreturn]]
48 #elif defined(KOKKOS_COMPILER_NVHPC)
50 #define KOKKOS_IMPL_ABORT_NORETURN
52 #elif defined(KOKKOS_ENABLE_HIP) && defined(__HIP_DEVICE_COMPILE__)
54 #define KOKKOS_IMPL_ABORT_NORETURN [[noreturn]]
55 #elif defined(KOKKOS_ENABLE_SYCL) && defined(__SYCL_DEVICE_ONLY__)
57 #define KOKKOS_IMPL_ABORT_NORETURN
58 #elif !defined(KOKKOS_ENABLE_OPENMPTARGET) && !defined(KOKKOS_ENABLE_OPENACC)
60 #define KOKKOS_IMPL_ABORT_NORETURN [[noreturn]]
63 #define KOKKOS_IMPL_ABORT_NORETURN
68 #if defined(KOKKOS_ENABLE_SYCL) || \
69 (defined(KOKKOS_ENABLE_CUDA) && defined(KOKKOS_ENABLE_DEBUG_BOUNDS_CHECK))
70 #define KOKKOS_IMPL_ABORT_NORETURN_DEVICE
72 #define KOKKOS_IMPL_ABORT_NORETURN_DEVICE KOKKOS_IMPL_ABORT_NORETURN
75 #if defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_HIP) || \
76 defined(KOKKOS_ENABLE_SYCL) || defined(KOKKOS_ENABLE_OPENMPTARGET) || \
77 defined(KOKKOS_ENABLE_OPENACC)
78 KOKKOS_IMPL_ABORT_NORETURN_DEVICE
inline KOKKOS_IMPL_DEVICE_FUNCTION
void
79 device_abort(
const char *
const msg) {
80 #if defined(KOKKOS_ENABLE_CUDA)
81 ::Kokkos::Impl::cuda_abort(msg);
82 #elif defined(KOKKOS_ENABLE_HIP)
83 ::Kokkos::Impl::hip_abort(msg);
84 #elif defined(KOKKOS_ENABLE_SYCL)
85 ::Kokkos::Impl::sycl_abort(msg);
86 #elif defined(KOKKOS_ENABLE_OPENMPTARGET) || defined(KOKKOS_ENABLE_OPENACC)
95 KOKKOS_IMPL_ABORT_NORETURN KOKKOS_INLINE_FUNCTION
void abort(
96 const char *
const message) {
97 KOKKOS_IF_ON_HOST(::Kokkos::Impl::host_abort(message);)
98 KOKKOS_IF_ON_DEVICE(::Kokkos::Impl::device_abort(message);)
101 #undef KOKKOS_IMPL_ABORT_NORETURN