accelerInt  v0.1
gpu_macros.cuh
Go to the documentation of this file.
1 
7 #ifndef GPU_MACROS_CUH
8 #define GPU_MACROS_CUH
9 #include <stdio.h>
10 #include <cuda.h>
11 #include <cuda_runtime.h>
12 #include <helper_cuda.h>
13 
14 #ifdef GENERATE_DOCS
15 //put this in the van der Pol namespace for documentation
16 namespace van_der_pol_cu {
17 #endif
18 
20 #define GRID_DIM (blockDim.x * gridDim.x)
21 #define T_ID (threadIdx.x + blockIdx.x * blockDim.x)
23 #define INDEX(i) (T_ID + (i) * GRID_DIM)
25 
26 #define cudaErrorCheck(ans) { gpuAssert((ans), __FILE__, __LINE__); }
27 inline void gpuAssert(cudaError_t code, const char *file, int line, bool abort=true)
28 {
29  if (code != cudaSuccess)
30  {
31  fprintf(stderr,"GPUassert: %s %s %d\n", cudaGetErrorString(code), file, line);
32  if (abort) exit(code);
33  }
34 }
35 
36 
37 #ifdef GENERATE_DOCS
38 }
39 #endif
40 
41 #endif
void gpuAssert(cudaError_t code, const char *file, int line, bool abort=true)
Definition: gpu_macros.cuh:27