Help us shape the future of Go! Take the 2026 Go Developer Survey

gpu

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const ProductLabel = "nvidia.com/gpu.product"

ProductLabel is the node label that reports the GPU product installed on a node, e.g. "NVIDIA-H100-80GB-HBM3".

Variables

This section is empty.

Functions

func MajorityArchitecture

func MajorityArchitecture(nodes []corev1.Node) string

MajorityArchitecture returns the GPU architecture reported by the most nodes, parsed from each node's nvidia.com/gpu.product label via ParseProduct. It is the single source of truth for architecture detection: the controllers and every CLI path (render, cluster info, workloadrun) derive gpusPerNode, MNNVL, and override matching from its result, so a mixed-architecture target resolves to the same architecture everywhere (issue #248).

Only labeled nodes vote. A node without the label (or with an empty value) never outvotes labeled nodes, so a fleet where the GPU feature-discovery labeler has not reached every node still detects the architecture the labeled nodes report. The function returns "" only when no node is labeled (including an empty input); callers map that to their own "unknown" sentinel or fallback.

The winner is derived by walking the slice in order with a strictly-greater count comparison (the counts map is only indexed, never iterated), so the result is deterministic for a given node order and ties resolve to the architecture whose earliest node appears first. Callers pass name-sorted nodes, which makes the result stable for a given cluster. This is the exact tie-break the Workflow and Certification controllers adopted for issue #77.

func ParseProduct

func ParseProduct(product string) string

ParseProduct extracts the GPU architecture from a GPU product name. It accepts both the NVIDIA GPU Feature Discovery label format, which is hyphen-separated (e.g. "NVIDIA-H100-80GB-HBM3"), and the ResourceSlice productName device attribute format used on DRA-only platforms, which is space-separated (e.g. "NVIDIA GB300"). It strips the "NVIDIA" prefix, takes the first segment before any hyphen or space, and lowercases it. RTX PRO 6000 keeps its full model name. Examples: "NVIDIA-H100-80GB-HBM3" → "h100", "NVIDIA GB300" → "gb300", and "NVIDIA-RTX-PRO-6000-Blackwell-Server-Edition" → "rtxpro6000". Returns "" if the input is empty.

func ProductLabelValue added in v0.6.0

func ProductLabelValue(name string) string

ProductLabelValue converts an NVML device name, e.g. "NVIDIA GB300", to the nvidia.com/gpu.product label value GFD writes for it, "NVIDIA-GB300". It mirrors sanitise in NVIDIA/k8s-device-plugin internal/lm/resource.go, which owns the format: drop characters outside [A-Za-z0-9-_. ], then join the whitespace-separated fields with hyphens. GFD's resourceLabeler.getProductName in the same file also appends "-SHARED" under time-slicing; that suffix is not modeled here.

Types

This section is empty.

Jump to

Keyboard shortcuts

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