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