Error handling

oneCCL error handling relies on the mechanism of C++ exceptions. If an error occurs, it shall be propagated at the point of a function call where it is caught using standard C++ error handling mechanism.

Exception classification

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

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

This specification does not require implementations to perform error-checking. However, if an implementation does provide error-checking, it shall use the following exception classes. Additional implementation-specific exception classes can be used for exceptional conditions not fitting any of these classes.

Common exceptions

Exception class

Description

ccl::exception

Reports general unspecified error

ccl::invalid_argument

Reports an error when arguments to the operation were rejected

ccl::host_bad_alloc

Reports an error that occurred during memory allocation on the host

ccl::unimplemented

Reports an error when the requested operation is not implemented

ccl::unsupported

Reports an error when the requested operation is not supported