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,
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
Truethis event will record timing data.get_event_elapsed_time()can be used to measure the time between two events created withenable_timing=Trueand recorded onto streams.interprocess (bool) – If
Truethis event may be used as an interprocess event.
- Raises:
RuntimeError – The event could not be created.
ValueError – The combination of
enable_timing=Trueandinterprocess=Trueis not allowed.
Methods
__init__([device, cuda_event, ...])Initializes the event on a CUDA device.
Return a CUDA IPC handle of the event as a 64-byte
bytesobject.Attributes
A boolean indicating whether all work on the stream when the event was recorded has completed.
- ipc_handle()[source]#
Return a CUDA IPC handle of the event as a 64-byte
bytesobject.The event must have been created with
interprocess=Truein 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: