20 #include <cuda_runtime_api.h> 23 #include <glog/logging.h> 26 #define CUDA_PROTECT(s) (s); 28 #define CUDA_PROTECT(s) \ 29 { LOG(FATAL) << "Cuda not enabled."; } 36 #include <sys/prctl.h> 40 #define CU_CHECK(ans) \ 41 { cuAssert((ans), __FILE__, __LINE__); } 43 inline void cuAssert(cudaError_t code,
const char* file,
int line) {
44 if (code != cudaSuccess) {
45 LOG(FATAL) <<
"GPUassert: " << cudaGetErrorString(code) <<
" " << file
50 #define CUD_CHECK(ans) \ 51 { cudAssert((ans), __FILE__, __LINE__); } 53 inline void cudAssert(CUresult code,
const char* file,
int line) {
54 if (code != CUDA_SUCCESS) {
56 cuGetErrorString(code, &err_str);
57 LOG(FATAL) <<
"GPUassert: " << err_str <<
" " << file <<
" " << line;