systeminfo

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2026 License: Apache-2.0 Imports: 16 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package systeminfo provides the canonical SystemInfo hardware, library, clock, power, and host contention record shared across cudadiag, cudacapture, cudaflightrecorder, cuptiactivity, cudaprof, and servebench.

Index

Constants

View Source
const ContentionCPUThresholdPct = 50.0

ContentionCPUThresholdPct is the single-process CPU utilization threshold (>= 50%) that flags host CPU contention on unified-memory architectures (such as GB10 and GH200) where host CPU bandwidth contends with GPU memory.

Variables

View Source
var ErrIncompleteSystemInfo = errors.New("cudadiag: incomplete system info")

ErrIncompleteSystemInfo is returned when required hardware, clock, power, or CUDA library provenance fields are missing from a SystemInfo record.

Functions

func EvaluateHostCPUOutput

func EvaluateHostCPUOutput(psOutput, engineName string, selfPID int, unifiedMem bool) (topProcs []string, contended bool)

EvaluateHostCPUOutput parses `ps -eo pid,pcpu,comm` output, returning top non-engine processes (>= 10% CPU, up to 5) and whether host CPU contention (>= 50% CPU by a non-engine process on a unified-memory architecture) occurred.

func FinishCaptureSystemInfo

func FinishCaptureSystemInfo(ctx context.Context, info *SystemInfo, opts Options)

FinishCaptureSystemInfo updates the end-of-run clocks, power, throttle bitmask, host load average, and host CPU contention fields on an existing SystemInfo record.

func IsUnifiedMemoryGPU

func IsUnifiedMemoryGPU(gpuName, smArch string) bool

IsUnifiedMemoryGPU reports whether the given GPU model name or SM architecture represents a coherent unified-memory SoC (such as NVIDIA GB10, GB200, or GH200) where host CPU memory traffic shares package/memory bandwidth with the GPU.

func MajorMinor

func MajorMinor(v string) string

MajorMinor returns the major.minor prefix of a dotted version string. For example, MajorMinor("13.0.88") returns "13.0".

func MergeTopCPUProcs

func MergeTopCPUProcs(existing, latest []string) []string

MergeTopCPUProcs merges two slices of "<comm>(pid=<pid>):<pct>%" strings, keeping the highest observed CPU percentage per process.

func ParseNVCCVersionOutput

func ParseNVCCVersionOutput(output string) string

ParseNVCCVersionOutput extracts the version string from `nvcc --version` output.

func ParseProcMapsCUDALibs

func ParseProcMapsCUDALibs(mapsContent string, resolveSymlink func(string) string) map[string]string

ParseProcMapsCUDALibs extracts loaded CUDA/NVIDIA shared library versions from the text of a Linux /proc/<pid>/maps file. The optional resolveSymlink callback resolves symlinks (such as libcublasLt.so.12 -> libcublasLt.so.12.8.4.1) to their full versioned filenames.

func ProbeNVCCVersion

func ProbeNVCCVersion(ctx context.Context) string

ProbeNVCCVersion runs nvcc --version (searching PATH and standard CUDA toolkit locations) and returns the compiler version string (for example "12.8.93").

func ProbeProcessCUDALibs

func ProbeProcessCUDALibs(pids ...int) map[string]string

ProbeProcessCUDALibs scans /proc/<pid>/maps for the given PIDs and returns a map of loaded CUDA/NVIDIA shared library base names (such as "libcublasLt.so", "libnvrtc.so", "libcudart.so", "libcuda.so") to their resolved version strings.

func ReadLoadAvg

func ReadLoadAvg() ([3]float64, error)

ReadLoadAvg reads the 1-, 5-, and 15-minute host CPU load averages with hoststate.Sample.

func ResolveGitState

func ResolveGitState(repoDir string) (commit string, dirty bool)

ResolveGitState returns the VCS commit hash and dirty flag from embedded Go build info or by querying git in repoDir (or the current working directory).

func SampleHostCPU

func SampleHostCPU(ctx context.Context, engineName string, unifiedMem bool) (topProcs []string, contended bool)

SampleHostCPU inspects running host processes via ps and returns the top non-engine CPU processes ("<comm>(pid=<pid>):<pct>%") and whether any non-engine process uses >= 50% CPU on a unified-memory GPU.

