Skip to main content

Device

Struct Device 

Source
pub struct Device {
    pub name: String,
    pub description: String,
    pub kind: String,
    pub device_type: DeviceType,
    pub device_id: Option<String>,
    pub memory_total: u64,
    pub memory_free: u64,
    pub index: Option<usize>,
}
Expand description

One registered compute device.

Fields§

§name: String

ggml device name, e.g. “Metal”.

§description: String

Human-readable description, e.g. “Apple M4 Max”.

§kind: String

Classified vendor kind: “cpu”, “accel”, “metal”, “vulkan”, “cuda”, “sycl”, “gpu”, or “unknown”.

§device_type: DeviceType

The CPU/GPU/IGPU/ACCEL axis, orthogonal to Device::kind.

§device_id: Option<String>

Stable hardware id when the backend reports one (PCI bus id for PCI devices), or None (e.g. Metal).

§memory_total: u64

Reported device memory capacity in bytes, or 0 if unreported.

§memory_free: u64

Available device memory in bytes — a snapshot at the time this was queried, or 0 if unreported. Re-query (via devices or crate::Model::device) to refresh it; the value is backend-defined and not comparable across device kinds.

§index: Option<usize>

Registry index of this device — the value to pass as ModelOptions::gpu_device to select it (0 means auto: discrete GPUs are probed before integrated). None when this Device came from crate::Model::device, since transcribe_model_get_device does not expose an index; correlate such a device back to devices by device_id / name instead. Order-dependent and not stable across driver updates or hosts.

Trait Implementations§

Source§

impl Clone for Device

Source§

fn clone(&self) -> Device

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Device

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Device

Source§

impl PartialEq for Device

Source§

fn eq(&self, other: &Device) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Device

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.