aclrtSetDeviceTaskAbortCallback

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

Registers a callback function. The function will be triggered before and after the aclrtDeviceTaskAbort call. Repeated registration is not supported.

Prototype

1
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 deregistered.

Prototype:

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);

timeout indicates the maximum duration for executing the callback function.

args

Input

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

Returns

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