nvml

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2021 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SUCCESS                       = nvml.SUCCESS
	ERROR_UNINITIALIZED           = nvml.ERROR_UNINITIALIZED
	ERROR_INVALID_ARGUMENT        = nvml.ERROR_INVALID_ARGUMENT
	ERROR_NOT_SUPPORTED           = nvml.ERROR_NOT_SUPPORTED
	ERROR_NO_PERMISSION           = nvml.ERROR_NO_PERMISSION
	ERROR_ALREADY_INITIALIZED     = nvml.ERROR_ALREADY_INITIALIZED
	ERROR_NOT_FOUND               = nvml.ERROR_NOT_FOUND
	ERROR_INSUFFICIENT_SIZE       = nvml.ERROR_INSUFFICIENT_SIZE
	ERROR_INSUFFICIENT_POWER      = nvml.ERROR_INSUFFICIENT_POWER
	ERROR_DRIVER_NOT_LOADED       = nvml.ERROR_DRIVER_NOT_LOADED
	ERROR_TIMEOUT                 = nvml.ERROR_TIMEOUT
	ERROR_IRQ_ISSUE               = nvml.ERROR_IRQ_ISSUE
	ERROR_LIBRARY_NOT_FOUND       = nvml.ERROR_LIBRARY_NOT_FOUND
	ERROR_FUNCTION_NOT_FOUND      = nvml.ERROR_FUNCTION_NOT_FOUND
	ERROR_CORRUPTED_INFOROM       = nvml.ERROR_CORRUPTED_INFOROM
	ERROR_GPU_IS_LOST             = nvml.ERROR_GPU_IS_LOST
	ERROR_RESET_REQUIRED          = nvml.ERROR_RESET_REQUIRED
	ERROR_OPERATING_SYSTEM        = nvml.ERROR_OPERATING_SYSTEM
	ERROR_LIB_RM_VERSION_MISMATCH = nvml.ERROR_LIB_RM_VERSION_MISMATCH
	ERROR_IN_USE                  = nvml.ERROR_IN_USE
	ERROR_MEMORY                  = nvml.ERROR_MEMORY
	ERROR_NO_DATA                 = nvml.ERROR_NO_DATA
	ERROR_VGPU_ECC_NOT_SUPPORTED  = nvml.ERROR_VGPU_ECC_NOT_SUPPORTED
	ERROR_INSUFFICIENT_RESOURCES  = nvml.ERROR_INSUFFICIENT_RESOURCES
	ERROR_UNKNOWN                 = nvml.ERROR_UNKNOWN
)
View Source
const (
	DEVICE_MIG_ENABLE  = nvml.DEVICE_MIG_ENABLE
	DEVICE_MIG_DISABLE = nvml.DEVICE_MIG_DISABLE
)
View Source
const (
	GPU_INSTANCE_PROFILE_1_SLICE = nvml.GPU_INSTANCE_PROFILE_1_SLICE
	GPU_INSTANCE_PROFILE_2_SLICE = nvml.GPU_INSTANCE_PROFILE_2_SLICE
	GPU_INSTANCE_PROFILE_3_SLICE = nvml.GPU_INSTANCE_PROFILE_3_SLICE
	GPU_INSTANCE_PROFILE_4_SLICE = nvml.GPU_INSTANCE_PROFILE_4_SLICE
	GPU_INSTANCE_PROFILE_7_SLICE = nvml.GPU_INSTANCE_PROFILE_7_SLICE
	GPU_INSTANCE_PROFILE_8_SLICE = nvml.GPU_INSTANCE_PROFILE_8_SLICE
	GPU_INSTANCE_PROFILE_COUNT   = nvml.GPU_INSTANCE_PROFILE_COUNT
)
View Source
const (
	COMPUTE_INSTANCE_PROFILE_1_SLICE = nvml.COMPUTE_INSTANCE_PROFILE_1_SLICE
	COMPUTE_INSTANCE_PROFILE_2_SLICE = nvml.COMPUTE_INSTANCE_PROFILE_2_SLICE
	COMPUTE_INSTANCE_PROFILE_3_SLICE = nvml.COMPUTE_INSTANCE_PROFILE_3_SLICE
	COMPUTE_INSTANCE_PROFILE_4_SLICE = nvml.COMPUTE_INSTANCE_PROFILE_4_SLICE
	COMPUTE_INSTANCE_PROFILE_7_SLICE = nvml.COMPUTE_INSTANCE_PROFILE_7_SLICE
	COMPUTE_INSTANCE_PROFILE_8_SLICE = nvml.COMPUTE_INSTANCE_PROFILE_8_SLICE
	COMPUTE_INSTANCE_PROFILE_COUNT   = nvml.COMPUTE_INSTANCE_PROFILE_COUNT
)
View Source
const (
	COMPUTE_INSTANCE_ENGINE_PROFILE_SHARED = nvml.COMPUTE_INSTANCE_ENGINE_PROFILE_SHARED
	COMPUTE_INSTANCE_ENGINE_PROFILE_COUNT  = nvml.COMPUTE_INSTANCE_ENGINE_PROFILE_COUNT
)

