gpu

package
v1.25.3 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2019 License: Apache-2.0 Imports: 9 Imported by: 4

Documentation

Overview

Package gpu is a generated GoMock package.

Index

Constants

View Source
const (
	// NvidiaGPUDeviceFilePattern is the pattern of GPU device files on the instance
	NvidiaGPUDeviceFilePattern = "/dev/nvidia*"
	// 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"
	// FilePerm is the file permissions for gpu info json file
	FilePerm = 0700
)

Variables

View Source
var ErrNoGPUDeviceFound = errors.New("No GPU device files found on the instance")

ErrNoGPUDeviceFound is thrown when it is not a ECS GPU instance

View Source
var InitializeNVML = InitNVML
View Source
var MatchFilePattern = FilePatternMatch
View Source
var NvmlGetDeviceCount = GetDeviceCount
View Source
var NvmlGetDriverVersion = GetNvidiaDriverVersion
View Source
var NvmlNewDeviceLite = NewDeviceLite
View Source
var ShutdownNVML = ShutdownNVMLib
View Source
var WriteContentToFile = WriteToFile

Functions

func FilePatternMatch

func FilePatternMatch(pattern string) ([]string, error)

func GetDeviceCount

func GetDeviceCount() (uint, error)

GetDeviceCount is for getting the number of GPU devices in the instance

func GetNvidiaDriverVersion

func GetNvidiaDriverVersion() (string, error)

func InitNVML

func InitNVML() error

func NewDeviceLite

func NewDeviceLite(idx uint) (*nvml.Device, error)

NewDeviceLite is for initializing a new GPU device

func ShutdownNVMLib

func ShutdownNVMLib() error

func WriteToFile

func WriteToFile(filename string, data []byte, perm os.FileMode) error

Types

type GPUManager

type GPUManager interface {
	Setup() error
	Initialize() error
	Shutdown() error
	GetGPUDeviceIDs() ([]string, error)
	GetDriverVersion() (string, error)
	DetectGPUDevices() error
	SaveGPUState() error
}

GPUManager encompasses methods to get information on GPUs and their driver

func NewNvidiaGPUManager

func NewNvidiaGPUManager() GPUManager

NewNvidiaGPUManager is used to obtain NvidiaGPUManager handle

type MockGPUManager

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

MockGPUManager is a mock of GPUManager interface

func NewMockGPUManager

func NewMockGPUManager(ctrl *gomock.Controller) *MockGPUManager

NewMockGPUManager creates a new mock instance

func (*MockGPUManager) DetectGPUDevices

func (m *MockGPUManager) DetectGPUDevices() error

DetectGPUDevices mocks base method

func (*MockGPUManager) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockGPUManager) GetDriverVersion

func (m *MockGPUManager) GetDriverVersion() (string, error)

GetDriverVersion mocks base method

func (*MockGPUManager) GetGPUDeviceIDs

func (m *MockGPUManager) GetGPUDeviceIDs() ([]string, error)

GetGPUDeviceIDs mocks base method

func (*MockGPUManager) Initialize

func (m *MockGPUManager) Initialize() error

Initialize mocks base method

func (*MockGPUManager) SaveGPUState

func (m *MockGPUManager) SaveGPUState() error

SaveGPUState mocks base method

func (*MockGPUManager) Setup

func (m *MockGPUManager) Setup() error

Setup mocks base method

func (*MockGPUManager) Shutdown

func (m *MockGPUManager) Shutdown() error

Shutdown mocks base method

type MockGPUManagerMockRecorder

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

MockGPUManagerMockRecorder is the mock recorder for MockGPUManager

func (*MockGPUManagerMockRecorder) DetectGPUDevices

func (mr *MockGPUManagerMockRecorder) DetectGPUDevices() *gomock.Call

DetectGPUDevices indicates an expected call of DetectGPUDevices

func (*MockGPUManagerMockRecorder) GetDriverVersion

func (mr *MockGPUManagerMockRecorder) GetDriverVersion() *gomock.Call

GetDriverVersion indicates an expected call of GetDriverVersion

func (*MockGPUManagerMockRecorder) GetGPUDeviceIDs

func (mr *MockGPUManagerMockRecorder) GetGPUDeviceIDs() *gomock.Call

GetGPUDeviceIDs indicates an expected call of GetGPUDeviceIDs

func (*MockGPUManagerMockRecorder) Initialize

func (mr *MockGPUManagerMockRecorder) Initialize() *gomock.Call

Initialize indicates an expected call of Initialize

func (*MockGPUManagerMockRecorder) SaveGPUState

func (mr *MockGPUManagerMockRecorder) SaveGPUState() *gomock.Call

SaveGPUState indicates an expected call of SaveGPUState

func (*MockGPUManagerMockRecorder) Setup

func (mr *MockGPUManagerMockRecorder) Setup() *gomock.Call

Setup indicates an expected call of Setup

func (*MockGPUManagerMockRecorder) Shutdown

func (mr *MockGPUManagerMockRecorder) Shutdown() *gomock.Call

Shutdown indicates an expected call of Shutdown

type NvidiaGPUManager

type NvidiaGPUManager struct {
	DriverVersion string
	GPUIDs        []string
}

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

func (*NvidiaGPUManager) DetectGPUDevices

func (n *NvidiaGPUManager) DetectGPUDevices() error

DetectGPUDevices checks if GPU devices are present in the instance

func (*NvidiaGPUManager) GetDriverVersion

func (n *NvidiaGPUManager) GetDriverVersion() (string, error)

GetDriverVersion is for getting Nvidia driver version on the instance

func (*NvidiaGPUManager) GetGPUDeviceIDs

func (n *NvidiaGPUManager) GetGPUDeviceIDs() ([]string, error)

GetGPUDeviceIDs is for getting the GPU device UUIDs

func (*NvidiaGPUManager) Initialize

func (n *NvidiaGPUManager) Initialize() error

Initialize is for initlializing nvidia's nvml library

func (*NvidiaGPUManager) SaveGPUState

func (n *NvidiaGPUManager) SaveGPUState() error

SaveGPUState saves gpu state info on the disk

func (*NvidiaGPUManager) Setup

func (n *NvidiaGPUManager) Setup() error

Setup is used for setting up gpu information in the instance

func (*NvidiaGPUManager) Shutdown

func (n *NvidiaGPUManager) Shutdown() error

Shutdown is for shutting down nvidia's nvml library

Jump to

Keyboard shortcuts

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