aclrtBinarySetExceptionCallback
Applicable Products
Product |
Supported |
|---|---|
√ |
|
√ |
|
√ |
|
√ |
|
√ |
|
√ |
Function
Registers a callback function. If the callback function is set repeatedly, the most recent setting applies.
Before executing an operator, call this API to register a callback function. If an exception occurs during operator execution, the callback function is triggered and the exception information is stored in the aclrtExceptionInfo structure. Then, you can call the aclrtGetArgsFromExceptionInfo and aclrtGetFuncHandleFromExceptionInfo APIs to obtain the parameters and kernel function handle used when the operator execution task is delivered from the exception information. Currently, only the information about AI Core operator execution exceptions can be obtained.
Prototype
1 | aclError aclrtBinarySetExceptionCallback(aclrtBinHandle binHandle, aclrtOpExceptionCallback callback, void *userData) |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
binHandle |
Input |
Operator binary handle. Call aclrtBinaryLoadFromFile or aclrtBinaryLoadFromData to obtain the operator binary handle and pass it as an input parameter. |
callback |
Input |
Callback function to register. Prototype: typedef void (*aclrtOpExceptionCallback)(aclrtExceptionInfo *exceptionInfo, void *userData); |
userData |
Input |
Pointer to the user data to be passed to the callback function. |
Returns
0 on success; otherwise, failure. For details, see aclError.