benchmarks-mv
Measurement harnesses and evidence bundles for AIEN on the NVIDIA DGX Spark GB10. Speed is reported against the machine's physical limit and my own previous run. Attachment of AienOS.
Brought by drakestapleton
benchmarks-mv / src / harness / system.rs
| 1 | // SPDX-License-Identifier: Apache-2.0 |
| 2 | // Copyright 2026 Drake Stapleton (AIEN / aien-dev) |
| 3 | // |
| 4 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | // you may not use this file except in compliance with the License. |
| 6 | // You may obtain a copy of the License at |
| 7 | // |
| 8 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | // |
| 10 | // Unless required by applicable law or agreed to in writing, software |
| 11 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | // See the License for the specific language governing permissions and |
| 14 | // limitations under the License. |
| 15 | |
| 16 | use crate::models::{EnvironmentInfo, HardwareInfo}; |
| 17 | use std::fs; |
| 18 | use std::process::Command; |
| 19 | |
| 20 | pub fn detect_hardware() -> HardwareInfo { |
| 21 | let mut system = "POSIX Compliant Workstation".to_string(); |
| 22 | let mut processor = std::env::consts::ARCH.to_string(); |
| 23 | let architecture = std::env::consts::ARCH.to_string(); |
| 24 | let mut memory_unified_gb = 16u32; |
| 25 | let os = format!("{} {}", std::env::consts::OS, std::env::consts::FAMILY); |
| 26 | |
| 27 | // Try reading Linux /proc/cpuinfo |
| 28 | if let Ok(cpuinfo) = fs::read_to_string("/proc/cpuinfo") { |
| 29 | for line in cpuinfo.lines() { |
| 30 | if line.starts_with("model name") |
| 31 | || line.starts_with("Processor") |
| 32 | || line.starts_with("Hardware") |
| 33 | { |
| 34 | if let Some(val) = line.split(':').nth(1) { |
| 35 | processor = val.trim().to_string(); |
| 36 | break; |
| 37 | } |
| 38 | } |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | // Try reading Linux device model |
| 43 | if let Ok(model) = fs::read_to_string("/proc/device-tree/model") { |
| 44 | let trimmed = model.trim_matches('\0').trim(); |
| 45 | if !trimmed.is_empty() { |
| 46 | system = trimmed.to_string(); |
| 47 | } |
| 48 | } else if let Ok(hostname) = fs::read_to_string("/etc/hostname") { |
| 49 | let trimmed = hostname.trim(); |
| 50 | if trimmed.contains("spark") { |
| 51 | system = "NVIDIA DGX Spark".to_string(); |
| 52 | } else { |
| 53 | system = trimmed.to_string(); |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | // Try reading Linux memory |
| 58 | if let Ok(meminfo) = fs::read_to_string("/proc/meminfo") { |
| 59 | for line in meminfo.lines() { |
| 60 | if line.starts_with("MemTotal:") { |
| 61 | let parts: Vec<&str> = line.split_whitespace().collect(); |
| 62 | if parts.len() >= 2 { |
| 63 | if let Ok(kb) = parts[1].parse::<u64>() { |
| 64 | memory_unified_gb = (kb / (1024 * 1024)) as u32; |
| 65 | } |
| 66 | } |
| 67 | break; |
| 68 | } |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | // Refine system strings if Grace Blackwell |
| 73 | if processor.contains("Neoverse") || system.contains("DGX") || system.contains("Spark") { |
| 74 | if system == "POSIX Compliant Workstation" { |
| 75 | system = "NVIDIA DGX Spark".to_string(); |
| 76 | } |
| 77 | if processor == "aarch64" || processor.is_empty() { |
| 78 | processor = "NVIDIA Grace Blackwell (GB10, aarch64)".to_string(); |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | HardwareInfo { |
| 83 | system, |
| 84 | processor, |
| 85 | architecture, |
| 86 | memory_unified_gb, |
| 87 | os, |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | pub fn detect_environment(concurrency: u32, requests: u32, warmup: u32) -> EnvironmentInfo { |
| 92 | let rustc_version = Command::new("rustc") |
| 93 | .arg("--version") |
| 94 | .output() |
| 95 | .map(|o| String::from_utf8_lossy(&o.stdout).trim().to_string()) |
| 96 | .unwrap_or_else(|_| "rustc unknown".to_string()); |
| 97 | |
| 98 | let kernel_version = Command::new("uname") |
| 99 | .arg("-r") |
| 100 | .output() |
| 101 | .map(|o| String::from_utf8_lossy(&o.stdout).trim().to_string()) |
| 102 | .unwrap_or_else(|_| "kernel unknown".to_string()); |
| 103 | |
| 104 | let page_size_kb = get_page_size_kb(); |
| 105 | |
| 106 | EnvironmentInfo { |
| 107 | rustc_version, |
| 108 | kernel_version, |
| 109 | page_size_kb, |
| 110 | concurrency_tested: concurrency, |
| 111 | requests_per_endpoint: requests, |
| 112 | warmup_requests: warmup, |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | fn get_page_size_kb() -> u32 { |
| 117 | if let Ok(output) = Command::new("getconf").arg("PAGESIZE").output() { |
| 118 | let text = String::from_utf8_lossy(&output.stdout).trim().to_string(); |
| 119 | if let Ok(bytes) = text.parse::<u32>() { |
| 120 | if bytes > 0 { |
| 121 | return bytes / 1024; |
| 122 | } |
| 123 | } |
| 124 | } |
| 125 | 4 |
| 126 | } |