gpu

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBackendUnavailable = errors.New("gpu backend unavailable")
	ErrNoBackend          = errors.New("no gpu backend available")
)
View Source
var DefaultFactory = func(cfg core.Config) (Collector, error) {
	return Select(cfg.Backend)
}

Functions

func Register

func Register(name string, priority int, ctor func() (Collector, error))

Types

type Collector

type Collector interface {
	Init() error
	Shutdown() error
	DeviceCount() (int, error)
	Device(i int) (*Device, error)
	Backend() string
}

func Select

func Select(backend string) (Collector, error)

type Device

type Device struct {
	Index            int
	UUID             string
	Name             string
	MemoryTotal      uint64
	MemoryUsed       uint64
	Temperature      uint32
	PowerDraw        uint32
	PowerLimit       uint32
	ClockGraphics    uint32
	ClockMem         uint32
	UtilizationGPU   uint32
	UtilizationMem   uint32
	ThrottleReasons  []string
	ECCEnabled       *bool
	MIGEnabled       bool
	MIGDevices       []MIGDevice
	PState           string
	FanSpeed         *int
	DriverVersion    string
	CudaVersion      string
	EncoderUtil      uint32
	DecoderUtil      uint32
	PCIeGen          uint32
	PCIeWidth        uint32
	MemBandwidthUtil uint32
	Processes        []GPUProcess
}

type GPUProcess

type GPUProcess struct {
	PID        int
	Name       string
	User       string
	UsedMemory uint64
	Type       string
}

type MIGDevice

type MIGDevice struct {
	GIID        int
	CIID        int
	UUID        string
	MemoryTotal uint64
}

type UnknownBackendError

type UnknownBackendError struct {
	Name string
}

func (*UnknownBackendError) Error

func (e *UnknownBackendError) Error() string

type Vendor

type Vendor string
const (
	VendorNVIDIA Vendor = "nvidia"
	VendorAMD    Vendor = "amd"
	VendorIntel  Vendor = "intel"
)

Directories

Path Synopsis
Package cache provides a TTL caching wrapper around a gpu.Collector.
Package cache provides a TTL caching wrapper around a gpu.Collector.
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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