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>,
/* private fields */
}Expand description
One registered compute device.
Fields§
§name: Stringggml device name, e.g. “Metal”.
description: StringHuman-readable description, e.g. “Apple M4 Max”.
kind: StringClassified vendor kind: “cpu”, “accel”, “metal”, “vulkan”, “cuda”, “rocm”, “sycl”, “gpu”, or “unknown”.
device_type: DeviceTypeThe 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: u64Reported device memory capacity in bytes, or 0 if unreported.
memory_free: u64Available 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 when this device came from devices. This is useful
for display only; pass the Device itself to [ModelOptions] for
exact selection. Registry indices are not stable across processes.