Initial CUDA test

This commit is contained in:
2024-02-07 21:14:46 +01:00
parent 009116ddb5
commit b16ec69469
5 changed files with 161 additions and 0 deletions

View 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