nvml

package
v0.0.0-...-5a2c584 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2021 License: Apache-2.0 Imports: 11 Imported by: 101

Documentation

Index

Constants

View Source
const (
	DEVICE_MIG_DISABLE = C.NVML_DEVICE_MIG_DISABLE
	DEVICE_MIG_ENABLE  = C.NVML_DEVICE_MIG_ENABLE
)

Enable or disable MIG mode

View Source
const (
	GPU_INSTANCE_PROFILE_1_SLICE = C.NVML_GPU_INSTANCE_PROFILE_1_SLICE
	GPU_INSTANCE_PROFILE_2_SLICE = C.NVML_GPU_INSTANCE_PROFILE_2_SLICE
	GPU_INSTANCE_PROFILE_3_SLICE = C.NVML_GPU_INSTANCE_PROFILE_3_SLICE
	GPU_INSTANCE_PROFILE_4_SLICE = C.NVML_GPU_INSTANCE_PROFILE_4_SLICE
	GPU_INSTANCE_PROFILE_7_SLICE = C.NVML_GPU_INSTANCE_PROFILE_7_SLICE
	GPU_INSTANCE_PROFILE_COUNT   = C.NVML_GPU_INSTANCE_PROFILE_COUNT
)

GPU Instance Profiles

View Source
const (
	COMPUTE_INSTANCE_PROFILE_1_SLICE = C.NVML_COMPUTE_INSTANCE_PROFILE_1_SLICE
	COMPUTE_INSTANCE_PROFILE_2_SLICE = C.NVML_COMPUTE_INSTANCE_PROFILE_2_SLICE
	COMPUTE_INSTANCE_PROFILE_3_SLICE = C.NVML_COMPUTE_INSTANCE_PROFILE_3_SLICE
	COMPUTE_INSTANCE_PROFILE_4_SLICE = C.NVML_COMPUTE_INSTANCE_PROFILE_4_SLICE
	COMPUTE_INSTANCE_PROFILE_7_SLICE = C.NVML_COMPUTE_INSTANCE_PROFILE_7_SLICE
	COMPUTE_INSTANCE_PROFILE_COUNT   = C.NVML_COMPUTE_INSTANCE_PROFILE_COUNT
)

Compute Instance Profiles

View Source
const (
	COMPUTE_INSTANCE_ENGINE_PROFILE_SHARED = C.NVML_COMPUTE_INSTANCE_ENGINE_PROFILE_SHARED
	COMPUTE_INSTANCE_ENGINE_PROFILE_COUNT  = C.NVML_COMPUTE_INSTANCE_ENGINE_PROFILE_COUNT
)

Compute Instance Engine Profiles

View Source
const (
	PerfStateMax     = 0
	PerfStateMin     = 15
	PerfStateUnknown = 32
)
View Source
const (
	XidCriticalError = C.nvmlEventTypeXidCriticalError
)

Variables

View Source
var (
	ErrCPUAffinity        = errors.New("failed to retrieve CPU affinity")
	ErrUnsupportedP2PLink = errors.New("unsupported P2P link type")
	ErrUnsupportedGPU     = errors.New("unsupported GPU device")
)

Functions

func DeleteEventSet

func DeleteEventSet(es EventSet)

func GetCudaDriverVersion

func GetCudaDriverVersion() (*uint, *uint, error)

func GetDeviceCount

func GetDeviceCount() (uint, error)

func GetDriverVersion

func GetDriverVersion() (string, error)

func Init

func Init() error

func ParseMigDeviceUUID

func ParseMigDeviceUUID(uuid string) (string, uint, uint, error)

func RegisterEvent

func RegisterEvent(es EventSet, event int) error

func RegisterEventForDevice

func RegisterEventForDevice(es EventSet, event int, uuid string) error

func Shutdown

func Shutdown() error

Types

type Accounting

type Accounting struct {
	Mode       ModeState
	BufferSize *uint
}

type ClockInfo

type ClockInfo struct {
	Cores  *uint
	Memory *uint
}

type ComputeInstance

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

Opaque ComputeInstance type

func (*ComputeInstance) Destroy

func (c *ComputeInstance) Destroy() (err error)

ComputeInstance.Destroy()

func (*ComputeInstance) GetInfo

func (c *ComputeInstance) GetInfo() (info ComputeInstanceInfo, err error)

