gpu

package
v0.0.0-...-e75c356 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: Apache-2.0 Imports: 8 Imported by: 4 modules, 6 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// GPUInfoDirPath is the directory where gpus and driver info are saved
	GPUInfoDirPath = "/var/lib/ecs/gpu"
	// NvidiaGPUInfoFilePath is the file path where gpus and driver info are saved
	NvidiaGPUInfoFilePath = GPUInfoDirPath + "/nvidia-gpu-info.json"
)

Variables

View Source
var GPUInfoFileExists = CheckForGPUInfoFile
View Source
var GetGPUInfoJSON = GetGPUInfo

Functions

func CheckForGPUInfoFile

func CheckForGPUInfoFile() bool

func GetGPUInfo

func GetGPUInfo() ([]byte, error)

Types

type GPUManager

type GPUManager interface {
	Initialize() error
	SetGPUIDs([]string)
	GetGPUIDsUnsafe() []string
	GetGPUMemoryMiBUnsafe() map[string]uint64
	SetDevices()
	GetDevices() []types.PlatformDevice
	SetDriverVersion(string)
	GetDriverVersion() string
	GetMpsControlBinaryPresent() bool
	GetMpsServiceEnabled() bool
	GetHasVGPU() bool
}

GPUManager encompasses methods to get information on GPUs and their driver

func NewNvidiaGPUManager

func NewNvidiaGPUManager() GPUManager

NewNvidiaGPUManager is used to obtain NvidiaGPUManager handle

type NvidiaGPUManager

type NvidiaGPUManager struct {
	DriverVersion           string                 `json:"DriverVersion"`
	GPUIDs                  []string               `json:"GPUIDs"`
	GPUDevices              []types.PlatformDevice `json:"-"`
	GPUMemoryMiB            map[string]uint64      `json:"GPUMemoryMiB,omitempty"`
	MpsControlBinaryPresent bool                   `json:"MpsControlBinaryPresent"`
	MpsServiceEnabled       bool                   `json:"MpsServiceEnabled"`
	HasVGPU                 bool                   `json:"HasVGPU"`
	// contains filtered or unexported fields
}

NvidiaGPUManager is used as a wrapper for NVML APIs and implements GPUManager interface

func (*NvidiaGPUManager) GetDevices

func (n *NvidiaGPUManager) GetDevices() []types.PlatformDevice

GetDevices returns the GPU devices as PlatformDevices

func (*NvidiaGPUManager) GetDriverVersion

func (n *NvidiaGPUManager) GetDriverVersion() string

GetDriverVersion is a getter for nvidia driver version

func (*NvidiaGPUManager) GetGPUIDsUnsafe

func (n *NvidiaGPUManager) GetGPUIDsUnsafe() []string

GetGPUIDs returns the GPUIDs

func (*NvidiaGPUManager) GetGPUMemoryMiBUnsafe

func (n *NvidiaGPUManager) GetGPUMemoryMiBUnsafe() map[string]uint64

GetGPUMemoryMiBUnsafe returns the per-GPU usable memory map

func (*NvidiaGPUManager) GetHasVGPU

func (n *NvidiaGPUManager) GetHasVGPU() bool

GetHasVGPU reports whether any device on the instance is an NVIDIA vGPU slice.

func (*NvidiaGPUManager) GetMpsControlBinaryPresent

func (n *NvidiaGPUManager) GetMpsControlBinaryPresent() bool

GetMpsControlBinaryPresent reports whether ecs-init found the MPS control binary on the host.

func (*NvidiaGPUManager) GetMpsServiceEnabled

func (n *NvidiaGPUManager) GetMpsServiceEnabled() bool

GetMpsServiceEnabled reports whether ecs-init found nvidia-mps.service enabled on the host.

func (*NvidiaGPUManager) Initialize

func (n *NvidiaGPUManager) Initialize() error

Initialize sets the fields of Nvidia GPU Manager struct

func (*NvidiaGPUManager) SetDevices

func (n *NvidiaGPUManager) SetDevices()

func (*NvidiaGPUManager) SetDriverVersion

func (n *NvidiaGPUManager) SetDriverVersion(version string)

SetDriverVersion is a setter for nvidia driver version

func (*NvidiaGPUManager) SetGPUIDs

func (n *NvidiaGPUManager) SetGPUIDs(gpuIDs []string)

SetGPUIDs sets the GPUIDs

func (*NvidiaGPUManager) SetGPUMemoryMiB

func (n *NvidiaGPUManager) SetGPUMemoryMiB(gpuMemoryMiB map[string]uint64)

SetGPUMemoryMiB sets the per-GPU usable memory map

Directories

Path Synopsis
Package mock_gpu is a generated GoMock package.
Package mock_gpu is a generated GoMock package.

Jump to

Keyboard shortcuts

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