Documentation
¶
Overview ¶
Package device provides a wrapper around the "github.com/NVIDIA/go-nvlib/pkg/nvlib/device".Device type that adds a PCIBusID and UUID method, with support for test failure injection.
Index ¶
Constants ¶
const MinDriverVersionForMarginTemperatureAPI = 570
MinDriverVersionForMarginTemperatureAPI is the minimum NVIDIA driver major version required for nvmlDeviceGetMarginTemperature. NVML changelog (display drivers 570+): https://docs.nvidia.com/deploy/nvml-api/change-log.html (see "Changes between v565 and v570", which lists nvmlDeviceGetMarginTemperature). API reference: https://docs.nvidia.com/deploy/nvml-api/group__nvmlDeviceQueries.html#group__nvmlDeviceQueries_1g42db93dc04fc99d253eadc2037a5232d Calling this function on older drivers can cause a symbol lookup error.
const MinDriverVersionForV3FabricAPI = 550
MinDriverVersionForV3FabricAPI is the minimum NVIDIA driver major version required for nvmlDeviceGetGpuFabricInfoV (V3 fabric state API). This API was introduced in driver 550 (see NVML changelog: https://docs.nvidia.com/deploy/nvml-api/change-log.html). Calling this function on older drivers (e.g., 535.x) causes a symbol lookup error that crashes the process.
Variables ¶
This section is empty.
Functions ¶
func FabricStateToString ¶
FabricStateToString converts a fabric state code to a human-readable string.
func FabricStatusToString ¶
FabricStatusToString converts an NVML return code to a human-readable string.
func FabricSummaryToString ¶
FabricSummaryToString converts a fabric health summary code to a human-readable string.
Types ¶
type Device ¶
type Device interface {
device.Device
PCIBusID() string
UUID() string
GetFabricState() (FabricState, error)
}
Device is a wrapper around the "github.com/NVIDIA/go-nvlib/pkg/nvlib/device".Device type that adds a PCIBusID and UUID method, plus GetFabricState for fabric health queries.
type FabricHealthSnapshot ¶
type FabricHealthSnapshot struct {
Bandwidth string `json:"bandwidth,omitempty"`
RouteRecoveryProgress string `json:"route_recovery_in_progress,omitempty"`
RouteUnhealthy string `json:"route_unhealthy,omitempty"`
AccessTimeoutRecovery string `json:"access_timeout_recovery,omitempty"`
}
FabricHealthSnapshot represents the health status of fabric components.
func ParseHealthMask ¶
func ParseHealthMask(mask uint32) FabricHealthSnapshot
ParseHealthMask parses a health mask into a FabricHealthSnapshot.
type FabricState ¶
type FabricState struct {
CliqueID uint32
ClusterUUID string
State uint8
Status nvml.Return
HealthMask uint32
// HealthSummary is the health summary of the fabric.
// This is a uint8 value that can be converted to a string using FabricSummaryToString.
// NOTE: "NVIDIA H100 80GB HBM3" returns nvml.GPU_FABRIC_HEALTH_SUMMARY_NOT_SUPPORTED.
HealthSummary uint8
}
FabricState represents fabric state information for a GPU device. This struct encapsulates all fabric-related data from V3 and V1 APIs.
func (FabricState) GetIssues ¶
func (fs FabricState) GetIssues() []string
GetIssues analyzes the fabric state and returns a sorted list of issues found. This is useful for health reporting and diagnostics.
func (FabricState) ToEntry ¶
func (fs FabricState) ToEntry(gpuUUID string) FabricStateEntry
ToEntry converts a FabricState to a displayable FabricStateEntry with formatted fields. The gpuUUID parameter is used to identify the GPU in the display.
type FabricStateEntry ¶
type FabricStateEntry struct {
GPUUUID string `json:"gpu_uuid"`
CliqueID uint32 `json:"clique_id"`
ClusterUUID string `json:"cluster_uuid,omitempty"`
State string `json:"state"`
Status string `json:"status"`
// Summary is converted from HealthSummary using FabricSummaryToString.
// NOTE: "NVIDIA H100 80GB HBM3" returns nvml.GPU_FABRIC_HEALTH_SUMMARY_NOT_SUPPORTED.
Summary string `json:"summary,omitempty"`
Health FabricHealthSnapshot `json:"health"`
}
FabricStateEntry represents a displayable fabric state entry with formatted fields. This is used for rendering fabric state information in human-readable format.
func (FabricStateEntry) RenderTable ¶
func (e FabricStateEntry) RenderTable(wr io.Writer)
RenderTable renders a single fabric state entry as a formatted table
type Op ¶
type Op struct {
// DriverMajor is the major version of the NVIDIA driver.
// Used to gate V3 fabric API calls which require driver >= 550.
DriverMajor int
// GPULost indicates that all device methods should return nvml.ERROR_GPU_IS_LOST
GPULost bool
// GPURequiresReset indicates that all device methods should return nvml.ERROR_RESET_REQUIRED
GPURequiresReset bool
// FabricHealthUnhealthy indicates that GetGpuFabricState should return SUCCESS but with unhealthy status
FabricHealthUnhealthy bool
}
Op struct holds options for device creation
type OpOption ¶
type OpOption func(*Op)
OpOption is a function that configures the Op struct
func WithDriverMajor ¶
WithDriverMajor returns an OpOption that sets the driver major version. This is used to gate V3 fabric API calls which require driver >= 550.
func WithFabricHealthUnhealthy ¶
func WithFabricHealthUnhealthy() OpOption
WithFabricHealthUnhealthy returns an OpOption that enables Fabric Health Unhealthy injection
func WithGPULost ¶
func WithGPULost() OpOption
WithGPULost returns an OpOption that enables GPU Lost error injection
func WithGPURequiresReset ¶
func WithGPURequiresReset() OpOption
WithGPURequiresReset returns an OpOption that enables GPU Requires Reset error injection