Prefer to read without ads? Become a member — from $10/month — and support the work. Already a member? Log in to read ad-free on this device.

6.8 GPU/GPU Synchronization: cudaStreamWaitEvent()

Up to this point, all of the synchronization functions described in this chapter have pertained to CPU/GPU synchronization. They either wait for or query the status of a GPU operation.

Function Description
cuCtxSynchronize()/ | Wait until GPU is idle. | cudaDeviceSynchronize() | |
cu(da)EventQuery() Check if event has been recorded.
cu(da)EventSynchronize() Wait until event has been recorded.
cu(da)StreamSynchronize() Wait until all operations in stream have completed.
cu(da)StreamQuery() Check if all operations in stream are completed.

Another function, cudaStreamWaitEvent(), is asynchronous with respect to the CPU and causes the specified stream to wait until an event has been recorded. The stream and event need not be associated with the same CUDA device; Section 9.3 describes how such inter-GPU synchronization may be performed and uses the feature to implement a peer-to-peer memcpy (Listing 9-1).

Streams and Events on Multi-GPU: Notes and Limitations