cuda::experimental::stf::cuda_try
Defined in include/cuda/experimental/__stf/utility/cuda_safe_call.cuh
-
template<typename Status>
void cuda::experimental::stf::cuda_try(Status status, const cuda::std::source_location loc = cuda::std::source_location::current()) Throws a
cuda_exception
if the givenstatus
is an error code.The typical usage is to place a CUDA function call inside
cuda_try
, i.e.cuda_try(cudaFunc(args))
(the same waycuda_safe_call
would be called). For example,cuda_try(cudaCreateStream(&stream))
is equivalent tocudaCreateStream(&stream)
, with the note that the former call throws an exception in case of error.- Template Parameters
Status – CUDA error code type, such as
cudaError_t
,cublasStatus_t
, orcusolverStatus_t
- Parameters
status – CUDA error code value, usually the result of a CUDA API call
loc – location of the call, defaulted