pub struct CudaDevice { /* private fields */ }Expand description
Re-export CUDA backend (requires cuda feature + NVIDIA CUDA Toolkit).
A CUDA device handle. Contains the cudarc device and a cuBLAS handle
for matrix multiplication. Clonable (uses Arc internally).
Implementations§
Source§impl CudaDevice
impl CudaDevice
Sourcepub fn new(ordinal: usize) -> Result<CudaDevice, Error>
pub fn new(ordinal: usize) -> Result<CudaDevice, Error>
Create a new CUDA device for the given GPU ordinal (0, 1, …). Compiles all Shrew CUDA kernels on first creation.
Sourcepub fn pool(&self) -> &CudaMemPool
pub fn pool(&self) -> &CudaMemPool
Get the memory pool.
Sourcepub fn empty_cache(&self)
pub fn empty_cache(&self)
Release all cached GPU memory back to the CUDA driver.
Sourcepub fn pool_stats(&self) -> PoolStats
pub fn pool_stats(&self) -> PoolStats
Return pool statistics (cached bytes, hits, misses, etc.).
Sourcepub fn reclaim(&self, storage: CudaStorage)
pub fn reclaim(&self, storage: CudaStorage)
Reclaim a CudaStorage buffer into the pool for future reuse.
Sourcepub fn pool_alloc_f32(&self, n: usize) -> Result<CudaSlice<f32>, Error>
pub fn pool_alloc_f32(&self, n: usize) -> Result<CudaSlice<f32>, Error>
Allocate n elements from the pool (content undefined).
pub fn pool_alloc_f64(&self, n: usize) -> Result<CudaSlice<f64>, Error>
pub fn pool_alloc_u16(&self, n: usize) -> Result<CudaSlice<u16>, Error>
pub fn pool_alloc_u8(&self, n: usize) -> Result<CudaSlice<u8>, Error>
pub fn pool_alloc_u32(&self, n: usize) -> Result<CudaSlice<u32>, Error>
pub fn pool_alloc_i64(&self, n: usize) -> Result<CudaSlice<i64>, Error>
Sourcepub fn pool_alloc_zeros_f32(&self, n: usize) -> Result<CudaSlice<f32>, Error>
pub fn pool_alloc_zeros_f32(&self, n: usize) -> Result<CudaSlice<f32>, Error>
Allocate n elements from the pool, zeroed.
pub fn pool_alloc_zeros_f64(&self, n: usize) -> Result<CudaSlice<f64>, Error>
pub fn pool_alloc_zeros_u16(&self, n: usize) -> Result<CudaSlice<u16>, Error>
pub fn pool_alloc_zeros_u8(&self, n: usize) -> Result<CudaSlice<u8>, Error>
pub fn pool_alloc_zeros_u32(&self, n: usize) -> Result<CudaSlice<u32>, Error>
pub fn pool_alloc_zeros_i64(&self, n: usize) -> Result<CudaSlice<i64>, Error>
Trait Implementations§
Source§impl BackendDevice for CudaDevice
impl BackendDevice for CudaDevice
Source§impl Clone for CudaDevice
impl Clone for CudaDevice
Source§fn clone(&self) -> CudaDevice
fn clone(&self) -> CudaDevice
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 CudaDevice
impl Debug for CudaDevice
impl Send for CudaDevice
impl Sync for CudaDevice
Auto Trait Implementations§
impl Freeze for CudaDevice
impl RefUnwindSafe for CudaDevice
impl Unpin for CudaDevice
impl UnwindSafe for CudaDevice
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