aclrtSetDeviceTaskAbortCallback

Applicability

Product

Supported

Atlas A3 training products/Atlas A3 inference products

Atlas A2 training products/Atlas A2 inference products

Atlas 200I/500 A2 inference products

Atlas inference products

Atlas training products

Description

Registers a callback function. The function will be triggered before and after the aclrtDeviceTaskAbort call. Only one callback function can be registered.

Prototype

aclError aclrtSetDeviceTaskAbortCallback(const char *regName, aclrtDeviceTaskAbortCallback callback, void *args)

Parameters

Parameter

Input/Output

Description

regName

Input

Registered name, which must be unique and cannot be empty. Ensure that the input string ends with \0.

callback

Input

Callback function. If callback is not NULL, the callback function is registered. If callback is NULL, the callback function is unregistered.

The prototype of the callback function is as follows:

typedef enum {
    ACL_RT_DEVICE_TASK_ABORT_PRE = 0,
    ACL_RT_DEVICE_TASK_ABORT_POST,
} aclrtDeviceTaskAbortStage;
typedef int32_t (*aclrtDeviceTaskAbortCallback)(int32_t deviceId, aclrtDeviceTaskAbortStage stage, uint32_t timeout, void *args);

args

Input

Pointer to the user data to be passed to the callback function.

Returns

0 on success; else, failure. For details, see aclError.