Variables

View Source
var MockA100MIGProfiles = struct {
	GpuInstanceProfiles     map[int]GpuInstanceProfileInfo
	ComputeInstanceProfiles map[int]map[int]ComputeInstanceProfileInfo
}{
	GpuInstanceProfiles: map[int]GpuInstanceProfileInfo{
		GPU_INSTANCE_PROFILE_1_SLICE: {
			Id:                  GPU_INSTANCE_PROFILE_1_SLICE,
			IsP2pSupported:      0,
			SliceCount:          1,
			InstanceCount:       7,
			MultiprocessorCount: 1,
			CopyEngineCount:     1,
			DecoderCount:        0,
			EncoderCount:        0,
			JpegCount:           0,
			OfaCount:            0,
			MemorySizeMB:        5120,
		},
		GPU_INSTANCE_PROFILE_2_SLICE: {
			Id:                  GPU_INSTANCE_PROFILE_2_SLICE,
			IsP2pSupported:      0,
			SliceCount:          2,
			InstanceCount:       3,
			MultiprocessorCount: 2,
			CopyEngineCount:     2,
			DecoderCount:        1,
			EncoderCount:        1,
			JpegCount:           0,
			OfaCount:            0,
			MemorySizeMB:        10240,
		},
		GPU_INSTANCE_PROFILE_3_SLICE: {
			Id:                  GPU_INSTANCE_PROFILE_3_SLICE,
			IsP2pSupported:      0,
			SliceCount:          3,
			InstanceCount:       2,
			MultiprocessorCount: 3,
			CopyEngineCount:     4,
			DecoderCount:        2,
			EncoderCount:        2,
			JpegCount:           0,
			OfaCount:            0,
			MemorySizeMB:        20480,
		},
		GPU_INSTANCE_PROFILE_4_SLICE: {
			Id:                  GPU_INSTANCE_PROFILE_4_SLICE,
			IsP2pSupported:      0,
			SliceCount:          4,
			InstanceCount:       1,
			MultiprocessorCount: 4,
			CopyEngineCount:     4,
			DecoderCount:        2,
			EncoderCount:        2,
			JpegCount:           0,
			OfaCount:            0,
			MemorySizeMB:        20480,
		},
		GPU_INSTANCE_PROFILE_7_SLICE: {
			Id:                  GPU_INSTANCE_PROFILE_7_SLICE,
			IsP2pSupported:      0,
			SliceCount:          7,
			InstanceCount:       1,
			MultiprocessorCount: 7,
			CopyEngineCount:     8,
			DecoderCount:        5,
			EncoderCount:        5,
			JpegCount:           1,
			OfaCount:            1,
			MemorySizeMB:        40960,
		},
	},
	ComputeInstanceProfiles: map[int]map[int]ComputeInstanceProfileInfo{
		GPU_INSTANCE_PROFILE_1_SLICE: {
			COMPUTE_INSTANCE_PROFILE_1_SLICE: {
				Id:                    COMPUTE_INSTANCE_PROFILE_1_SLICE,
				SliceCount:            1,
				InstanceCount:         1,
				MultiprocessorCount:   1,
				SharedCopyEngineCount: 1,
				SharedDecoderCount:    0,
				SharedEncoderCount:    0,
				SharedJpegCount:       0,
				SharedOfaCount:        0,
			},
		},
		GPU_INSTANCE_PROFILE_2_SLICE: {
			COMPUTE_INSTANCE_PROFILE_1_SLICE: {
				Id:                    COMPUTE_INSTANCE_PROFILE_1_SLICE,
				SliceCount:            1,
				InstanceCount:         2,
				MultiprocessorCount:   1,
				SharedCopyEngineCount: 2,
				SharedDecoderCount:    1,
				SharedEncoderCount:    1,
				SharedJpegCount:       0,
				SharedOfaCount:        0,
			},
			COMPUTE_INSTANCE_PROFILE_2_SLICE: {
				Id:                    COMPUTE_INSTANCE_PROFILE_2_SLICE,
				SliceCount:            2,
				InstanceCount:         1,
				MultiprocessorCount:   2,
				SharedCopyEngineCount: 2,
				SharedDecoderCount:    1,
				SharedEncoderCount:    1,
				SharedJpegCount:       0,
				SharedOfaCount:        0,
			},
		},
		GPU_INSTANCE_PROFILE_3_SLICE: {
			COMPUTE_INSTANCE_PROFILE_1_SLICE: {
				Id:                    COMPUTE_INSTANCE_PROFILE_1_SLICE,
				SliceCount:            1,
				InstanceCount:         3,
				MultiprocessorCount:   1,
				SharedCopyEngineCount: 4,
				SharedDecoderCount:    2,
				SharedEncoderCount:    1,
				SharedJpegCount:       0,
				SharedOfaCount:        0,
			},
			COMPUTE_INSTANCE_PROFILE_2_SLICE: {
				Id:                    COMPUTE_INSTANCE_PROFILE_2_SLICE,
				SliceCount:            2,
				InstanceCount:         1,
				MultiprocessorCount:   2,
				SharedCopyEngineCount: 4,
				SharedDecoderCount:    2,
				SharedEncoderCount:    2,
				SharedJpegCount:       0,
				SharedOfaCount:        0,
			},
			COMPUTE_INSTANCE_PROFILE_3_SLICE: {
				Id:                    COMPUTE_INSTANCE_PROFILE_3_SLICE,
				SliceCount:            3,
				InstanceCount:         1,
				MultiprocessorCount:   3,
				SharedCopyEngineCount: 4,
				SharedDecoderCount:    2,
				SharedEncoderCount:    0,
				SharedJpegCount:       0,
				SharedOfaCount:        0,
			},
		},
		GPU_INSTANCE_PROFILE_4_SLICE: {
			COMPUTE_INSTANCE_PROFILE_1_SLICE: {
				Id:                    COMPUTE_INSTANCE_PROFILE_1_SLICE,
				SliceCount:            1,
				InstanceCount:         4,
				MultiprocessorCount:   1,
				SharedCopyEngineCount: 4,
				SharedDecoderCount:    2,
				SharedEncoderCount:    2,
				SharedJpegCount:       0,
				SharedOfaCount:        0,
			},
			COMPUTE_INSTANCE_PROFILE_2_SLICE: {
				Id:                    COMPUTE_INSTANCE_PROFILE_2_SLICE,
				SliceCount:            2,
				InstanceCount:         2,
				MultiprocessorCount:   2,
				SharedCopyEngineCount: 4,
				SharedDecoderCount:    2,
				SharedEncoderCount:    2,
				SharedJpegCount:       0,
				SharedOfaCount:        0,
			},
			COMPUTE_INSTANCE_PROFILE_4_SLICE: {
				Id:                    COMPUTE_INSTANCE_PROFILE_4_SLICE,
				SliceCount:            4,
				InstanceCount:         1,
				MultiprocessorCount:   4,
				SharedCopyEngineCount: 4,
				SharedDecoderCount:    2,
				SharedEncoderCount:    2,
				SharedJpegCount:       0,
				SharedOfaCount:        0,
			},
		},
		GPU_INSTANCE_PROFILE_7_SLICE: {
			COMPUTE_INSTANCE_PROFILE_1_SLICE: {
				Id:                    COMPUTE_INSTANCE_PROFILE_1_SLICE,
				SliceCount:            1,
				InstanceCount:         7,
				MultiprocessorCount:   1,
				SharedCopyEngineCount: 8,
				SharedDecoderCount:    5,
				SharedEncoderCount:    5,
				SharedJpegCount:       1,
				SharedOfaCount:        1,
			},
			COMPUTE_INSTANCE_PROFILE_2_SLICE: {
				Id:                    COMPUTE_INSTANCE_PROFILE_2_SLICE,
				SliceCount:            2,
				InstanceCount:         3,
				MultiprocessorCount:   2,
				SharedCopyEngineCount: 8,
				SharedDecoderCount:    5,
				SharedEncoderCount:    5,
				SharedJpegCount:       1,
				SharedOfaCount:        1,
			},
			COMPUTE_INSTANCE_PROFILE_3_SLICE: {
				Id:                    COMPUTE_INSTANCE_PROFILE_3_SLICE,
				SliceCount:            3,
				InstanceCount:         2,
				MultiprocessorCount:   3,
				SharedCopyEngineCount: 8,
				SharedDecoderCount:    5,
				SharedEncoderCount:    5,
				SharedJpegCount:       1,
				SharedOfaCount:        1,
			},
			COMPUTE_INSTANCE_PROFILE_4_SLICE: {
				Id:                    COMPUTE_INSTANCE_PROFILE_4_SLICE,
				SliceCount:            4,
				InstanceCount:         1,
				MultiprocessorCount:   4,
				SharedCopyEngineCount: 8,
				SharedDecoderCount:    5,
				SharedEncoderCount:    5,
				SharedJpegCount:       1,
				SharedOfaCount:        1,
			},
			COMPUTE_INSTANCE_PROFILE_7_SLICE: {
				Id:                    COMPUTE_INSTANCE_PROFILE_7_SLICE,
				SliceCount:            7,
				InstanceCount:         1,
				MultiprocessorCount:   7,
				SharedCopyEngineCount: 8,
				SharedDecoderCount:    5,
				SharedEncoderCount:    5,
				SharedJpegCount:       1,
				SharedOfaCount:        1,
			},
		},
	},
}

