Documentation ¶
Overview ¶
Package gpu is a generated GoMock package.
Index ¶
- Constants
- Variables
- func FilePatternMatch(pattern string) ([]string, error)
- func GetDeviceCount() (uint, error)
- func GetNvidiaDriverVersion() (string, error)
- func InitNVML() error
- func NewDeviceLite(idx uint) (*nvml.Device, error)
- func ShutdownNVMLib() error
- func WriteToFile(filename string, data []byte, perm os.FileMode) error
- type GPUManager
- type MockGPUManager
- func (m *MockGPUManager) DetectGPUDevices() error
- func (m *MockGPUManager) EXPECT() *MockGPUManagerMockRecorder
- func (m *MockGPUManager) GetDriverVersion() (string, error)
- func (m *MockGPUManager) GetGPUDeviceIDs() ([]string, error)
- func (m *MockGPUManager) Initialize() error
- func (m *MockGPUManager) SaveGPUState() error
- func (m *MockGPUManager) Setup() error
- func (m *MockGPUManager) Shutdown() error
- type MockGPUManagerMockRecorder
- func (mr *MockGPUManagerMockRecorder) DetectGPUDevices() *gomock.Call
- func (mr *MockGPUManagerMockRecorder) GetDriverVersion() *gomock.Call
- func (mr *MockGPUManagerMockRecorder) GetGPUDeviceIDs() *gomock.Call
- func (mr *MockGPUManagerMockRecorder) Initialize() *gomock.Call
- func (mr *MockGPUManagerMockRecorder) SaveGPUState() *gomock.Call
- func (mr *MockGPUManagerMockRecorder) Setup() *gomock.Call
- func (mr *MockGPUManagerMockRecorder) Shutdown() *gomock.Call
- type NvidiaGPUManager
- func (n *NvidiaGPUManager) DetectGPUDevices() error
- func (n *NvidiaGPUManager) GetDriverVersion() (string, error)
- func (n *NvidiaGPUManager) GetGPUDeviceIDs() ([]string, error)
- func (n *NvidiaGPUManager) Initialize() error
- func (n *NvidiaGPUManager) SaveGPUState() error
- func (n *NvidiaGPUManager) Setup() error
- func (n *NvidiaGPUManager) Shutdown() error
Constants ¶
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 ¶
var ErrNoGPUDeviceFound = errors.New("No GPU device files found on the instance")
ErrNoGPUDeviceFound is thrown when it is not a ECS GPU instance
var InitializeNVML = InitNVML
var MatchFilePattern = FilePatternMatch
var NvmlGetDeviceCount = GetDeviceCount
var NvmlGetDriverVersion = GetNvidiaDriverVersion
var NvmlNewDeviceLite = NewDeviceLite
var ShutdownNVML = ShutdownNVMLib
var WriteContentToFile = WriteToFile
Functions ¶
func FilePatternMatch ¶
func GetDeviceCount ¶
GetDeviceCount is for getting the number of GPU devices in the instance
func GetNvidiaDriverVersion ¶
func NewDeviceLite ¶
NewDeviceLite is for initializing a new GPU device
func ShutdownNVMLib ¶
func ShutdownNVMLib() 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 ¶
func (m *MockGPUManager) EXPECT() *MockGPUManagerMockRecorder
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) 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 ¶
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