Struct DevicePtr

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

A slice into the device memory.

Implementations§

Source§

impl<'a> DevicePtr<'a>

Source

pub fn as_raw(&self) -> u64

Source

pub unsafe fn from_raw_parts(handle: Rc<Handle<'a>>, ptr: u64, len: u64) -> Self

Source

pub fn copy_to<'b>(&self, target: &DevicePtr<'b>) -> CudaResult<()>

Synchronously copies data from self to target. Panics if length is not equal.

Source

pub fn copy_to_stream<'b, 'c: 'b + 'a>( &self, target: &DevicePtr<'b>, stream: &mut Stream<'c>, ) -> CudaResult<()>
where 'a: 'b,

Asynchronously copies data from self to target. Panics if length is not equal.

Source

pub fn copy_from<'b>(&self, source: &DevicePtr<'b>) -> CudaResult<()>

Synchronously copies data from source to self. Panics if length is not equal.

Source

pub fn copy_from_stream<'b: 'a, 'c: 'a + 'b>( &self, source: &DevicePtr<'b>, stream: &mut Stream<'c>, ) -> CudaResult<()>

Asynchronously copies data from source to self. Panics if length is not equal.

Source

pub fn subslice(&self, from: u64, to: u64) -> Self

Gets a subslice of this slice from [from:to]

Source

pub fn len(&self) -> u64

Gets the length of this slice

Source

pub fn is_empty(&self) -> bool

Check if the slice’s length is 0

Source

pub fn load(&self) -> CudaResult<Vec<u8>>

Synchronously loads the data from this slice into a local buffer

Source

pub unsafe fn load_stream(&self, stream: &mut Stream<'a>) -> CudaResult<Vec<u8>>

Asynchronously loads the data from this slice into a local buffer. The contents of the buffer are undefined until stream.sync is called. The output must not be dropped until the stream is synced.

Source

pub fn store(&self, data: &[u8]) -> CudaResult<()>

Synchronously stores host data from data to self.

Source

pub fn store_stream<'b>( &self, data: &'b [u8], stream: &'b mut Stream<'a>, ) -> CudaResult<()>

Asynchronously stores host data from data to self. The data must not be dropped or mutated until stream.sync is called.

Source

pub fn store_stream_buf( &self, data: Vec<u8>, stream: &mut Stream<'a>, ) -> CudaResult<()>

Asynchronously stores host data from data to self. data will be dropped once the Stream is synced or dropped.

Source

pub fn memset_d8(&self, data: u8) -> CudaResult<()>

Synchronously set the contents of self to data repeated to fill length

Source

pub fn memset_d8_stream( &self, data: u8, stream: &mut Stream<'a>, ) -> CudaResult<()>

Asynchronously set the contents of self to data repeated to fill length

Source

pub fn memset_d16(&self, data: u16) -> CudaResult<()>

Synchronously set the contents of self to data repeated to fill length. Panics if Self::len is not a multiple of 2.

Source

pub fn memset_d16_stream( &self, data: u16, stream: &mut Stream<'a>, ) -> CudaResult<()>

Asynchronously set the contents of self to data repeated to fill length. Panics if Self::len is not a multiple of 2.

Source

pub fn memset_d32(&self, data: u32) -> CudaResult<()>

Synchronously set the contents of self to data repeated to fill length. Panics if Self::len is not a multiple of 4.

Source

pub fn memset_d32_stream( &self, data: u32, stream: &mut Stream<'a>, ) -> CudaResult<()>

Asynchronously set the contents of self to data repeated to fill length. Panics if Self::len is not a multiple of 4.

Source

pub fn handle(&self) -> &Rc<Handle<'a>>

Gets a reference to the owning handle

Trait Implementations§

Source§

impl<'a> AsRef<DevicePtr<'a>> for DeviceBox<'a>

Source§

fn as_ref(&self) -> &DevicePtr<'a>

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<'a> Clone for DevicePtr<'a>

Source§

fn clone(&self) -> DevicePtr<'a>

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<'a> KernelParameters for DevicePtr<'a>

WARNING: this is unsafe!

Source§

fn params(&self, out: &mut Vec<Vec<u8>>)

Auto Trait Implementations§

§

impl<'a> Freeze for DevicePtr<'a>

§

impl<'a> RefUnwindSafe for DevicePtr<'a>

§

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

§

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

§

impl<'a> Unpin for DevicePtr<'a>

§

impl<'a> UnwindSafe for DevicePtr<'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> 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> 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.