Error Handling

oneMKL error handling relies on the mechanism of C++ exceptions. Should errors occur, they are propagated at the point of a function call where they are caught using standard C++ error handling mechanisms.

Exception Classification

Exception classification in oneMKL is aligned with C++ Standard Library classification. oneMKL introduces a class that defines the base class in the hierarchy of oneMKL exception classes. All oneMKL routines throw exceptions inherited from this base class.

In the hierarchy of oneMKL exceptions, oneapi::mkl::exception is the base class inherited from the std::exception class. All other oneMKL exception classes are derived from this base class.

image0

All oneMKL problem-specific exceptions are listed in the following table.

Exception Class

Description

oneapi::mkl::unsupported_device

Reports a problem when the routine is not supported on a specific device

oneapi::mkl::host_bad_alloc

Reports a problem that occurred during memory allocation on the host

oneapi::mkl::device_bad_alloc

Reports a problem that occurred during memory allocation on a specific device

oneapi::mkl::unimplemented

Reports a problem when a specific routine has not been implemented for the specified parameters

oneapi::mkl::invalid_argument

Reports problem when arguments to the routine were rejected

oneapi::mkl::uninitialized

Reports problem when a handle (descriptor) has not been initialized

oneapi::mkl::computation_error

Reports any computation error occurred inside oneMKL routine

oneapi::mkl::batch_error

Reports errors occurred inside batch oneMKL routine