13 #ifdef ALPAKA_ACC_GPU_CUDA_ENABLED
21 if(error == CUDA_SUCCESS)
24 char const* cu_err_name =
nullptr;
25 char const* cu_err_string =
nullptr;
26 CUresult cu_result_name = cuGetErrorName(error, &cu_err_name);
27 CUresult cu_result_string = cuGetErrorString(error, &cu_err_string);
28 std::string sError = std::string(file) +
"(" + std::to_string(line) +
") " + std::string(desc) +
" : '";
29 if(cu_result_name == CUDA_SUCCESS && cu_result_string == CUDA_SUCCESS)
31 sError += std::string(cu_err_name) +
"': '" + std::string(cu_err_string) +
"'!";
36 if(cu_result_name == CUDA_ERROR_INVALID_VALUE)
38 sError +=
" cuGetErrorName: 'Invalid Value'!";
40 if(cu_result_string == CUDA_ERROR_INVALID_VALUE)
42 sError +=
" cuGetErrorString: 'Invalid Value'!";
45 # if ALPAKA_DEBUG >= ALPAKA_DEBUG_MINIMAL
46 std::cerr << sError << std::endl;
49 throw std::runtime_error(sError);
54 # define ALPAKA_CUDA_DRV_CHECK(cmd) ::alpaka::cuda::detail::cudaDrvCheck(cmd, #cmd, __FILE__, __LINE__)
#define ALPAKA_DEBUG_BREAK
ALPAKA_FN_HOST auto cudaDrvCheck(CUresult const &error, char const *desc, char const *file, int const &line) -> void
CUDA driver API error checking with log and exception, ignoring specific error values.