pub struct SystemDeviceManager { /* private fields */ }Expand description
System device manager for querying available hardware devices.
This type enumerates and tracks all compute devices available on the current
system (CPU, CUDA GPUs, etc.). For operation-level device selection based
on tensor shape and op kind, see crate::device_manager::DeviceManager.
Implementations§
Source§impl SystemDeviceManager
impl SystemDeviceManager
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new system device manager.
This queries the system for available devices, including CUDA GPUs if available via nvidia-smi.
Sourcepub fn available_devices(&self) -> &[Device]
pub fn available_devices(&self) -> &[Device]
Get the list of available devices.
Sourcepub fn default_device(&self) -> &Device
pub fn default_device(&self) -> &Device
Get the default device.
Sourcepub fn set_default_device(&mut self, device: Device) -> Result<(), DeviceError>
pub fn set_default_device(&mut self, device: Device) -> Result<(), DeviceError>
Set the default device.
Sourcepub fn is_available(&self, device: &Device) -> bool
pub fn is_available(&self, device: &Device) -> bool
Check if a device is available.
Sourcepub fn get_device(
&self,
device_type: DeviceType,
index: usize,
) -> Option<&Device>
pub fn get_device( &self, device_type: DeviceType, index: usize, ) -> Option<&Device>
Get a device by type and index.
Sourcepub fn count_devices(&self, device_type: DeviceType) -> usize
pub fn count_devices(&self, device_type: DeviceType) -> usize
Count devices of a specific type.
Trait Implementations§
Source§impl Clone for SystemDeviceManager
impl Clone for SystemDeviceManager
Source§fn clone(&self) -> SystemDeviceManager
fn clone(&self) -> SystemDeviceManager
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 SystemDeviceManager
impl Debug for SystemDeviceManager
Auto Trait Implementations§
impl Freeze for SystemDeviceManager
impl RefUnwindSafe for SystemDeviceManager
impl Send for SystemDeviceManager
impl Sync for SystemDeviceManager
impl Unpin for SystemDeviceManager
impl UnsafeUnpin for SystemDeviceManager
impl UnwindSafe for SystemDeviceManager
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