aclrtStreamWaitEvent
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.
Restrictions
- This API is asynchronous. The API call delivers a task rather than executes a task. After this API is called, you need to call a synchronization API (for example, aclrtSynchronizeStream) to ensure that the task is complete. Otherwise, service exceptions (such as training or inference exception) or unknown situations (such as device link or card disconnection) may occur.
- After AscendCL is initialized by calling aclInit in a process, you can call aclrtSetOpWaitTimeout to set the timeout interval. Tasks delivered by calling aclrtStreamWaitEvent in the process can wait within the configured timeout interval. If the wait time exceeds the configured timeout interval, AscendCL returns an error.
The aclrtStreamWaitEvent API is an asynchronous API. Successful API calling only indicates that the task is successfully delivered but not executed. Therefore, if the wait time exceeds the configured timeout interval, an error is reported after the aclrtSynchronizeStream API is called.
Prototype
aclError aclrtStreamWaitEvent(aclrtStream stream, aclrtEvent event)
Parameters
|
Parameter |
Input/Output |
Description |
|---|---|---|
|
stream |
Input |
Stream. For example, in the Stream1 scenario such as Stream2, set this parameter to Stream2. To specify the default stream, pass NULL. |
|
event |
Input |
Event to wait on. |
Returns
The value 0 indicates success, and other values indicate failure. For details, see aclError.