Documentation ¶
Overview ¶
Package nvml is the NVIDIA Management Library (NVML) bindings for Go.
Following is an easy example that displays processes information on all devices.
package main import ( "fmt" "github.com/hotpxl/nvml" ) func main() { s, err := nvml.NewSession() if err != nil { panic(err) } defer s.Close() devices, err := s.GetAllDevices() if err != nil { panic(err) } for _, d := range devices { p, err := d.Processes() if err != nil { panic(err) } fmt.Printf("%+v\n", p) } }
Visit https://github.com/hotpxl/nvml for more information.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Device ¶
type Device struct {
// contains filtered or unexported fields
}
Device represents a single device.
func (*Device) MemoryInfo ¶
func (d *Device) MemoryInfo() (MemoryInfo, error)
MemoryInfo returns memory consumption information from a device.
func (*Device) Processes ¶
func (d *Device) Processes() ([]ProcessInfo, error)
Processes returns processes running on a device.
type MemoryInfo ¶
MemoryInfo holds memory consumption information for a device.
type ProcessInfo ¶
type ProcessInfo struct { PID int32 `json:"pid"` UsedMemory uint64 `json:"usedMemory"` Username string `json:"username"` }
ProcessInfo holds process information on a device.
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session manages the initialization and shutdown of NVML context.
func (*Session) Close ¶
func (s *Session) Close()
Close frees existing session and underlying NVML context.
func (*Session) DeviceCount ¶
DeviceCount returns the number of devices.
func (*Session) GetAllDevices ¶
GetAllDevices returns all devices accessible.