lib

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package lib implements the NVIDIA Management Library (NVML) interface. See https://docs.nvidia.com/deploy/nvml-api/nvml-api-reference.html#nvml-api-reference for more details.

Index

Constants

View Source
const (
	EnvMockAllSuccess              = "GPUD_NVML_MOCK_ALL_SUCCESS"
	EnvInjectRemapedRowsPending    = "GPUD_NVML_INJECT_REMAPPED_ROWS_PENDING"
	EnvInjectClockEventsHwSlowdown = "GPUD_NVML_INJECT_CLOCK_EVENTS_HW_SLOWDOWN"
)

Variables

View Source
var ErrNVMLNotFound = errors.New("NVML not found")

Functions

This section is empty.

Types

type Library

type Library interface {
	NVML() nvml.Interface
	Device() nvlibdevice.Interface
	Info() nvinfo.Interface
	Shutdown() nvml.Return
}

func New

func New(opts ...OpOption) (Library, error)

New instantiates a new NVML instance and initializes the NVML library. It returns nil and error, if NVML is not supported. It also injects the mock data if the environment variables are set.

type Op

type Op struct {
	// contains filtered or unexported fields
}

type OpOption

type OpOption func(*Op)

func WithDevice

func WithDevice(dev nvlibdevice.Device) OpOption

func WithDeviceGetCurrentClocksEventReasonsForAllDevs

func WithDeviceGetCurrentClocksEventReasonsForAllDevs(f func() (uint64, nvml.Return)) OpOption

Specifies the function for all devices to get the current clocks event reasons of the device. Otherwise, defaults to the function returned by device.GetCurrentClocksEventReasons(). ref. https://docs.nvidia.com/deploy/nvml-api/group__nvmlDeviceQueries.html#group__nvmlDeviceQueries_1g7e505374454a0d4fc7339b6c885656d6

func WithDeviceGetRemappedRowsForAllDevs

func WithDeviceGetRemappedRowsForAllDevs(f func() (corrRows int, uncRows int, isPending bool, failureOccurred bool, ret nvml.Return)) OpOption

Specifies the function for all devices to get the remapped rows of the device. Otherwise, defaults to the function returned by device.GetRemappedRows(). ref. https://docs.nvidia.com/deploy/nvml-api/group__nvmlDeviceQueries.html#group__nvmlDeviceQueries_1g055e7c34f7f15b6ae9aac1dabd60870d

func WithInitReturn

func WithInitReturn(initReturn nvml.Return) OpOption

Specifies the return value of the NVML library's Init() function. Otherwise, defaults to the return value of the NVML library's Init() function.

func WithNVML

func WithNVML(nvmlLib nvml.Interface) OpOption

Specifies the NVML library instance. Otherwise, defaults to the NVML library instance returned by nvml.New().

func WithPropertyExtractor

func WithPropertyExtractor(propertyExtractor nvinfo.PropertyExtractor) OpOption

Specifies the property extractor for the NVML library.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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