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.


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

Exception Class



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


Reports a problem that occurred during memory allocation on the host


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


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


Reports problem when arguments to the routine were rejected


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


Reports any computation error occurred inside oneMKL routine


Reports errors occurred inside batch oneMKL routine