mirror of
https://github.com/lordmathis/CUDANet.git
synced 2025-11-06 01:34:22 +00:00
Initialize and use cuBLAS properly
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#define CUDA_HELPER_H
|
||||
|
||||
#include <cuda_runtime.h>
|
||||
#include <cublas_v2.h>
|
||||
|
||||
#define IDX2C(i,j,ld) (((j)*(ld))+(i))
|
||||
|
||||
@@ -17,7 +18,15 @@ do { \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
// Initialize CUDA and return the device properties
|
||||
cudaDeviceProp initializeCUDA();
|
||||
// cuBLAS error checking macro
|
||||
#define CUBLAS_CHECK(call) \
|
||||
do { \
|
||||
cublasStatus_t result = call; \
|
||||
if (result != CUBLAS_STATUS_SUCCESS) { \
|
||||
fprintf(stderr, "cuBLAS error at %s:%d code=%d\n", \
|
||||
__FILE__, __LINE__, static_cast<int>(result)); \
|
||||
exit(EXIT_FAILURE); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#endif // CUDA_HELPER_H
|
||||
|
||||
Reference in New Issue
Block a user