nvml

package
v0.0.0-...-fa37e54 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2019 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeviceGetHandleByIndex

func DeviceGetHandleByIndex(idx int) (*C.nvmlDevice_t, error)

DeviceGetHandleByIndex acquires the handle for a particular device, based on its index.

func GetDeviceCount

func GetDeviceCount() (int, error)

GetDeviceCount returns the # of CUDA devices present on the host

func InitNVML

func InitNVML() error

InitNVML initializes NVML

func ShutdownNVML

func ShutdownNVML() error

ShutdownNVML all resources that were created when we initialized

Types

type Device

type Device struct {
	DeviceName string
	DeviceUUID string
	// contains filtered or unexported fields
}

Device describes the NVIDIA GPU device attached to the host

func GetDevices

func GetDevices() ([]Device, error)

GetDevices returns a list of all installed CUDA devices

func (*Device) GetFanSpeed

func (s *Device) GetFanSpeed() (int, error)

GetFanSpeed returns the fan speed in percent

func (*Device) GetMemoryInfo

func (s *Device) GetMemoryInfo() (memInfo *NVMLMemory, err error)

GetMemoryInfo retrieves the amount of used, free and total memory available on the device, in bytes.

func (*Device) GetPowerUsage

func (s *Device) GetPowerUsage() (int, error)

GetPowerUsage returns the power consumption of the GPU in watts

func (*Device) GetProcessInfo

func (s *Device) GetProcessInfo() (procInfo []NVMLProcess, err error)

GetProcessInfo retrieves the active proccesses (pid, used gpu memory) running on the device

func (*Device) GetTemperature

func (s *Device) GetTemperature() (int, int, error)

GetTemperature returns the Device's temperature in Farenheit and celsius

func (*Device) GetUtilization

func (s *Device) GetUtilization() (gpu, memory int, err error)

GetUtilization returns the GPU and memory usage returned as a percentage used of a given GPU device

func (*Device) Name

func (s *Device) Name() (name string, err error)

Name returns the Device's Name and is not guaranteed to exceed 64 characters in length

func (*Device) UUID

func (s *Device) UUID() (uuid string, err error)

UUID returns the Device's Unique ID

type NVMLMemory

type NVMLMemory struct {
	// Unallocated FB memory (in bytes).
	Free int64
	// Total installed FB memory (in bytes).
	Total int64
	// Allocated FB memory (in bytes). Note that the driver/GPU always sets
	// aside a small amount of memory for bookkeeping.
	Used int64
}

NVMLMemory contains information about the memory allocation of a device

type NVMLProcess

type NVMLProcess struct {
	Pid           int
	UsedGpuMemory int64
}

Jump to

Keyboard shortcuts

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