Struct CudaPtr

Source
pub struct CudaPtr<T> { /* private fields */ }
Expand description

Wrapper to handle cuda device memory

Implementations§

Source§

impl<T> CudaPtr<T>

Source

pub fn new(size: usize) -> Result<CudaPtr<T>, CudaError>

Create an instance of CudaPtr

§Arguments
  • size- Number of value elements to be allocated
§Errors

This function may return the following errors

Trait Implementations§

Source§

impl<T> AsMutPtr<T> for CudaPtr<T>

Source§

fn as_mut_ptr(&mut self) -> *mut T

Source§

impl<T> AsMutVoidPtr for CudaPtr<T>

Source§

impl<T> AsPtr<T> for CudaPtr<T>

Source§

impl<T> AsVoidPtr for CudaPtr<T>

Source§

impl<U, P, OP, I, PI, const N: usize> BatchNormalizationLayerInstantiation<U, CudaTensor1dPtr<U, N>, P, OP, DeviceGpu<U>, I, PI, CudaPtr<U>, N> for BatchNormalizationLayer<U, CudaTensor1dPtr<U, N>, P, OP, DeviceGpu<U>, I, PI, CudaPtr<U>, N>
where P: ForwardAll<Input = I, Output = PI> + BackwardAll<U, LossInput = PI> + PreTrain<U> + Loss<U>, U: Default + Clone + Copy + Send + UnitValue<U>, I: Debug + Send + Sync, OP: Optimizer<U, DeviceGpu<U>>, DeviceGpu<U>: Device<U>,

Source§

fn with_params<B: OptimizerBuilder<U, DeviceGpu<U>, Output = OP>>( parent: P, device: &DeviceGpu<U>, scale: Arr<U, N>, bias: Arr<U, N>, momentum: U, b: &B, ) -> Result<BatchNormalizationLayer<U, CudaTensor1dPtr<U, N>, P, OP, DeviceGpu<U>, I, PI, CudaPtr<U>, N>, LayerInstantiationError>

Create and return an instance with the specified scale, bias, and momentum. Read more
Source§

fn with_momentum<B: OptimizerBuilder<U, DeviceGpu<U>, Output = OP>>( parent: P, device: &DeviceGpu<U>, momentum: U, b: &B, ) -> Result<BatchNormalizationLayer<U, CudaTensor1dPtr<U, N>, P, OP, DeviceGpu<U>, I, PI, CudaPtr<U>, N>, LayerInstantiationError>

Create and return an instance with the momentum. Read more
Source§

fn new<B: OptimizerBuilder<U, DeviceGpu<U>, Output = OP>>( parent: P, device: &DeviceGpu<U>, b: &B, ) -> Result<BatchNormalizationLayer<U, CudaTensor1dPtr<U, N>, P, OP, DeviceGpu<U>, I, PI, CudaPtr<U>, N>, LayerInstantiationError>

Create and return an instance. Read more
Source§

impl<T: Debug> Debug for CudaPtr<T>

Source§

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

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

impl<T> Drop for CudaPtr<T>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<CP> MemoryMoveTo<<CP as PointerElement>::Element, CudaPtr<<CP as PointerElement>::Element>> for CP

Source§

fn memcpy_to( &self, dst: &mut CudaPtr<<CP as PointerElement>::Element>, len: usize, ) -> Result<usize, Error>

Memory Copy To Read more
Source§

impl<T: Default + Debug> MemoryMoveTo<T, CudaHostPtr<T>> for CudaPtr<T>

Source§

fn memcpy_to( &self, dst: &mut CudaHostPtr<T>, len: usize, ) -> Result<usize, Error>

Memory Copy To Read more
Source§

impl<T: Default + Debug> MemoryMoveTo<T, CudaMemoryPoolPtr<T>> for CudaPtr<T>

Source§

fn memcpy_to( &self, dst: &mut CudaMemoryPoolPtr<T>, len: usize, ) -> Result<usize, Error>

Memory Copy To Read more
Source§

impl<T: Default + Debug> MemoryMoveTo<T, CudaPtr<T>> for CudaHostPtr<T>

Source§

fn memcpy_to(&self, dst: &mut CudaPtr<T>, len: usize) -> Result<usize, Error>

Memory Copy To Read more
Source§

impl<T: Default + Debug> MemoryMoveTo<T, CudaPtr<T>> for CudaMemoryPoolPtr<T>

Source§

fn memcpy_to(&self, dst: &mut CudaPtr<T>, len: usize) -> Result<usize, Error>

Memory Copy To Read more
Source§

impl<T: Default + Debug> MemoryMoveTo<T, CudaPtr<T>> for CudaPtr<T>

Source§

fn memcpy_to(&self, dst: &mut CudaPtr<T>, len: usize) -> Result<usize, Error>

Memory Copy To Read more
Source§

impl<CP> MemoryMoveToAsync<<CP as PointerElement>::Element, CudaPtr<<CP as PointerElement>::Element>> for CP

Source§

fn memcpy_to_async( &self, dst: &mut CudaPtr<<CP as PointerElement>::Element>, len: usize, stream: cudaStream_t, ) -> Result<usize, Error>

Memory Copy To Read more
Source§

impl<T: Default + Debug> MemoryMoveToAsync<T, CudaPtr<T>> for CudaHostPtr<T>

Source§

fn memcpy_to_async( &self, dst: &mut CudaPtr<T>, len: usize, stream: cudaStream_t, ) -> Result<usize, Error>

Memory Copy To Read more
Source§

impl<T> PointerElement for CudaPtr<T>
where T: Default + Debug,

Source§

impl<T: Default + Debug> ReadMemory<T> for CudaPtr<T>

Source§

fn read_to_vec(&self) -> Result<Vec<T>, Error>

Errors Read more
Source§

fn read_to_vec_with_size(&self, size: usize) -> Result<Vec<T>, Error>

Read memory as Vec with size specified Read more
Source§

impl TryFrom<f32> for CudaPtr<f32>

Source§

type Error = CudaError

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

fn try_from(value: f32) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<f64> for CudaPtr<f64>

Source§

type Error = CudaError

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

fn try_from(value: f64) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<i32> for CudaPtr<i32>

Source§

type Error = CudaError

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

fn try_from(value: i32) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<i64> for CudaPtr<i64>

Source§

type Error = CudaError

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

fn try_from(value: i64) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<T: Default + Debug> WriteMemory<T> for CudaPtr<T>

Source§

fn memcpy(&mut self, p: *const T, len: usize) -> Result<usize, Error>

Memory Copy Read more
Source§

fn memcpy_repeat( &mut self, p: *const T, len: usize, count: usize, ) -> Result<usize, Error>

Repeatedly copy the contents of memory Read more

Auto Trait Implementations§

§

impl<T> Freeze for CudaPtr<T>

§

impl<T> RefUnwindSafe for CudaPtr<T>
where T: RefUnwindSafe,

§

impl<T> !Send for CudaPtr<T>

§

impl<T> !Sync for CudaPtr<T>

§

impl<T> Unpin for CudaPtr<T>

§

impl<T> UnwindSafe for CudaPtr<T>
where T: RefUnwindSafe,

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> 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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.
Source§

impl<T> AsConstKernelPtr for T
where T: AsConstKernelPtrBase,

Source§

impl<T> AsKernelPtr for T
where T: AsKernelPtrBase,

Source§

impl<T> AsMutKernelPtr for T
where T: AsMutKernelPtrBase,