aclrtStreamWaitEvent

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 running of a specified stream or multiple streams until the specified event is complete. This API is asynchronous.

All subsequent tasks submitted to the stream can be executed only after all tasks captured by the event are complete. For more details, see aclrtRecordEvent.

Prototype

aclError aclrtStreamWaitEvent(aclrtStream stream, aclrtEvent event)

Parameters

Parameter

Input/Output

Description

stream

Input

Stream.

For stream synchronization, for example, Stream2 waits for Stream1, set this parameter to Stream2.

To specify the default stream, pass NULL.

event

Input

Event to wait on.

Returns

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

Restrictions

After initialization by calling aclInit in a process, you can call aclrtSetOpWaitTimeout to set the timeout. Tasks delivered by calling aclrtStreamWaitEvent in the process can wait within the configured timeout. If the wait time exceeds the configured timeout, an error will be returned after a synchronization API (for example, aclrtSynchronizeStream) is called.

See Also

For details about the API call sequence and example, see Synchronous Wait of an Event and Synchronous Wait of Tasks Between Streams (Implemented Using Events).