get_stream_from_external
- paddle.cuda. get_stream_from_external ( data_ptr: int, device: DeviceLike = None ) Stream [source]
-
Wrap an externally allocated CUDA stream into a Paddle
paddle.cuda.Streamobject.This function allows integrating CUDA streams allocated by other libraries into Paddle, enabling multi-library interoperability and data exchange.
Note
This function does not manage the lifetime of the external stream. It is the caller’s responsibility to ensure the external stream remains valid while the returned Paddle stream is in use.
Providing an incorrect device may result in errors during kernel launches.
- Parameters
-
data_ptr (int) – Integer representation of the external cudaStream_t.
device (DeviceLike, optional) – The device where the external stream was created. Can be a Paddle device string (e.g., “cuda:0”), an int index (e.g., 0), or a PaddlePlace (CUDAPlace). Default: None (current device).
- Returns
-
A Paddle Stream object that wraps the external CUDA stream.
- Return type
-
paddle.cuda.Stream
Examples
