gpu

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const Unavailable int = -0x7FFFFFFF

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	Name() string    // "NVML"/"OneAPI"/...
	Version() string // version of NVML/OneAPI/...
	DriverVersion() string

	Init() error
	Shutdown() error
	GPUs() ([]Device, error)
}

type BackendInfo

type BackendInfo struct {
	ManagerName    string
	ManagerVersion string
	DriverVersion  string
}

func (*BackendInfo) Capture

func (m *BackendInfo) Capture(mgr Backend)

type Device

type Device interface {
	Index() int
	Name() string
	UUID() string

	Utilization() (gpu, mem int, err error)
	Clocks() (gpu, mem int, err error)
	Memory() (total, free, used int, err error) // byte
	Power() (watt int, err error)
	Temperature() (celsius int, err error)
	FanSpeed() (percent, rpm int, err error)
	PowerLimit() (watt int, err error)
	ClockOffsetGPU() (mhz int, err error)
	ClockOffsetMem() (mhz int, err error)
	ClockLimitGPU() (mhz int, err error)

	PowerLimitRange() (min, max int, err error)
	PowerLimitDefault() (watt int, err error)
	ClockOffsetGPURange() (min, max int, err error)
	ClockOffsetMemRange() (min, max int, err error)
	ClockLimitGPURange() (min, max int, err error)

	SetPowerLimit(watts int) error
	SetClockOffsetGPU(mhz int) error
	SetClockOffsetMem(mhz int) error
	SetClockLimitGPU(mhz int) error
	ResetPowerLimit() error
	ResetClockOffsetGPU() error
	ResetClockOffsetMem() error
	ResetClockLimitGPU() error

	IsPowerLimitSetterSupported() bool
}

type Snapshot

type Snapshot struct {
	Index int
	Name  string
	UUID  string

	UtilizationGPU int
	UtilizationMem int
	ClockGpu       int // MHz
	ClockMem       int // MHz
	MemTotal       int // Byte
	MemUsed        int // Byte
	Power          int // Watt
	Temperature    int // Celsius
	FanPct         int
	FanRPM         int

	PowerLimit     int // Watt
	ClockOffsetGPU int // MHz
	ClockOffsetMem int // MHz
	ClockLimitGPU  int // MHz

	PowerLimitMin         int // Watt
	PowerLimitMax         int // Watt
	PowerLimitDefault     int // Watt
	ClockOffsetGPUMin     int // MHz
	ClockOffsetGPUMax     int // MHz
	ClockOffsetGPUDefault int // MHz
	ClockOffsetMemMin     int // MHz
	ClockOffsetMemMax     int // MHz
	ClockOffsetMemDefault int // MHz
	ClockLimitGPUMin      int // MHz
	ClockLimitGPUMax      int // MHz
	ClockLimitGPUDefault  int // MHz
}

func (*Snapshot) Capture

func (d *Snapshot) Capture(dev Device)

Jump to

Keyboard shortcuts

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