pub enum CudaStorage {
F16(CudaSlice<u16>),
BF16(CudaSlice<u16>),
F32(CudaSlice<f32>),
F64(CudaSlice<f64>),
U8(CudaSlice<u8>),
U32(CudaSlice<u32>),
I64(CudaSlice<i64>),
}Expand description
Re-export CUDA backend (requires cuda feature + NVIDIA CUDA Toolkit).
GPU-side storage. Each variant wraps a cudarc CudaSlice for the corresponding dtype.
F16 and BF16 are stored as CudaSlice
Variants§
F16(CudaSlice<u16>)
BF16(CudaSlice<u16>)
F32(CudaSlice<f32>)
F64(CudaSlice<f64>)
U8(CudaSlice<u8>)
U32(CudaSlice<u32>)
I64(CudaSlice<i64>)
Implementations§
Source§impl CudaStorage
impl CudaStorage
Sourcepub fn as_cuda_slice_f32(&self) -> Result<&CudaSlice<f32>, Error>
pub fn as_cuda_slice_f32(&self) -> Result<&CudaSlice<f32>, Error>
Get the underlying CudaSlice
Sourcepub fn as_cuda_slice_u16(&self) -> Result<&CudaSlice<u16>, Error>
pub fn as_cuda_slice_u16(&self) -> Result<&CudaSlice<u16>, Error>
Get the underlying CudaSlice
Sourcepub fn from_f32_vec(
data: Vec<f32>,
device: &CudaDevice,
) -> Result<CudaStorage, Error>
pub fn from_f32_vec( data: Vec<f32>, device: &CudaDevice, ) -> Result<CudaStorage, Error>
Transfer data from host Vec
Sourcepub fn from_f64_vec(
data: Vec<f64>,
device: &CudaDevice,
) -> Result<CudaStorage, Error>
pub fn from_f64_vec( data: Vec<f64>, device: &CudaDevice, ) -> Result<CudaStorage, Error>
Transfer data from host Vec
Sourcepub fn from_f16_vec(
data: Vec<f16>,
device: &CudaDevice,
) -> Result<CudaStorage, Error>
pub fn from_f16_vec( data: Vec<f16>, device: &CudaDevice, ) -> Result<CudaStorage, Error>
Transfer data from host Vec
Sourcepub fn from_bf16_vec(
data: Vec<bf16>,
device: &CudaDevice,
) -> Result<CudaStorage, Error>
pub fn from_bf16_vec( data: Vec<bf16>, device: &CudaDevice, ) -> Result<CudaStorage, Error>
Transfer data from host Vec
Sourcepub fn to_host_f64(&self, device: &CudaDevice) -> Result<Vec<f64>, Error>
pub fn to_host_f64(&self, device: &CudaDevice) -> Result<Vec<f64>, Error>
Copy all data to host as Vec
Trait Implementations§
Source§impl BackendStorage for CudaStorage
impl BackendStorage for CudaStorage
Source§impl Clone for CudaStorage
impl Clone for CudaStorage
Source§fn clone(&self) -> CudaStorage
fn clone(&self) -> CudaStorage
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CudaStorage
impl Debug for CudaStorage
impl Send for CudaStorage
impl Sync for CudaStorage
Auto Trait Implementations§
impl Freeze for CudaStorage
impl RefUnwindSafe for CudaStorage
impl Unpin for CudaStorage
impl UnwindSafe for CudaStorage
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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