Cuda.EventCUDA events can be used for synchronization between streams without blocking the CPU, and to time the on-device execution. See: Event Management.
See CUevent.
val sexp_of_t : t -> Sexplib0.Sexp.tval create :
?blocking_sync:bool ->
?enable_timing:bool ->
?interprocess:bool ->
unit ->
tCreates an event for the current context. All of blocking_sync, enable_timing and interprocess are by default false. See cuEventCreate and CUevent_flags.
The event value is finalized using cuEventDestroy. This is safe because the event resources are only released when the event completes, so waiting streams are not affected by the finalization. Note: I assume destroying an event is safe without setting the proper context.
Returns (an upper bound on) elapsed time in milliseconds with a resolution of around 0.5 microseconds. Both events must have completed (query start = true and query end_ = true) before calling elapsed_time. See cuEventElapsedTime.
val query : t -> boolReturns true precisely when all work captured by the most recent call to record has been completed. See cuEventQuery.
Captures in the event the contents of the stream, i.e. the work scheduled on it. external_ defaults to false (cudajit as of version 0.5 does not expose stream capture). See cuEventRecordWithFlags.
val synchronize : t -> unitBlocks until the completion of all work captured in the event by the most recent call to record. NOTE: if the event was created without ~blocking_sync:true, then the CPU thread will busy-wait. See cuEventSynchronize.
Future work submitted to the stream will wait for the completion of all work captured in the event by the most recent call to record. external_ defaults to false (cudajit as of version 0.5 does not expose stream capture). See cuStreamWaitEvent.