pub struct GpuContext { /* private fields */ }
Expand description
GPU context for managing multiple devices
Implementations§
Source§impl GpuContext
impl GpuContext
Sourcepub fn set_device(&mut self, device_id: u32) -> Result<()>
pub fn set_device(&mut self, device_id: u32) -> Result<()>
Set current active device
Sourcepub fn current_device_info(&self) -> &DeviceInfo
pub fn current_device_info(&self) -> &DeviceInfo
Get current device information
Sourcepub fn all_devices(&self) -> &[DeviceInfo]
pub fn all_devices(&self) -> &[DeviceInfo]
Get all device information
Sourcepub fn enable_mixed_precision(&mut self, config: MixedPrecisionConfig)
pub fn enable_mixed_precision(&mut self, config: MixedPrecisionConfig)
Enable mixed precision training
Sourcepub fn memory_stats(&self, device_id: u32) -> Result<MemoryStats>
pub fn memory_stats(&self, device_id: u32) -> Result<MemoryStats>
Get memory statistics for a device
Sourcepub fn allocate_memory(
&self,
size: u64,
device_id: u32,
) -> Result<GpuMemoryHandle>
pub fn allocate_memory( &self, size: u64, device_id: u32, ) -> Result<GpuMemoryHandle>
Allocate GPU memory (simulated)
Sourcepub fn free_memory(&self, handle: &GpuMemoryHandle) -> Result<()>
pub fn free_memory(&self, handle: &GpuMemoryHandle) -> Result<()>
Free GPU memory
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GpuContext
impl RefUnwindSafe for GpuContext
impl Send for GpuContext
impl Sync for GpuContext
impl Unpin for GpuContext
impl UnwindSafe for GpuContext
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> 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