cuda::experimental::stf::cuda_safe_call#
-
template<typename T>
void cuda::experimental::stf::cuda_safe_call( - const T status,
- const ::cuda::std::source_location loc = ::cuda::std::source_location::current(),
Enforces successful call of CUDA API functions.
If
status
is0
, the function has no effect. Otherwise, the function prints pertinent error information tostderr
and aborts the program.cuda_safe_call(CUDA_SUCCESS); // no effect int dev; cuda_safe_call(cudaGetDevice(&dev)); // continue execution if the call is successful if (false) { cuda_safe_call(CUDA_ERROR_INVALID_VALUE); // would abort application if called }
- Template Parameters:
T – status type, can be
cudaError_t
,cublasStatus_t
, orcusolverStatus_t
- Parameters:
status – status value, usually the result of a CUDA API call
loc – location of the call, defaulted