cuda::experimental::stf::status_traits#

template<class _Status>
struct status_traits#

Customization point that makes _Status a status: a value that reports success or failure by itself, so that policy << status handles it on the code channel.

The primary template is undefined, and a raw integer is never a status: a C API’s result is wrapped in a distinct type at the call site. A specialization provides

  • static _Status success() noexcept, the success value: a status fails when it differs from it (the only work << does on success), and a handled failure yields it;

  • static std::string name(_Status), a short name for reports (notify, store into text);

  • static auto to_exception(_Status, cuda::std::source_location), the std::exception derivative that unwind throws, store(std::exception_ptr*) stores, and a policy that only handles exceptions receives;

  • optionally static bool failed(_Status) noexcept, for a status type with more than one success value; it then replaces the comparison with success().

cuda_safe_call.cuh specializes it for cudaError_t, CUresult, cudaOccError, and, when their headers are available, cublasStatus_t and cusolverStatus_t.