22 #ifndef RAJA_cudaerrchk_HPP
23 #define RAJA_cudaerrchk_HPP
25 #include "RAJA/config.hpp"
27 #if defined(RAJA_ENABLE_CUDA)
34 #include <string_view>
40 #include <cuda_runtime.h>
42 #include "camp/defines.hpp"
43 #include "camp/helpers.hpp"
47 #include "cub/util_type.cuh"
52 namespace experimental
56 struct StreamInsertHelper<RAJA_CUDA_DIM_T&>
58 RAJA_CUDA_DIM_T& m_val;
60 std::ostream& operator()(std::ostream& str)
const
62 return str <<
"{" << m_val.x <<
"," << m_val.y <<
"," << m_val.z <<
"}";
68 struct StreamInsertHelper<RAJA_CUDA_DIM_T const&>
70 RAJA_CUDA_DIM_T
const& m_val;
72 std::ostream& operator()(std::ostream& str)
const
74 return str <<
"{" << m_val.x <<
"," << m_val.y <<
"," << m_val.z <<
"}";
79 struct StreamInsertHelper<::cub::DoubleBuffer<R>&>
81 ::cub::DoubleBuffer<R>& m_val;
83 std::ostream& operator()(std::ostream& str)
const
85 return str <<
"{" << m_val.Current() <<
"," << m_val.Alternate() <<
"}";
91 struct StreamInsertHelper<::cub::DoubleBuffer<R> const&>
93 ::cub::DoubleBuffer<R>
const& m_val;
95 std::ostream& operator()(std::ostream& str)
const
98 return str <<
"{?,?}";
118 #define cudaErrchk(ans) \
120 ::RAJA::cudaAssert((ans), __FILE__, __LINE__); \
123 [[deprecated]]
inline void cudaAssert(cudaError_t code,
128 if (code != cudaSuccess)
133 msg +=
"CUDAassert: ";
134 msg += cudaGetErrorString(code);
138 msg += std::to_string(line);
139 throw std::runtime_error(msg);
143 fprintf(stderr,
"CUDAassert: %s %s %d\n", cudaGetErrorString(code), file,
Header file for common RAJA internal macro definitions.
Definition: AlignedRangeIndexSetBuilders.cpp:35