ComputeInstance.GetInfo()

type ComputeInstanceInfo

type ComputeInstanceInfo struct {
	Device      *Device
	GPUInstance GPUInstance
	ID          uint32
	ProfileID   uint32
}

type ComputeInstanceInfo C.nvmlComputeInstanceInfo_t Generated using `go tool cgo -godefs mig.go`

type ComputeInstanceProfileInfo

type ComputeInstanceProfileInfo struct {
	ID                    uint32
	SliceCount            uint32
	InstanceCount         uint32
	MultiprocessorCount   uint32
	SharedCopyEngineCount uint32
	SharedDecoderCount    uint32
	SharedEncoderCount    uint32
	SharedJpegCount       uint32
	SharedOfaCount        uint32
}

type ComputeInstanceProfileInfo C.nvmlComputeInstanceProfileInfo_t Generated using `go tool cgo -godefs mig.go`

type CudaComputeCapabilityInfo

type CudaComputeCapabilityInfo struct {
	Major *int
	Minor *int
}

type Device

type Device struct {
	UUID                  string
	Path                  string
	Model                 *string
	Power                 *uint
	Memory                *uint64
	CPUAffinity           *uint
	PCI                   PCIInfo
	Clocks                ClockInfo
	Topology              []P2PLink
	CudaComputeCapability CudaComputeCapabilityInfo
	// contains filtered or unexported fields
}

func NewDevice

func NewDevice(idx uint) (device *Device, err error)

func NewDeviceByUUID

func NewDeviceByUUID(uuid string) (device *Device, err error)

func NewDeviceLite

func NewDeviceLite(idx uint) (device *Device, err error)

func NewDeviceLiteByUUID

func NewDeviceLiteByUUID(uuid string) (device *Device, err error)

func (*Device) CreateGPUInstance

func (d *Device) CreateGPUInstance(profileInfo *GPUInstanceProfileInfo) (gpuInstance GPUInstance, err error)

Device.CreateGPUInstance()

func (*Device) GPUInstanceRemainingCapacity

func (d *Device) GPUInstanceRemainingCapacity(profileInfo *GPUInstanceProfileInfo) (count int, err error)

Device.GPUInstanceRemainingCapacity()

func (*Device) GetAllRunningProcesses

func (d *Device) GetAllRunningProcesses() ([]ProcessInfo, error)

func (*Device) GetAttributes

func (d *Device) GetAttributes() (attr DeviceAttributes, err error)

Device.GetAttributes()

func (*Device) GetComputeInstanceId

func (d *Device) GetComputeInstanceId() (id int, err error)

Device.GetComputeInstanceId()

func (*Device) GetComputeRunningProcesses

func (d *Device) GetComputeRunningProcesses() ([]uint, []uint64, error)

func (*Device) GetDeviceHandleFromMigDeviceHandle

func (d *Device) GetDeviceHandleFromMigDeviceHandle() (device *Device, err error)

Device.GetMigDeviceHandleByIndex()

func (*Device) GetDeviceMode

func (d *Device) GetDeviceMode() (mode *DeviceMode, err error)

func (*Device) GetGPUInstanceByID

func (d *Device) GetGPUInstanceByID(id int) (gpuInstance GPUInstance, err error)

Device.GetGPUInstanceByID()

func (*Device) GetGPUInstanceId

func (d *Device) GetGPUInstanceId() (id int, err error)

Device.GetGPUInstanceId()

func (*Device) GetGPUInstancePossiblePlacements

func (d *Device) GetGPUInstancePossiblePlacements(profileInfo *GPUInstanceProfileInfo) (placement GPUInstancePlacement, count int, err error)

Device.GetGPUInstancePossiblePlacements()

func (*Device) GetGPUInstanceProfileInfo

func (d *Device) GetGPUInstanceProfileInfo(profile int) (profileInfo GPUInstanceProfileInfo, err error)

Device.GetGPUInstanceProfileInfo()

func (*Device) GetGPUInstances

func (d *Device) GetGPUInstances(profileInfo *GPUInstanceProfileInfo) (gpuInstances []GPUInstance, err error)

Device.GetGPUInstances()

func (*Device) GetGraphicsRunningProcesses

func (d *Device) GetGraphicsRunningProcesses() ([]uint, []uint64, error)