Functions

This section is empty.

Types

type ComputeInstance

type ComputeInstance interface {
	GetInfo() (ComputeInstanceInfo, Return)
	Destroy() Return
}

func NewMockA100ComputeInstance

func NewMockA100ComputeInstance(info ComputeInstanceInfo) ComputeInstance

type ComputeInstanceInfo

type ComputeInstanceInfo struct {
	Device      Device
	GpuInstance GpuInstance
	Id          uint32
	ProfileId   uint32
}

type ComputeInstanceProfileInfo

type ComputeInstanceProfileInfo nvml.ComputeInstanceProfileInfo

type Device

type Device interface {
	GetPciInfo() (PciInfo, Return)
	SetMigMode(Mode int) (Return, Return)
	GetMigMode() (int, int, Return)
	GetGpuInstanceProfileInfo(Profile int) (GpuInstanceProfileInfo, Return)
	CreateGpuInstance(Info *GpuInstanceProfileInfo) (GpuInstance, Return)
	GetGpuInstances(Info *GpuInstanceProfileInfo) ([]GpuInstance, Return)
}

func NewMockA100Device

func NewMockA100Device() Device

type GpuInstance

type GpuInstance interface {
	GetInfo() (GpuInstanceInfo, Return)
	GetComputeInstanceProfileInfo(Profile int, EngProfile int) (ComputeInstanceProfileInfo, Return)
	CreateComputeInstance(Info *ComputeInstanceProfileInfo) (ComputeInstance, Return)
	GetComputeInstances(Info *ComputeInstanceProfileInfo) ([]ComputeInstance, Return)
	Destroy() Return
}

