all-smi 0.26.2

Command-line utility for monitoring GPU hardware. It provides a real-time view of GPU utilization, memory usage, temperature, power consumption, and other metrics.
Documentation
// Copyright 2025 Lablup Inc. and Jeongkyu Shin
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Module for device readers with reduced code duplication

// Chassis-level monitoring (node power, thermal, BMC)
pub mod chassis;

// Common caching utilities shared across all readers
pub mod common_cache;

// `GpuInfo::detail` key conventions (`Metrics Source`, `Source: <field>`).
// Unconditional on purpose: the layers that write these keys sit behind
// disjoint `cfg` gates and cannot call helpers held inside one another.
pub mod detail_keys;

// Native Apple Silicon reader using IOReport/SMC (no sudo required)
#[cfg(target_os = "macos")]
pub mod apple_silicon_native;

pub mod furiosa;
pub mod gaudi;
#[cfg(target_os = "linux")]
pub mod google_tpu;
pub mod nvidia;
pub mod nvidia_hardware;
pub mod nvidia_jetson;
pub mod nvidia_mig;
pub mod nvidia_vgpu;
pub mod rebellions;
#[cfg(target_os = "linux")]
pub mod tpu_grpc;
#[cfg(target_os = "linux")]
pub mod tpu_info_runner;
#[cfg(target_os = "linux")]
pub mod tpu_pjrt;
#[cfg(target_os = "linux")]
pub mod tpu_sysfs;

#[cfg(target_os = "linux")]
pub mod tenstorrent;

// The main crate owns only a runtime loader. The companion cdylib keeps
// `libamdgpu_top` and its libdrm linkage out of every consumer binary.
#[cfg(all(target_os = "linux", not(target_env = "musl")))]
pub mod amd;
#[cfg(all(target_os = "linux", not(target_env = "musl")))]
pub mod amd_plugin_api;

#[cfg(target_os = "windows")]
pub mod amd_windows;

// Intel client GPU (Arc / Iris / Xe) — see issue #244. Sysfs on Linux,
// WMI on Windows. The PCI-ID name lookup and low-level sysfs helpers
// live in sibling modules so the per-OS reader files stay small.
// `intel_gpu_names` is platform-agnostic (pure string matching) and is
// available on both Linux and Windows so the architecture / SYCL
// classification can be reused by both per-OS readers and by external
// consumers of the library.
#[cfg(target_os = "linux")]
pub mod intel_gpu_engine;
#[cfg(target_os = "linux")]
pub mod intel_gpu_fdinfo;
#[cfg(target_os = "linux")]
pub mod intel_gpu_gtidle;
// Intel Level Zero (oneAPI) backend. Cross-platform FFI shim that prefers
// Sysman metrics per field when available, while keeping sysfs/WMI as the
// baseline and fallback.
//
// `all_smi_level_zero` is emitted by `build.rs` for every Linux and
// Windows target, and for nothing else. The backend adds no dependency
// (the loader is `dlopen`d) and opens nothing on a machine with no Intel
// GPU, so there is no build worth opting out of; the `level_zero` cargo
// feature survives only as an accepted no-op.
#[cfg(all_smi_level_zero)]
pub mod intel_gpu_level_zero;
#[cfg(target_os = "linux")]
pub mod intel_gpu_linux;
// The `test` arm is load-bearing for the same reason it is on
// `windows_gpu_perf` below. The discrete/integrated and architecture rules
// live here, the Windows reader that consumes them is never compiled by any
// runner this project has, and a wrong rule there is invisible until it
// reaches a user's machine. That is how the B390 shipped misclassified
// (issue #364). Compiling under `cfg(test)` everywhere puts the rules in
// front of every test runner, including a macOS development host.
#[cfg(any(target_os = "linux", target_os = "windows", test))]
pub mod intel_gpu_names;
// The helpers themselves only use portable filesystem APIs, so keep their unit
// tests available on non-Linux development hosts as well.
#[cfg(any(target_os = "linux", test))]
pub mod intel_gpu_sysfs;

#[cfg(target_os = "windows")]
pub mod intel_gpu_windows;

// Vendor-neutral Windows GPU metrics (DXGI + PDH).
//
// The `test` arm is load-bearing, not incidental. No CI job builds this
// crate for Windows at all, so the counter-instance parsing, the
// utilization aggregation, and the WMI-to-adapter pairing would ship
// with zero automated coverage if this were gated on Windows alone.
// Compiling it under `cfg(test)` everywhere puts that logic in front of
// the Linux test runner, which is the only runner this repository
// actually has. Same shape as `intel_gpu_sysfs` above.
#[cfg(any(target_os = "windows", test))]
pub mod windows_gpu_perf;

// AMD ADL sensor augmentation (temperature, power, fan, clocks) layered
// on top of `windows_gpu_perf`. Gated the same way and for the same
// reason: the sensor-index mapping and the field application are the
// parts most likely to be wrong, so they must reach the Linux test
// runner.
#[cfg(any(target_os = "windows", test))]
pub mod amd_adl;