aclrtSetDeviceTaskAbortCallback

Applicable Products

Product

Supported

Ascend 950PR/Ascend 950DT

√

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

☓

Function

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.