func NewMockA100GpuInstance

func NewMockA100GpuInstance(info GpuInstanceInfo) GpuInstance

type GpuInstanceInfo

type GpuInstanceInfo struct {
	Device    Device
	Id        uint32
	ProfileId uint32
	Placement nvml.GpuInstancePlacement
}

type GpuInstanceProfileInfo

type GpuInstanceProfileInfo nvml.GpuInstanceProfileInfo

type Interface

type Interface interface {
	Init() Return
	Shutdown() Return
	SystemGetNVMLVersion() (string, Return)
	DeviceGetCount() (int, Return)
	DeviceGetHandleByIndex(Index int) (Device, Return)
}

func New

func New() Interface

func NewMockNVMLOnLunaServer

func NewMockNVMLOnLunaServer() Interface

type MockA100ComputeInstance

type MockA100ComputeInstance struct {
	Info ComputeInstanceInfo
}

func (*MockA100ComputeInstance) Destroy

func (ci *MockA100ComputeInstance) Destroy() Return

func (*MockA100ComputeInstance) GetInfo

type MockA100Device

type MockA100Device struct {
	MigMode            int
	GpuInstances       map[*MockA100GpuInstance]struct{}
	GpuInstanceCounter uint32
}

func (*MockA100Device) CreateGpuInstance

