aclrtSynchronizeDeviceWithTimeout

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

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.

Prototype

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 ms.

Returns

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