12#include <Kokkos_Macros.hpp>
14#if defined(KOKKOS_ENABLE_CUDA)
18#elif defined(KOKKOS_ENABLE_HIP)
21# include <hip/hip_runtime.h>
24namespace ddc::detail {
26#if defined(KOKKOS_ENABLE_CUDA)
27void device_throw_on_error(
28 cudaError_t
const err,
29 const char*
const func,
30 const char*
const file,
33 if (err != cudaSuccess) {
35 ss <<
"CUDA Runtime Error at: " << file <<
":" << line <<
"\n";
36 ss << cudaGetErrorString(err) <<
" " << func <<
"\n";
37 throw std::runtime_error(ss.str());
40#elif defined(KOKKOS_ENABLE_HIP)
41void device_throw_on_error(
43 const char*
const func,
44 const char*
const file,
47 if (err != hipSuccess) {
49 ss <<
"HIP Runtime Error at: " << file <<
":" << line <<
"\n";
50 ss << hipGetErrorString(err) <<
" " << func <<
"\n";
51 throw std::runtime_error(ss.str());
57std::optional<std::map<std::string, std::function<
void()>>> g_discretization_store;
59void display_discretization_store(std::ostream& os)
61 if (g_discretization_store) {
62 os <<
"The host discretization store is initialized:\n";
63 for (
auto const& [key, value] : *g_discretization_store) {
64 os <<
" - " << key <<
"\n";
67 os <<
"The host discretization store is not initialized:\n";
The top-level namespace of DDC.