11#include <Kokkos_Macros.hpp>
13#if defined(KOKKOS_ENABLE_CUDA)
17#elif defined(KOKKOS_ENABLE_HIP)
20# include <hip/hip_runtime.h>
23namespace ddc::detail {
25#if defined(KOKKOS_ENABLE_CUDA)
26void device_throw_on_error(
27 cudaError_t
const err,
28 const char*
const func,
29 const char*
const file,
32 if (err != cudaSuccess) {
34 ss <<
"CUDA Runtime Error at: " << file <<
":" << line <<
"\n";
35 ss << cudaGetErrorString(err) <<
" " << func <<
"\n";
36 throw std::runtime_error(ss.str());
39#elif defined(KOKKOS_ENABLE_HIP)
40void device_throw_on_error(
42 const char*
const func,
43 const char*
const file,
46 if (err != hipSuccess) {
48 ss <<
"HIP Runtime Error at: " << file <<
":" << line <<
"\n";
49 ss << hipGetErrorString(err) <<
" " << func <<
"\n";
50 throw std::runtime_error(ss.str());
56std::optional<std::map<std::string, std::function<
void()>>> g_discretization_store;
58void display_discretization_store(std::ostream& os)
60 if (g_discretization_store) {
61 os <<
"The host discretization store is initialized:\n";
62 for (
auto const& [key, value] : *g_discretization_store) {
63 os <<
" - " << key <<
"\n";
66 os <<
"The host discretization store is not initialized:\n";
The top-level namespace of DDC.