pub struct DeviceManager { /* private fields */ }Expand description
Device manager for querying available devices.
Implementations§
Source§impl DeviceManager
impl DeviceManager
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new 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 DeviceManager
impl Clone for DeviceManager
Source§fn clone(&self) -> DeviceManager
fn clone(&self) -> DeviceManager
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 DeviceManager
impl Debug for DeviceManager
Auto Trait Implementations§
impl Freeze for DeviceManager
impl RefUnwindSafe for DeviceManager
impl Send for DeviceManager
impl Sync for DeviceManager
impl Unpin for DeviceManager
impl UnwindSafe for DeviceManager
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