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.
cudaStreamWaitEventdoes not "unset" an event.When the event is encountered in the stream, then
cudaStreamWaitEventwill unblock, and any subsequent calls tocudaStreamWaitEventon the same event will immediately unblock (assuming nocudaEventRecordhas 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(). AnycudaStreamWaitEventcalls issued after that event gets recorded will wait again, until it is encountered again.You may want to read the runtime API documentation for
cudaEventRecordandcudaStreamWaitEvent. Note the following excerpts:cudaEventRecord:
cudaStreamWaitEvent: