File indexing completed on 2025-09-17 08:54:12
0001
0002
0003
0004
0005
0006
0007 #pragma once
0008
0009 #include <sstream>
0010
0011 #include <cuda_runtime_api.h>
0012
0013 #define cudaErrorCheck(r) \
0014 { \
0015 _cudaErrorCheck((r), __FILE__, __LINE__); \
0016 }
0017
0018 inline void _cudaErrorCheck(cudaError_t code, const char * file, int line)
0019 {
0020 if (code != cudaSuccess) {
0021 std::stringstream ss;
0022
0023 ss << "[" << file << ":" << line
0024 << "] CUDA error: " << cudaGetErrorString(code);
0025
0026 throw std::runtime_error(ss.str());
0027 }
0028 }