Mila
Deep Neural Network Library
|
Exception class for CUDA runtime errors. More...
Public Member Functions | |
CudaError (cudaError_t status, const std::source_location &location=std::source_location::current()) | |
Constructs a new CudaError exception. | |
cudaError_t | getError () const noexcept |
Gets the CUDA error code. | |
const char * | getFile () const noexcept |
Gets the filename where the error occurred. | |
const char * | getFunction () const noexcept |
Gets the function name where the error occurred. | |
uint32_t | getLine () const noexcept |
Gets the line number where the error occurred. | |
Static Private Member Functions | |
static std::string | getMessage (cudaError_t status, const std::source_location &location) |
Generates a detailed error message from a CUDA error. | |
Private Attributes | |
cudaError_t | cuda_error_ = cudaSuccess |
The CUDA error code. | |
const char * | file_ |
Source file where the error occurred. | |
const char * | function_ |
Function name where the error occurred. | |
uint32_t | line_ |
Line number where the error occurred. | |
Exception class for CUDA runtime errors.
This class wraps CUDA runtime API errors with additional context information such as the file, line, and function where the error occurred. It inherits from std::runtime_error and provides methods to access error details.
|
inline |
Constructs a new CudaError exception.
status | The CUDA error status code. |
location | Source location information (automatically populated by default). |
|
inlinenoexcept |
Gets the CUDA error code.
|
inlinenoexcept |
Gets the filename where the error occurred.
|
inlinenoexcept |
Gets the function name where the error occurred.
|
inlinenoexcept |
Gets the line number where the error occurred.
|
inlinestaticprivate |
Generates a detailed error message from a CUDA error.
status | The CUDA error status code. |
location | Source location information. |
|
private |
The CUDA error code.
|
private |
Source file where the error occurred.
|
private |
Function name where the error occurred.
|
private |
Line number where the error occurred.