Stream¶
- class torch.xpu.Stream(device=None, priority=0, **kwargs)[source][source]¶
Wrapper around a XPU stream.
A XPU stream is a linear sequence of execution that belongs to a specific device, independent from other streams.
- Parameters
device (torch.device or int, optional) – a device on which to allocate the stream. If
device
isNone
(default) or a negative integer, this will use the current device.priority (int, optional) – priority of the stream, should be 0 or negative, where negative numbers indicate higher priority. By default, streams have priority 0.
- query()[source][source]¶
Check if all the work submitted has been completed.
- Returns
A boolean indicating if all kernels in this stream are completed.
- Return type
- record_event(event=None)[source][source]¶
Record an event.
- Parameters
event (torch.xpu.Event, optional) – event to record. If not given, a new one will be allocated.
- Returns
Recorded event.
- wait_event(event)[source][source]¶
Make all future work submitted to the stream wait for an event.
- Parameters
event (torch.xpu.Event) – an event to wait for.