56 #if (defined(DEBUG) || defined(_DEBUG)) && !defined(CUB_STDERR) 68 __host__ __device__ __forceinline__ cudaError_t
Debug(
78 #if (CUB_PTX_ARCH == 0) 79 fprintf(stderr,
"CUDA error %d [%s, %d]: %s\n", error, filename, line, cudaGetErrorString(error));
81 #elif (CUB_PTX_ARCH >= 200) 82 printf(
"CUDA error %d [block (%d,%d,%d) thread (%d,%d,%d), %s, %d]\n", error, blockIdx.z, blockIdx.y, blockIdx.x, threadIdx.z, threadIdx.y, threadIdx.x, filename, line);
94 #define CubDebug(e) cub::Debug((cudaError_t) (e), __FILE__, __LINE__) 102 #define CubDebugExit(e) if (cub::Debug((cudaError_t) (e), __FILE__, __LINE__)) { exit(1); } 109 #if !defined(_CubLog) 110 #if !(defined(__clang__) && defined(__CUDA__)) 111 #if (CUB_PTX_ARCH == 0) 112 #define _CubLog(format, ...) printf(format,__VA_ARGS__); 113 #elif (CUB_PTX_ARCH >= 200) 114 #define _CubLog(format, ...) printf("[block (%d,%d,%d), thread (%d,%d,%d)]: " format, blockIdx.z, blockIdx.y, blockIdx.x, threadIdx.z, threadIdx.y, threadIdx.x, __VA_ARGS__); 120 #pragma clang diagnostic ignored "-Wc++11-extensions" 121 #pragma clang diagnostic ignored "-Wunnamed-type-template-args" 122 template <
class... Args>
123 inline __host__ __device__
void va_printf(
char const* format, Args
const&... args)
126 printf(format, blockIdx.z, blockIdx.y, blockIdx.x, threadIdx.z, threadIdx.y, threadIdx.x, args...);
128 printf(format, args...);
131 #ifndef __CUDA_ARCH__ 132 #define _CubLog(format, ...) va_printf(format,__VA_ARGS__); 134 #define _CubLog(format, ...) va_printf("[block (%d,%d,%d), thread (%d,%d,%d)]: " format, __VA_ARGS__); Optional outer namespace(s)
__host__ __device__ __forceinline__ cudaError_t Debug(cudaError_t error, const char *filename, int line)
CUB error reporting macro (prints error messages to stderr)