1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
// 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.
//! # all-smi
//!
//! A cross-platform library for monitoring GPU, NPU, CPU, and memory hardware.
//!
//! `all-smi` provides a unified API for querying hardware metrics across multiple
//! platforms and device types including NVIDIA GPUs, AMD GPUs, Apple Silicon,
//! Intel Gaudi NPUs, Google TPUs, Tenstorrent, Rebellions, and Furiosa NPUs.
//!
//! ## Quick Start
//!
//! ```rust,no_run
//! use all_smi::{AllSmi, Result};
//!
//! fn main() -> Result<()> {
//! // Initialize with auto-detection
//! let smi = AllSmi::new()?;
//!
//! // Get all GPU/NPU information
//! for gpu in smi.get_gpu_info() {
//! println!("{}: {}% utilization, {:.1}W",
//! gpu.name, gpu.utilization, gpu.power_consumption);
//! }
//!
//! // Get CPU information
//! for cpu in smi.get_cpu_info() {
//! println!("{}: {:.1}% utilization", cpu.cpu_model, cpu.utilization);
//! }
//!
//! // Get memory information
//! for mem in smi.get_memory_info() {
//! println!("Memory: {:.1}% used", mem.utilization);
//! }
//!
//! Ok(())
//! }
//! ```
//!
//! ## Using the Prelude
//!
//! For convenience, you can import all common types with the prelude:
//!
//! ```rust,no_run
//! use all_smi::prelude::*;
//!
//! fn main() -> Result<()> {
//! let smi = AllSmi::new()?;
//! let gpus: Vec<GpuInfo> = smi.get_gpu_info();
//! println!("Found {} GPU(s)", gpus.len());
//! Ok(())
//! }
//! ```
//!
//! ## Platform Support
//!
//! | Platform | GPUs | NPUs | CPU | Memory |
//! |----------|------|------|-----|--------|
//! | Linux | NVIDIA, AMD | Gaudi, TPU, Tenstorrent, Rebellions, Furiosa | Yes | Yes |
//! | macOS (Apple Silicon) | Apple Silicon | - | Yes | Yes |
//! | macOS (Intel) | - | - | Yes | Yes |
//! | Windows | NVIDIA, AMD | - | Yes | Yes |
//!
//! Intel Macs report CPU, memory, and chassis metrics (temperature, fan speeds,
//! approximate total power) without sudo. GPU monitoring for their integrated
//! Intel and discrete AMD graphics is not implemented.
//!
//! ## Features
//!
//! - **GPU Monitoring**: Utilization, memory, temperature, power, frequency
//! - **NPU Monitoring**: Intel Gaudi, Google TPU, Tenstorrent, Rebellions, Furiosa
//! - **CPU Monitoring**: Utilization, frequency, temperature, P/E cores (Apple Silicon)
//! - **Memory Monitoring**: System RAM, swap, buffers, cache
//! - **Process Monitoring**: GPU processes with memory usage
//! - **Chassis Monitoring**: Total power, thermal pressure, fan speeds
// =============================================================================
// Public Library API
// =============================================================================
/// High-level client API for hardware monitoring.
/// Unified error types for the library.
/// Prelude module for convenient imports.
// Re-export main types at crate root for convenience
pub use ;
pub use ;
// =============================================================================
// Internal Modules (also exported for advanced usage and testing)
// =============================================================================
/// Prometheus metric exporters and HTTP handlers used by `all-smi api` mode.
///
/// Exposed for integration tests that need to assert on the exact exporter
/// output. The HTTP handler side of the module depends on the `cli` feature
/// because it pulls in [`app_state`], `axum`, and `tower-http`.
/// Device readers and types for GPU, CPU, memory monitoring.
/// Parsing utilities and macros.
/// Application state management.
/// Command-line interface definitions.
/// Config subcommand argument types (issue #192). Kept separate so
/// [`cli`] stays under the 500-line soft limit; re-exported from `cli`
/// for ergonomic downstream `use crate::cli::...` call sites.
/// Service subcommand argument types (issue #309). Same rationale as
/// [`cli_config`]; re-exported from `cli`.
/// Cross-platform service-management backends for `all-smi api`
/// (issue #309).
///
/// Exposed from the library so the backend contract
/// ([`service_cmd::ServiceBackend`] and friends) is documented and unit
/// tested independently of the binary, and so the follow-up macOS
/// (#310) and Windows (#311) backends have a stable place to land.
/// Self-diagnosis and support-bundle subcommand (issue #188).
///
/// Exposed under `cli` because the orchestrator depends on tokio + clap
/// and the `anyhow` error plumbing used by every other CLI entry point.
/// Cluster metrics aggregation, coordination, and energy accounting.
///
/// Gated on `cli` because `coordinator` and `energy` both depend on
/// [`app_state`], and the Prometheus / TUI callers only exist in that
/// feature tree.
/// Network client for remote monitoring.
/// Storage monitoring.
/// Common traits for collectors and exporters.
/// Terminal UI components.
/// One-shot snapshot subcommand (JSON / CSV / Prometheus).
///
/// Gated on `cli` because it reuses the Prometheus exporters from
/// [`api::metrics`], which themselves depend on the CLI feature tree.
/// Re-export of the snapshot entry point for programmatic use.
///
/// See [`snapshot::run`] for the full contract, including the note on
/// blocking-pool leaks when a reader times out. Embedding callers should
/// provision a conservative
/// [`tokio::runtime::Builder::max_blocking_threads`] to bound the blast
/// radius — the CLI in `main.rs` uses a dedicated short-lived runtime with
/// `max_blocking_threads(32)` per snapshot invocation.
pub use ;
/// Utility functions.
/// Configuration module.