Stream¶
- class paddle.device. Stream ( device=None, priority=2, stream_base=None ) [source]
-
A device stream wrapper around StreamBase. :param device: Which device the stream runn on. If device is None, the device is the current device. Default: None.
It can be
gpu
,gpu:x
,``custom_device``,custom_device:x
, wherecustom_device
is the name of CustomDevicec, wherex
is the index of the GPUs, XPUs. And it can be paddle.CUDAPlace(n) or paddle.CustomPlace(n).- Parameters
-
priority (int, optional) – priority of the CUDA stream. Can be either 1 (high priority) or 2 (low priority). By default, streams have priority 2.
- Returns
-
The stream.
- Return type
-
Stream
Examples
-
wait_event
(
event
)
wait_event¶
-
Makes all future work submitted to the stream wait for an event. :param event: an event to wait for. :type event: Event
- Returns
-
None.
Examples
-
wait_stream
(
stream
)
wait_stream¶
-
Synchronizes with another stream. All future work submitted to this stream will wait until all kernels submitted to a given stream at the time of call complete. :param stream: a stream to synchronize. :type stream: Stream
- Returns
-
None.
Examples
-
record_event
(
event=None
)
record_event¶
-
Records an event. :param event: event to record. If not given, a new one
will be allocated.
- Returns
-
Recorded event.
- Return type
-
Event
Examples
-
query
(
)
query¶
-
Checks if all the work submitted has been completed. :returns: Whether all kernels in this stream are completed. :rtype: bool
Examples