# Event

Source: https://www.tensorplay.cn/docs/generated/tensorplay.cuda.streams.Event.html

# Event

class tensorplay.cuda.streams.Event(enable_timing=False, blocking=False, interprocess=False, external=False)[[source]](../_modules/tensorplay/cuda/streams.html#Event)

Wrapper around a CUDA event.

CUDA events are synchronization markers that can be used to monitor the
device’s progress, to accurately measure timing, and to synchronize CUDA
streams.

Parameters:

- enable_timing ([bool](https://docs.python.org/3/library/functions.html#bool) , optional ) – indicates if the event should measure time (default: False )

- blocking ([bool](https://docs.python.org/3/library/functions.html#bool) , optional ) – if True , [wait()](#tensorplay.cuda.streams.Event.wait) will be blocking (default: False )

- interprocess ([bool](https://docs.python.org/3/library/functions.html#bool)) – if True , the event can be shared between processes (default: False )

elapsed_time(end_event: [Event](#tensorplay.cuda.streams.Event))[[source]](../_modules/tensorplay/cuda/streams.html#Event.elapsed_time)

Return the time elapsed.

Time reported in milliseconds after the event was recorded and
before the end_event was recorded.

Parameters:

end_event ([Event](#tensorplay.cuda.streams.Event)) – the end event.

classmethod from_ipc_handle(device, handle)[[source]](../_modules/tensorplay/cuda/streams.html#Event.from_ipc_handle)

Reconstruct an event from an IPC handle on the given device.

ipc_handle()[[source]](../_modules/tensorplay/cuda/streams.html#Event.ipc_handle)

Return an IPC handle of this event.

query()[[source]](../_modules/tensorplay/cuda/streams.html#Event.query)

Check if all work currently captured by event has completed.

record(stream: [Stream](tensorplay.cuda.streams.Stream.html#tensorplay.cuda.streams.Stream) | [None](https://docs.python.org/3/library/constants.html#None) = None)[[source]](../_modules/tensorplay/cuda/streams.html#Event.record)

Record the event in a given stream.

Parameters:

stream ([Stream](tensorplay.cuda.streams.Stream.html#tensorplay.cuda.streams.Stream), optional) – Uses tensorplay.cuda.current_stream() if no stream is specified.

synchronize() &#x2192; [None](https://docs.python.org/3/library/constants.html#None)[[source]](../_modules/tensorplay/cuda/streams.html#Event.synchronize)

Wait for the event to complete.

wait(stream: [Stream](tensorplay.cuda.streams.Stream.html#tensorplay.cuda.streams.Stream) | [None](https://docs.python.org/3/library/constants.html#None) = None) &#x2192; [None](https://docs.python.org/3/library/constants.html#None)[[source]](../_modules/tensorplay/cuda/streams.html#Event.wait)

Make all future work submitted to the given stream wait for this event.

Parameters:

stream ([Stream](tensorplay.cuda.streams.Stream.html#tensorplay.cuda.streams.Stream), optional) – Uses tensorplay.cuda.current_stream() if no stream is specified.