func (d *MockA100Device) CreateGpuInstance(info *GpuInstanceProfileInfo) (GpuInstance, Return)

func (*MockA100Device) GetGpuInstanceProfileInfo

func (d *MockA100Device) GetGpuInstanceProfileInfo(giProfileId int) (GpuInstanceProfileInfo, Return)

func (*MockA100Device) GetGpuInstances

func (d *MockA100Device) GetGpuInstances(info *GpuInstanceProfileInfo) ([]GpuInstance, Return)

func (*MockA100Device) GetMigMode

func (d *MockA100Device) GetMigMode() (int, int, Return)

func (*MockA100Device) GetPciInfo

func (d *MockA100Device) GetPciInfo() (PciInfo, Return)

func (*MockA100Device) SetMigMode

func (d *MockA100Device) SetMigMode(mode int) (Return, Return)

type MockA100GpuInstance

type MockA100GpuInstance struct {
	Info                   GpuInstanceInfo
	ComputeInstances       map[*MockA100ComputeInstance]struct{}
	ComputeInstanceCounter uint32
}

func (*MockA100GpuInstance) CreateComputeInstance

func (gi *MockA100GpuInstance) CreateComputeInstance(info *ComputeInstanceProfileInfo) (ComputeInstance, Return)

func (*MockA100GpuInstance) Destroy

func (gi *MockA100GpuInstance) Destroy() Return

func (*MockA100GpuInstance) GetComputeInstanceProfileInfo

func (gi *MockA100GpuInstance) GetComputeInstanceProfileInfo(ciProfileId int, ciEngProfileId int) (ComputeInstanceProfileInfo, Return)

func (*MockA100GpuInstance) GetComputeInstances

func (gi *MockA100GpuInstance) GetComputeInstances(info *ComputeInstanceProfileInfo) ([]ComputeInstance, Return)

func (*MockA100GpuInstance) GetInfo

func (gi *MockA100GpuInstance) GetInfo() (GpuInstanceInfo, Return)

type MockLunaServer

type MockLunaServer struct {
	Devices [8]Device
}

func (*MockLunaServer) DeviceGetCount

func (n *MockLunaServer) DeviceGetCount() (int, Return)

func (*MockLunaServer) DeviceGetHandleByIndex

func (n *MockLunaServer) DeviceGetHandleByIndex(index int) (Device, Return)

func (*MockLunaServer) Init

func (n *MockLunaServer) Init() Return

func (*MockLunaServer) Shutdown

func (n *MockLunaServer) Shutdown() Return

func (*MockLunaServer) SystemGetNVMLVersion added in v0.1.3

func (n *MockLunaServer) SystemGetNVMLVersion() (string, Return)

type MockReturn

type MockReturn nvml.Return

func (MockReturn) Error

func (r MockReturn) Error() string

func (MockReturn) String

func (r MockReturn) String() string

func (MockReturn) Value

func (r MockReturn) Value() nvml.Return

type PciInfo

type PciInfo nvml.PciInfo

type Return

type Return interface {
	Value() nvml.Return
	String() string
	Error() string
}

Jump to

Keyboard shortcuts

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