GeNN  4.9.0
GPU enhanced Neuronal Networks (GeNN)
cuda/utils.h
Go to the documentation of this file.
1 #pragma once
2 
3 // Standard C++ includes
4 #include <iostream>
5 
6 // GeNN includes
7 #include "logging.h"
8 
9 #if CUDA_VERSION >= 6050
10 #define CHECK_CU_ERRORS(call) \
11 { \
12  CUresult error = call; \
13  if (error != CUDA_SUCCESS) { \
14  const char *errStr; \
15  cuGetErrorName(error, &errStr); \
16  LOGE_BACKEND << __FILE__ << ": " << __LINE__ << ": cuda driver error " << error << ": " << errStr; \
17  exit(EXIT_FAILURE); \
18  } \
19 }
20 #else
21 #define CHECK_CU_ERRORS(call) call
22 #endif
23 
24 #define CHECK_CUDA_ERRORS(call) \
25 { \
26  cudaError_t error = call; \
27  if (error != cudaSuccess) { \
28  LOGE_BACKEND << __FILE__ << ": " << __LINE__ << ": cuda runtime error " << error << ": " << cudaGetErrorString(error); \
29  exit(EXIT_FAILURE); \
30  } \
31 }