warp.Event#

class warp.Event(*args, **kwargs)[source]#

A CUDA event that can be recorded onto a stream.

Events can be used for device-side synchronization, which do not block the host thread.

__init__(
device=None,
cuda_event=None,
enable_timing=False,
interprocess=False,
)[source]#

Initializes the event on a CUDA device.

Parameters:
  • device (Device | str | None) – The CUDA device whose streams this event may be recorded onto. If None, then the current default device will be used.

  • cuda_event – A pointer to a previously allocated CUDA event. If None, then a new event will be allocated on the associated device.

  • enable_timing (bool) – If True this event will record timing data. get_event_elapsed_time() can be used to measure the time between two events created with enable_timing=True and recorded onto streams.

  • interprocess (bool) – If True this event may be used as an interprocess event.

Raises:
  • RuntimeError – The event could not be created.

  • ValueError – The combination of enable_timing=True and interprocess=True is not allowed.

Methods

__init__([device, cuda_event, ...])

Initializes the event on a CUDA device.

ipc_handle()

Return a CUDA IPC handle of the event as a 64-byte bytes object.

Attributes

is_complete

A boolean indicating whether all work on the stream when the event was recorded has completed.

class Flags[source]#
DEFAULT = 0#
BLOCKING_SYNC = 1#
DISABLE_TIMING = 2#
INTERPROCESS = 4#
ipc_handle()[source]#

Return a CUDA IPC handle of the event as a 64-byte bytes object.

The event must have been created with interprocess=True in order to obtain a valid interprocess handle.

IPC is currently only supported on Linux.

Example

Create an event and get its IPC handle:

e1 = wp.Event(interprocess=True)
event_handle = e1.ipc_handle()
Raises:

RuntimeError – Device does not support IPC.

Return type:

bytes

property is_complete: bool[source]#

A boolean indicating whether all work on the stream when the event was recorded has completed.

This property may not be accessed during a graph capture on any stream.