cuda.core.system._system_events.RegisteredSystemEvents#
- class cuda.core.system._system_events.RegisteredSystemEvents(
- events: SystemEventType | str | list[SystemEventType | str],
Represents a set of events that can be waited on for a specific device.
Methods
- __init__(*args, **kwargs)#
- wait(
- self,
- int timeout_ms: int = 0,
- int buffer_size: int = 1,
Wait for events in the system event set.
For Fermi™ or newer fully supported devices.
If some events are ready to be delivered at the time of the call, function returns immediately. If there are no events ready to be delivered, function sleeps till event arrives but not longer than specified timeout. If timeout passes, a
cuda.core.system.TimeoutErroris raised. This function in certain conditions can return before specified timeout passes (e.g. when interrupt arrives)- Parameters:
- Returns:
A set of events that were received. The number of events returned may be less than the specified buffer size if fewer events were available.
- Return type:
SystemEvents- Raises:
cuda.core.system.TimeoutError – If the timeout expires before an event is received.
cuda.core.system.GpuIsLostError – If the GPU has fallen off the bus or is otherwise inaccessible.
ValueError – If
buffer_sizeis less than 1.
Notes
Waits on this event set are serialized by a lock. A synchronous wait can block while another wait is running; use
wait_async()from an event loop.
- async wait_async( ) SystemEvents#
Wait asynchronously for events in the system event set.
Waits without blocking the event loop. Unlike
wait(), a timeout of 0 waits indefinitely. The native wait is issued in bounded slices, so cancelling the awaiting task stops the wait within a slice instead of parking a thread for the remaining timeout. A batch that a cancelled slice already consumed is delivered to the next wait on this event set, onebuffer_sizeslice at a time, rather than being dropped.- Parameters:
- Returns:
A set of events that were received. The number of events returned may be less than the specified buffer size if fewer events were available.
- Return type:
SystemEvents- Raises:
cuda.core.system.TimeoutError – If the timeout expires before an event is received.
cuda.core.system.GpuIsLostError – If the GPU has fallen off the bus or is otherwise inaccessible.
ValueError – If
timeout_msis negative orbuffer_sizeis less than 1.
Notes
Waits on this event set are serialized by a lock. Time spent waiting for another consumer counts against the timeout budget. If a native error occurs while a cancelled wait is draining, it is raised by the next wait on this event set; the cancelled task still propagates
asyncio.CancelledError.