/** * Wrapper for CUDA functions. On CUDA error prints error message and exits program. * @param err CUDA error object. * @param file Part of error message: Name of file in that the error occurred. * @param line Part of error message: Line in that the error occurred. */ void HandleError( cudaError_t err, const char * file, int line ) { if(err != cudaSuccess) { std::cerr << file << "(" << line << "): error: " << cudaGetErrorString( err ) << std::endl; throw cudaException(); } }
static void check(cudaError err, const char *fun, const char *file, const int line) { if(err != cudaSuccess) throw cudaException(err); }