mirror of
https://github.com/lordmathis/CUDANet.git
synced 2025-11-06 01:34:22 +00:00
Initial CUDA test
This commit is contained in:
21
include/utils/cuda_helper.h
Normal file
21
include/utils/cuda_helper.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#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)
|
||||
|
||||
// Initialize CUDA and return the device properties
|
||||
cudaDeviceProp initializeCUDA();
|
||||
|
||||
#endif // CUDA_HELPER_H
|
||||
Reference in New Issue
Block a user