I have a processing loop on the host, where I record an event in a GPU stream. Then another stream waits for that event (waits for event's state "set" or "true"). Will this function (cudaStreamWaitEvent) unset this event (so, switching it to "unset" or "false")? If not, what CUDA function I can use to unset this event?
This sounds very much like an XY question. You might be better off describing at a higher level what it is you are trying to accomplish, or what problem you are facing or think you are facing.
cudaStreamWaitEvent
does not "unset" an event.When the event is encountered in the stream, then
cudaStreamWaitEvent
will unblock, and any subsequent calls tocudaStreamWaitEvent
on the same event will immediately unblock (assuming nocudaEventRecord
has again been issued for that event). This behavior is easy to prove with a trivial code sample.The function that "unsets" a cudaEvent is
cudaEventRecord()
. AnycudaStreamWaitEvent
calls issued after that event gets recorded will wait again, until it is encountered again.You may want to read the runtime API documentation for
cudaEventRecord
andcudaStreamWaitEvent
. Note the following excerpts:cudaEventRecord:
cudaStreamWaitEvent: