The underlying CUDA events are lazily initialized when the event is first
recorded or exported to another process. After creation, only streams on the
same device may record the event. However, streams on any device can wait on
the event.
- Parameters:
enable_timing (bool, optional) – indicates if the event should measure time
(default: False)
blocking (bool, optional) – if True, wait() will be blocking (default: False)
interprocess (bool) – if True, the event can be shared between processes
(default: False)
external (bool, optional) – indicates whether this event should create event record and event wait nodes, or create an internal cross-stream dependency, when captured in a cuda graph. See cross-stream dependencies, cudaEventRecordExternal, and cudaEventWaitExternal for more information about internal vs. external events. (default: False)
-
elapsed_time(end_event)
Return the time elapsed.
Time reported in milliseconds after the event was recorded and
before the end_event was recorded.
- Parameters:
end_event (Event) – the end event.
-
classmethod from_ipc_handle(device, handle)
Reconstruct an event from an IPC handle on the given device.
-
ipc_handle()
Return an IPC handle of this event.
If not recorded yet, the event will use the current device.
-
query()
Check if all work currently captured by event has completed.
- Returns:
A boolean indicating if all work currently captured by event has
completed.
-
record(stream=None)
Record the event in a given stream.
- Parameters:
stream (Stream, torch.Stream, optional) – Uses torch.cuda.current_stream() if no stream is specified.
The stream’s device must match the event’s device.
-
synchronize()
Wait for the event to complete.
Waits until the completion of all work currently captured in this event.
This prevents the CPU thread from proceeding until the event completes.
-
wait(stream=None)
Make all future work submitted to the given stream wait for this event.
- Parameters:
stream (Stream, torch.Stream, optional) – Uses torch.cuda.current_stream() if no stream is specified.