current_stream
该功能用于获取指定 CUDA 设备上当前正在使用的计算流(Stream)。
参数
- device (int | str | CUDAPlace | CustomPlace | None,可选) – 指定需要查询的设备。
None:获取当前设备上的默认计算流。
int:设备索引,例如 0 表示 cuda:0。
str:设备字符串,例如 'cuda:0' 或 'gpu:1'。
CUDAPlace:Paddle 的 CUDAPlace 对象。
CustomPlace:Paddle 的自定义设备 Place 对象。
返回
core.CUDAStream,当前设备对应的 CUDA 计算流对象。
代码示例
>>> import paddle
# Get the current stream on the default CUDA device
>>> s1 = paddle.cuda.current_stream()
>>> print(s1)
# Get the current stream on device cuda:0
>>> s2 = paddle.cuda.current_stream("cuda:0")
>>> print(s2)