func SharedObjectVersion

func SharedObjectVersion(filename string) (base, version string)

SharedObjectVersion splits a versioned shared object filename such as "libcublasLt.so.13.1.0.3" into ("libcublasLt.so", "13.1.0.3").

Types

type Options

type Options struct {
	// GPUIndex selects the device index to query. Negative values default to 0.
	GPUIndex int
	// EngineName identifies the workload or profiling engine (for example
	// "cudaprof", "servebench", "sglang", "vllm"). Processes matching EngineName
	// are excluded when evaluating non-engine host CPU contention.
	EngineName string
	// PIDs lists target process IDs whose /proc/<pid>/maps should be inspected
	// first for loaded CUDA shared libraries. The current process PID is always
	// included as a fallback.
	PIDs []int
	// RepoDir is an optional directory used to resolve GitCommit and GitDirty
	// when build info does not embed VCS metadata.
	RepoDir string
}

Options configures live SystemInfo collection.

type SystemInfo

type SystemInfo struct {
	Host                   string            `json:"host"`
	OS                     string            `json:"os"`
	Arch                   string            `json:"arch"`
	GPUIndex               int               `json:"gpu_index"`
	GPUName                string            `json:"gpu_name"`
	UUID                   string            `json:"uuid"`
	SMArch                 string            `json:"sm_arch"`
	SMCount                int               `json:"sm_count"`
	L2CacheBytes           int64             `json:"l2_cache_bytes"`
	DriverVersion          string            `json:"driver_version"`
	CUDADriverVersion      string            `json:"cuda_driver_version"`
	CUDARuntimeVersion     string            `json:"cuda_runtime_version"`
	CUDAToolkitVersion     string            `json:"cuda_toolkit_version"`
	CuBLASLtVersion        string            `json:"cublaslt_version"`
	NVRTCVersion           string            `json:"nvrtc_version"`
	CUDALibs               map[string]string `json:"cuda_libs,omitempty"`
	NVCCVersion            string            `json:"nvcc_version"`
	StartSMClockMHz        uint32            `json:"start_sm_clock_mhz"`
	EndSMClockMHz          uint32            `json:"end_sm_clock_mhz"`
	MaxSMClockMHz          uint32            `json:"max_sm_clock_mhz"`
	StartPowerMW           uint32            `json:"start_power_mw"`
	EndPowerMW             uint32            `json:"end_power_mw"`
	PowerLimitMW           uint32            `json:"power_limit_mw"`
	ThrottleReasonsBitmask uint64            `json:"throttle_reasons_bitmask"`
	HostLoadAvgStart       [3]float64        `json:"host_load_avg_start"`
	HostLoadAvgEnd         [3]float64        `json:"host_load_avg_end"`
	// HostLoadAvgError says why a host load average could not be read;
	// the zeros beside it are then unknown, not an idle host.
	HostLoadAvgError string   `json:"host_load_avg_error,omitempty"`
	HostTopCPUProcs  []string `json:"host_top_cpu_procs,omitempty"`
	HostCPUContended bool     `json:"host_cpu_contended"`
	EngineName       string   `json:"engine_name"`
	GitCommit        string   `json:"git_commit"`
	GitDirty         bool     `json:"git_dirty"`
}

SystemInfo is the single canonical hardware, library, clock/power, and host contention record embedded in cudaprof captures, servebench results, cudaflightrecorder bundles, and cuptiactivity relational table exports.

func CaptureSystemInfo

func CaptureSystemInfo(ctx context.Context, opts Options) (*SystemInfo, error)

CaptureSystemInfo queries live host and GPU state to construct a populated SystemInfo record.

func StartCaptureSystemInfo

func StartCaptureSystemInfo(ctx context.Context, opts Options) (*SystemInfo, error)

StartCaptureSystemInfo records the start-of-run SystemInfo snapshot (device identity, driver/library versions, start clocks/power, and start host load).

func (*SystemInfo) Validate

func (s *SystemInfo) Validate() error

Validate checks that all required hardware, clock, power, library, and build provenance fields are populated, returning an error wrapping ErrIncompleteSystemInfo if any required field is missing.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL