cuda::experimental::stf::cuda_exception#

class cuda_exception : public std::exception#

Exception type across CUDA, CUBLAS, and CUSOLVER.

UNITTEST("cuda_exception")
{
  auto e = cuda_exception(CUDA_SUCCESS);
  EXPECT(e.what()[0] == 0);
#  if _CCCL_HAS_INCLUDE(<cusolverDn.h>)
  auto e1 = cuda_exception(CUSOLVER_STATUS_ZERO_PIVOT);
  EXPECT(strlen(e1.what()) > 0u);
#  endif
};

Public Functions

cuda_exception() = delete#
template<typename T>
inline cuda_exception(
const T status,
const ::cuda::std::source_location loc = ::cuda::std::source_location::current(),
)#

Constructs an exception object from a status value.

If status is 0, the exception is still created with an empty error message. Otherwise, the constructor initializes the error message (later accessible with what()) appropriately.

Template Parameters:

T – status type, can be cudaError_t, cublasStatus_t, or cusolverStatus_t

Parameters:
  • status – status value, usually the result of a CUDA API call

  • loc – location of the call, defaulted

inline const char *what() const noexcept override#

Returns a message describing the error.

Returns:

the error message