aclrtSynchronizeDeviceWithTimeout

Description

Blocks app execution until the compute device has completed all preceding requested tasks. 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

aclError aclrtSynchronizeDeviceWithTimeout(int32_t timeout)

Command-Line Options

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

The value 0 indicates success, and other values indicate failure. For details, see aclError.