func (*Device) GetMaxMigDeviceCount

func (d *Device) GetMaxMigDeviceCount() (count int, err error)

Device.GetMaxMigDeviceCount()

func (*Device) GetMigDeviceHandleByIndex

func (d *Device) GetMigDeviceHandleByIndex(index int) (migDevice *Device, err error)

Device.GetMigDeviceHandleByIndex()

func (*Device) GetMigDevices

func (d *Device) GetMigDevices() ([]*Device, error)

func (*Device) GetMigMode

func (d *Device) GetMigMode() (currentMode, pendingMode int, err error)

Device.GetMigMode()

func (*Device) GetMigParentDevice

func (d *Device) GetMigParentDevice() (*Device, error)

func (*Device) GetMigParentDeviceLite

func (d *Device) GetMigParentDeviceLite() (*Device, error)

func (*Device) IsMigDeviceHandle

func (d *Device) IsMigDeviceHandle() (isMigDevice bool, err error)

Device.IsMigDeviceHandle()

func (*Device) IsMigEnabled

func (d *Device) IsMigEnabled() (bool, error)

func (*Device) SetMigMode

func (d *Device) SetMigMode(mode int) (activationStatus error, err error)

Device.SetMigMode()

func (*Device) Status

func (d *Device) Status() (status *DeviceStatus, err error)

type DeviceAttributes

type DeviceAttributes struct {
	MultiprocessorCount       uint32
	SharedCopyEngineCount     uint32
	SharedDecoderCount        uint32
	SharedEncoderCount        uint32
	SharedJpegCount           uint32
	SharedOfaCount            uint32
	GpuInstanceSliceCount     uint32
	ComputeInstanceSliceCount uint32
	MemorySizeMB              uint64
}

type DeviceAttributes C.nvmlDeviceAttributes_t Generated using `go tool cgo -godefs mig.go`

type DeviceMemory

type DeviceMemory struct {
	Used *uint64
	Free *uint64
}

type DeviceMode

type DeviceMode struct {
	DisplayInfo    Display
	Persistence    ModeState
	AccountingInfo Accounting
}

type DeviceStatus

type DeviceStatus struct {
	Power       *uint
	FanSpeed    *uint
	Temperature *uint
	Utilization UtilizationInfo
	Memory      MemoryInfo
	Clocks      ClockInfo
	PCI         PCIStatusInfo
	Processes   []ProcessInfo
	Throttle    ThrottleReason
	Performance PerfState
}

type Display

type Display struct {
	Mode   ModeState
	Active ModeState
}

type ECCErrorsInfo

type ECCErrorsInfo struct {
	L1Cache *uint64
	L2Cache *uint64
	Device  *uint64
}

type Event

type Event struct {
	UUID              *string
	GpuInstanceId     *uint
	ComputeInstanceId *uint
	Etype             uint64
	Edata             uint64
}

func WaitForEvent

func WaitForEvent(es EventSet, timeout uint) (Event, error)

type EventSet

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

func NewEventSet

func NewEventSet() EventSet

type GPUInstance

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

Opaque GPUInstance type

func (*GPUInstance) ComputeInstanceRemainingCapacity

func (g *GPUInstance) ComputeInstanceRemainingCapacity(profileInfo *GPUInstanceProfileInfo) (count int, err error)

GPUInstance.ComputeInstanceRemainingCapacity()

func (*GPUInstance) CreateComputeInstance

func (g *GPUInstance) CreateComputeInstance(profileInfo *ComputeInstanceProfileInfo) (computeInstance ComputeInstance, err error)

GPUInstance.CreateComputeInstance()

func (*GPUInstance) Destroy

func (g *GPUInstance) Destroy() (err error)

GPUInstance.Destroy()

func (*GPUInstance) GetComputeInstanceByID

func (g *GPUInstance) GetComputeInstanceByID(id int) (computeInstance ComputeInstance, err error)

GPUInstance.GetComputeInstanceByID()

func (*GPUInstance) GetComputeInstanceProfileInfo

func (g *GPUInstance) GetComputeInstanceProfileInfo(profile int, engProfile int) (profileInfo ComputeInstanceProfileInfo, err error)

GPUInstance.GetComputeInstanceProfileInfo()

func (*GPUInstance) GetComputeInstances

