aclrtSynchronizeDeviceWithTimeout

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

Blocks the current thread until the device corresponding to the context bound to the current thread completes the computation. This API is enhanced based on aclrtSynchronizeDevice and allows users to set the timeout interval. When an app is abnormal, the app automatically exits based on the configured timeout interval. When the app exits due to timeout, ACL_ERROR_RT_STREAM_SYNC_TIMEOUT is returned.

In multi-device scenarios, this API is called to wait for the device of the current context.

Prototype

1
aclError aclrtSynchronizeDeviceWithTimeout(int32_t timeout)

Parameters

Parameter

Input/Output

Description

timeout

Input

API timeout interval.

The options are as follows:

  • -1: forever. In this case, this API is equivalent to aclrtSynchronizeDevice.
  • > 0: specific timeout interval, in milliseconds.

Returns

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