cuda-api-wrappers
Thin C++-flavored wrappers for the CUDA Runtime API
cuda::outstanding_error Namespace Reference

Unlike the Runtime API, where every error is outstanding until cleared, the Driver API, which we use mostly, only remembers "sticky" errors - severe errors which corrupt contexts. More...

Functions

status_t get (bool try_clearing=false) noexcept(true)
 
void ensure_none (const ::std::string &message) noexcept(false)
 Does nothing (unless throwing an exception) More...
 
void ensure_none (const char *message) noexcept(false)
 A variant of ensure_none() which takes a C-style string. More...
 
void ensure_none () noexcept(false)
 Does nothing (except possibly throwing an exception) More...
 

Detailed Description

Unlike the Runtime API, where every error is outstanding until cleared, the Driver API, which we use mostly, only remembers "sticky" errors - severe errors which corrupt contexts.

Such errors cannot be recovered from / cleared, and require either context destruction or process termination.

Function Documentation

◆ ensure_none() [1/3]

void cuda::outstanding_error::ensure_none ( const ::std::string &  message)
inlinenoexcept

Does nothing (unless throwing an exception)

Note
Invoking this function will both make an API call and guarantee the construction of the string message, regardless of whether an error has occurred, so it doesn't quite do "nothing".
similar to cuda::throw_if_error, but uses the CUDA driver's own state regarding whether or not a sticky error has occurred

◆ ensure_none() [2/3]

void cuda::outstanding_error::ensure_none ( const char *  message)
inlinenoexcept

A variant of ensure_none() which takes a C-style string.

Note
exists so as to avoid incorrect overload resolution of ensure_none(my_c_string) calls.

◆ ensure_none() [3/3]

void cuda::outstanding_error::ensure_none ( )
inlinenoexcept

Does nothing (except possibly throwing an exception)

Note
similar to throw_if_error, but uses the CUDA Runtime API's internal state
Exceptions
cuda::runtime_errorif the CUDA runtime API has encountered previously encountered an (uncleared) error

◆ get()

status_t cuda::outstanding_error::get ( bool  try_clearing = false)
inlinenoexcept
Returns
the code of a sticky (= context-corrupting) error, if the CUDA driver has recently encountered any.