gonvml – github.com/mindprince/gonvml Index | Files | Directories

package gonvml

import "github.com/mindprince/gonvml"

Index

Functions

func DeviceCount

func DeviceCount() (uint, error)

DeviceCount returns the number of nvidia devices on the system.

func Initialize

func Initialize() error

Initialize initializes NVML. Call this before calling any other methods.

func Shutdown

func Shutdown() error

Shutdown shuts down NVML. Call this once NVML is no longer being used.

func SystemDriverVersion

func SystemDriverVersion() (string, error)

SystemDriverVersion returns the the driver version on the system.

Types

type Device

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

Device is the handle for the device. This handle is obtained by calling DeviceHandleByIndex().

func DeviceHandleByIndex

func DeviceHandleByIndex(idx uint) (Device, error)

DeviceHandleByIndex returns the device handle for a particular index. The indices range from 0 to DeviceCount()-1. The order in which NVML enumerates devices has no guarantees of consistency between reboots.

func (Device) AverageGPUUtilization

func (d Device) AverageGPUUtilization(since time.Duration) (uint, error)

AverageGPUUtilization returns the utilization.gpu metric (percent of time one of more kernels were executing on the GPU) averaged over the samples collected in the last `since` duration.

func (Device) AveragePowerUsage

func (d Device) AveragePowerUsage(since time.Duration) (uint, error)

AveragePowerUsage returns the power usage for this GPU and its associated circuitry in milliwatts averaged over the samples collected in the last `since` duration.

func (Device) DecoderUtilization

func (d Device) DecoderUtilization() (uint, uint, error)

DecoderUtilization returns the percent of time over the last sample period during which the GPU video decoder was being used. The sampling period is variable and is returned in the second return argument in microseconds.

func (Device) EncoderUtilization

func (d Device) EncoderUtilization() (uint, uint, error)

EncoderUtilization returns the percent of time over the last sample period during which the GPU video encoder was being used. The sampling period is variable and is returned in the second return argument in microseconds.

func (Device) FanSpeed

func (d Device) FanSpeed() (uint, error)

FanSpeed returns the temperature for this GPU in the percentage of its full speed, with 100 being the maximum.

func (Device) MemoryInfo

func (d Device) MemoryInfo() (uint64, uint64, error)

MemoryInfo returns the total and used memory (in bytes) of the device.

func (Device) MinorNumber

func (d Device) MinorNumber() (uint, error)

MinorNumber returns the minor number for the device. The minor number for the device is such that the Nvidia device node file for each GPU will have the form /dev/nvidia[minor number].

func (Device) Name

func (d Device) Name() (string, error)

Name returns the product name of the device.

func (Device) PowerUsage

func (d Device) PowerUsage() (uint, error)

PowerUsage returns the power usage for this GPU and its associated circuitry in milliwatts. The reading is accurate to within +/- 5% of current power draw.

func (Device) Temperature

func (d Device) Temperature() (uint, error)

Temperature returns the temperature for this GPU in Celsius.

func (Device) UUID

func (d Device) UUID() (string, error)

UUID returns the globally unique immutable UUID associated with this device.

func (Device) UtilizationRates

func (d Device) UtilizationRates() (uint, uint, error)

UtilizationRates returns the percent of time over the past sample period during which: utilization.gpu: one or more kernels were executing on the GPU. utilization.memory: global (device) memory was being read or written.

Source Files

bindings.go

Directories

PathSynopsis
cmd
cmd/example
Version
v0.0.0-20211002210717-ac0b66419a41 (latest)
Published
Oct 2, 2021
Platform
js/wasm
Imports
4 packages
Last checked
now

Tools for package owners.