func (g *GPUInstance) GetComputeInstances(profileInfo *ComputeInstanceProfileInfo) (computeInstances []ComputeInstance, err error)

GPUInstance.GetComputeInstances()

func (*GPUInstance) GetInfo

func (g *GPUInstance) GetInfo() (info GPUInstanceInfo, err error)

GPUInstance.GetInfo()

type GPUInstanceInfo

type GPUInstanceInfo struct {
	Device    *Device
	ID        uint32
	ProfileID uint32
	Placement GPUInstancePlacement
}

type GPUInstanceInfo_t C.nvmlGpuInstanceInfo_t Generated using `go tool cgo -godefs mig.go`

type GPUInstancePlacement

type GPUInstancePlacement struct {
	Start uint32
	Size  uint32
}

type GPUInstancePlacement C.nvmlGpuInstancePlacement_t Generated using `go tool cgo -godefs mig.go`

type GPUInstanceProfileInfo

type GPUInstanceProfileInfo struct {
	ID                  uint32
	IsP2pSupported      uint32
	SliceCount          uint32
	InstanceCount       uint32
	MultiprocessorCount uint32
	CopyEngineCount     uint32
	DecoderCount        uint32
	EncoderCount        uint32
	JpegCount           uint32
	OfaCount            uint32
	MemorySizeMB        uint64
}

type GPUInstanceProfileInfo C.nvmlGpuInstanceProfileInfo_t Generated using `go tool cgo -godefs mig.go`

type MemoryInfo

type MemoryInfo struct {
	Global    DeviceMemory
	ECCErrors ECCErrorsInfo
}

type ModeState

type ModeState uint
const (
	Disabled ModeState = iota
	Enabled
)

func (ModeState) String

func (m ModeState) String() string
type P2PLink struct {
	BusID string
	Link  P2PLinkType
}

type P2PLinkType

type P2PLinkType uint
const (
	P2PLinkUnknown P2PLinkType = iota
	P2PLinkCrossCPU
	P2PLinkSameCPU
	P2PLinkHostBridge
	P2PLinkMultiSwitch
	P2PLinkSingleSwitch
	P2PLinkSameBoard
	SingleNVLINKLink
	TwoNVLINKLinks
	ThreeNVLINKLinks
	FourNVLINKLinks
	FiveNVLINKLinks
	SixNVLINKLinks
	SevenNVLINKLinks
	EightNVLINKLinks
	NineNVLINKLinks
	TenNVLINKLinks
	ElevenNVLINKLinks
	TwelveNVLINKLinks
)
func GetNVLink(dev1, dev2 *Device) (link P2PLinkType, err error)
func GetP2PLink(dev1, dev2 *Device) (link P2PLinkType, err error)

func (P2PLinkType) String

func (t P2PLinkType) String() string

type PCIInfo

type PCIInfo struct {
	BusID     string
	BAR1      *uint64
	Bandwidth *uint
}

type PCIStatusInfo

type PCIStatusInfo struct {
	BAR1Used   *uint64
	Throughput PCIThroughputInfo
}

type PCIThroughputInfo

type PCIThroughputInfo struct {
	RX *uint
	TX *uint
}

type PerfState

type PerfState uint

func (PerfState) String

func (p PerfState) String() string

type ProcessInfo

type ProcessInfo struct {
	PID        uint
	Name       string
	MemoryUsed uint64
	Type       ProcessType
}

type ProcessType

type ProcessType uint
const (
	Compute ProcessType = iota
	Graphics
	ComputeAndGraphics
)

func (ProcessType) String

func (t ProcessType) String() string

type ThrottleReason

type ThrottleReason uint
const (
	ThrottleReasonGpuIdle ThrottleReason = iota
	ThrottleReasonApplicationsClocksSetting
	ThrottleReasonSwPowerCap
	ThrottleReasonHwSlowdown
	ThrottleReasonSyncBoost
	ThrottleReasonSwThermalSlowdown
	ThrottleReasonHwThermalSlowdown
	ThrottleReasonHwPowerBrakeSlowdown
	ThrottleReasonDisplayClockSetting
	ThrottleReasonNone
	ThrottleReasonUnknown
)

func (ThrottleReason) String

func (r ThrottleReason) String() string

type UtilizationInfo

type UtilizationInfo struct {
	GPU     *uint
	Memory  *uint
	Encoder *uint
	Decoder *uint
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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