cupy.cuda.Event#

class cupy.cuda.Event(block=False, disable_timing=False, interprocess=False)[source]#

CUDA event, a synchronization point of CUDA streams.

This class handles the CUDA event handle in RAII way, i.e., when an Event instance is destroyed by the GC, its handle is also destroyed.

Parameters:
  • block (bool) – If True, synchronize() uses a blocking wait instead of busy-waiting. Defaults to False.

  • disable_timing (bool) – If True, the event does not prepare the timing data.

  • interprocess (bool) – If True, the event can be passed to other processes.

Variables:

~Event.ptr (intptr_t) – Raw event handle.

Methods

record(self, stream=None)#

Records the event to a stream.

Parameters:

stream (cupy.cuda.Stream) – CUDA stream to record event. The null stream is used by default.

synchronize(self)#

Waits for all work captured by the event to complete.

The calling CPU thread waits for the event regardless of the block flag. If block=True, it uses a blocking wait; otherwise, it busy-waits.

__eq__(value, /)#

Return self==value.

__ne__(value, /)#

Return self!=value.

__lt__(value, /)#

Return self<value.

__le__(value, /)#

Return self<=value.

__gt__(value, /)#

Return self>value.

__ge__(value, /)#

Return self>=value.

Attributes

done#

True if the event is done.