Struct Stream

Source
pub struct Stream<'a> { /* private fields */ }
Expand description

A stream of asynchronous operations operating in a Context

Implementations§

Source§

impl<'a> Stream<'a>

Source

pub fn new(_handle: &Rc<Handle<'a>>) -> CudaResult<Self>

Creates a new stream for a handle

Source

pub fn sync(&mut self) -> CudaResult<()>

Drives all pending tasks on the stream to completion

Source

pub fn is_synced(&self) -> CudaResult<bool>

Returns Ok(true) if the stream has finished processing all queued tasks.

Source

pub fn wait_32<'b>( &'b mut self, addr: &'b DevicePtr<'a>, value: u32, mode: WaitValueMode, flush: bool, ) -> CudaResult<()>

Wait for a 4-byte value in a specific location to compare to value by mode.

Source

pub fn wait_64<'b>( &mut self, addr: &'b DevicePtr<'a>, value: u64, mode: WaitValueMode, flush: bool, ) -> CudaResult<()>

Wait for a 8-byte value in a specific location to compare to value by mode.

Source

pub fn write_32<'b>( &'b mut self, addr: &'b DevicePtr<'a>, value: u32, no_memory_barrier: bool, ) -> CudaResult<()>

Writes a 4-byte value to device memory asynchronously

Source

pub fn write_64<'b>( &'b mut self, addr: &'b DevicePtr<'a>, value: u64, no_memory_barrier: bool, ) -> CudaResult<()>

Writes a 8-byte value to device memory asynchronously

Source

pub fn callback<F: FnOnce() + Send + Sync>( &mut self, callback: F, ) -> CudaResult<()>

Calls a callback closure function callback once all prior tasks in the Stream have been driven to completion. Note that it is a memory leak to drop the stream before this callback is called. The callback is not guaranteed to be called if the stream errors out. Also note that it is erroneous in libcuda to make any calls to libcuda from this callback. The callback is called from a CUDA internal thread, however this is an implementation detail of libcuda and not guaranteed.

Source

pub unsafe fn launch<'b, D1: Into<Dim3>, D2: Into<Dim3>, K: KernelParameters>( &mut self, f: &Function<'a, 'b>, grid_dim: D1, block_dim: D2, shared_mem_size: u32, parameters: K, ) -> CudaResult<()>

Launch a CUDA kernel on this Stream with the given grid_dim grid dimensions, block_dim block dimensions, shared_mem_size allocated shared memory pool, and parameters kernel parameters. It is undefined behavior to pass in parameters that do not conform to the passes CUDA kernel. If the argument count is wrong, CUDA will generally throw an error. If your parameters is accurate to the kernel definition, then this function is otherwise safe.

Trait Implementations§

Source§

impl<'a> Drop for Stream<'a>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Stream<'a>

§

impl<'a> RefUnwindSafe for Stream<'a>

§

impl<'a> !Send for Stream<'a>

§

impl<'a> !Sync for Stream<'a>

§

impl<'a> Unpin for Stream<'a>

§

impl<'a> UnwindSafe for Stream<'a>

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> 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, 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.