mirror of
https://github.com/lordmathis/CUDANet.git
synced 2025-11-06 09:44:28 +00:00
19 lines
476 B
Plaintext
19 lines
476 B
Plaintext
#ifndef CUDA_HELPER_H
|
|
#define CUDA_HELPER_H
|
|
|
|
#include <cuda_runtime.h>
|
|
|
|
// CUDA error checking macro
|
|
#define CUDA_CHECK(call) \
|
|
do { \
|
|
cudaError_t result = call; \
|
|
if (result != cudaSuccess) { \
|
|
fprintf(stderr, "CUDA error at %s:%d code=%d(%s) \"%s\" \n", \
|
|
__FILE__, __LINE__, static_cast<unsigned int>(result), \
|
|
cudaGetErrorString(result), #call); \
|
|
exit(EXIT_FAILURE); \
|
|
} \
|
|
} while (0)
|
|
|
|
#endif // CUDA_HELPER_H
|