aclrtBinarySetExceptionCallback

Applicability

Product

Supported

Atlas 350 Accelerator Card

Atlas A3 training product/Atlas A3 inference product

Atlas A2 training product/Atlas A2 inference product

Atlas 200I/500 A2 inference product

Atlas inference product

Atlas training product

Description

This API is used to register 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

Handle of operator binary data.

Call aclrtBinaryLoadFromFile or aclrtBinaryLoadFromData to obtain the operator binary handle and pass it as an input parameter.

callback

Input

Callback function.

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; else, failure. For details, see aclError.