Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-13 08:21:03

0001 #ifndef G4HepEmCuUtils_HH
0002 #define G4HepEmCuUtils_HH
0003 
0004 #ifdef G4HepEm_CUDA_BUILD
0005 
0006 #include <cuda_runtime.h>
0007 #include <cstdio>
0008 #include <cstdlib>
0009 
0010 /**
0011  * @file    G4HepEmCuUtils.hh
0012  * @author  M. Novak
0013  * @date    2020
0014  *
0015  * A simple macro for printing out  CUDA error strings.
0016  */
0017 
0018 
0019 #define gpuErrchk(ans) { cuAssert((ans), __FILE__, __LINE__); }
0020   inline void cuAssert(cudaError_t code, const char *file, int line, bool abort=true){
0021       if (code != cudaSuccess) {
0022           fprintf(stderr,"CUAassert: %s %s %d\n",
0023           cudaGetErrorString(code), file, line);
0024           if (abort) exit(code);
0025       }
0026   }
0027 
0028 #endif // G4HepEm_CUDA_BUILD
0029 
0030 #endif // G4HepEmCuUtils_HH