Skip to main content

Module sys

Module sys 

Source
Expand description

Host-system probes: hostname, OS user, VRAM.

Every probe emits a structured tracing breadcrumb so an operator can tell from the logs why a worker reports the values it does (in particular, why VRAM came back as 0.0 — was the sysfs tree missing, present-but-unparseable, or is the worker running on a non-Linux host?). Silent 0.0 makes “this worker claims nothing” impossible to diagnose from logs alone.

Functions§

detect_vram_gb
Detect physical VRAM on the host, in GB. Returns 0.0 when we can’t probe (no NVIDIA GPU, no driver) — the engine still runs in synthetic mode for low-end / CI machines.
detect_vram_gb_from_amd_sysfs
Sum VRAM across every AMD/Intel-discrete GPU exposed under the DRM sysfs tree (<root>/card*/device/mem_info_vram_total, a byte count). Integrated GPUs and drivers that don’t publish the file simply contribute nothing, so an iGPU-only box returns 0 and the caller keeps the configured threshold as its only signal.
detect_vram_gb_from_sysfs
VRAM probe driven by a configurable sysfs root. Public-in-crate so the integration tests can exercise both the “missing root” and “populated root” branches without a real /proc/driver/nvidia tree.
machine_name
parse_amd_vram_total_bytes
Parse an AMD mem_info_vram_total file: a single decimal byte count, possibly with trailing whitespace.
parse_sysctl_memsize
Parse sysctl -n hw.memsize (total RAM in bytes) into a usable VRAM figure for Apple unified memory. fraction is the share of unified memory we treat as GPU-addressable (macOS lets the GPU use most of it; 0.75 is a conservative, widely-cited figure).
parse_wmic_adapter_ram
Sum the AdapterRAM values from a Windows CIM/WMIC Win32_VideoController dump (one integer per adapter, bytes). Ignores non-numeric lines (headers, blanks) so it tolerates both wmic and PowerShell Get-CimInstance output shapes.
username