Makes all future work submitted to stream
wait until event
reports completion before beginning execution. This synchronization will be performed efficiently on the device. The event event
may be from a different context than stream
, in which case this function will perform cross-device synchronization.
The stream stream
will wait only for the completion of the most recent host call to cudaEventRecord() on event
. Once this call has returned, any functions (including cudaEventRecord() and cudaEventDestroy()) may be called on event
again, and the subsequent calls will not have any effect on stream
.
If stream
is NULL, any future work submitted in any stream will wait for event
to complete before beginning execution. This effectively creates a barrier for all future work submitted to the device on this thread.
If cudaEventRecord() has not been called on event
, this call acts as if the record has already completed, and so is a functional no-op.
- Parameters:
-
| stream | - Stream to wait |
| event | - Event to wait on |
| flags | - Parameters for the operation (must be 0) |
- Returns:
- cudaSuccess, cudaErrorInvalidResourceHandle
- Note:
- Note that this function may also return error codes from previous, asynchronous launches.
- See also:
- cudaStreamCreate, cudaStreamQuery, cudaStreamSynchronize, cudaStreamDestroy