Stream

Struct Stream 

Source
pub struct Stream { /* private fields */ }
Expand description

Wrapper around a CUDA stream.

A CUDA stream is a linear sequence of execution that belongs to a specific device, independent from other streams. See the documentation for torch.cuda.Stream for more details.

Implementations§

Source§

impl Stream

Source

pub fn new() -> Self

Create a new stream on the current device, at priority 0.

Source

pub fn clone_ref(&self, py: Python<'_>) -> Self

Clone this stream reference. Requires holding the GIL.

Source

pub fn new_with_device(device: CudaDevice) -> Self

Create a new stream on the specified device, at priority 0.

Source

pub fn get_current_stream() -> Self

Get the current stream on the current device.

Source

pub fn get_current_stream_on_device(device: CudaDevice) -> Self

Get the current stream on the specified device.

Source

pub fn set_current_stream(stream: &Stream)

Set the provided stream as the current stream. Also sets the current device to be the same as the stream’s device.

Source

pub fn wait_event(&self, event: &mut Event)

Make all future work submitted to this stream wait for an event.

Source

pub fn wait_stream(&self, stream: &Stream)

Synchronize 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 entry complete.

Source

pub fn record_event(&self, event: Option<Event>) -> Event

Record an event on this stream. If no event is provided one will be created.

Source

pub fn query(&self) -> bool

Check if all work submitted to this stream has completed.

Source

pub fn synchronize(&self)

Wait for all kernels in this stream to complete.

Source

pub fn stream(&self) -> cudaStream_t

Trait Implementations§

Source§

impl Clone for Stream

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Stream

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'__derive_more_into> From<&'__derive_more_into Stream> for &'__derive_more_into PyObject

Source§

fn from(value: &'__derive_more_into Stream) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Stream

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

§

impl Freeze for Stream

§

impl !RefUnwindSafe for Stream

§

impl Send for Stream

§

impl Sync for Stream

§

impl Unpin for Stream

§

impl UnwindSafe for Stream

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Ungil for T
where T: Send,