Documentation ¶
Index ¶
- Constants
- type BrandType
- type ComputeInstance
- type ComputeInstanceInfo
- type ComputeInstanceMock
- type ComputeInstancePlacement
- type ComputeInstanceProfileInfo
- type ComputeMode
- type Device
- type DeviceArchitecture
- type DeviceAttributes
- type DeviceMock
- func (mock *DeviceMock) CreateGpuInstanceWithPlacement(gpuInstanceProfileInfo *GpuInstanceProfileInfo, ...) (GpuInstance, Return)
- func (mock *DeviceMock) CreateGpuInstanceWithPlacementCalls() []struct{ ... }
- func (mock *DeviceMock) GetArchitecture() (DeviceArchitecture, Return)
- func (mock *DeviceMock) GetArchitectureCalls() []struct{}
- func (mock *DeviceMock) GetAttributes() (DeviceAttributes, Return)
- func (mock *DeviceMock) GetAttributesCalls() []struct{}
- func (mock *DeviceMock) GetBrand() (BrandType, Return)
- func (mock *DeviceMock) GetBrandCalls() []struct{}
- func (mock *DeviceMock) GetComputeInstanceId() (int, Return)
- func (mock *DeviceMock) GetComputeInstanceIdCalls() []struct{}
- func (mock *DeviceMock) GetCudaComputeCapability() (int, int, Return)
- func (mock *DeviceMock) GetCudaComputeCapabilityCalls() []struct{}
- func (mock *DeviceMock) GetDeviceHandleFromMigDeviceHandle() (Device, Return)
- func (mock *DeviceMock) GetDeviceHandleFromMigDeviceHandleCalls() []struct{}
- func (mock *DeviceMock) GetGpuInstanceById(ID int) (GpuInstance, Return)
- func (mock *DeviceMock) GetGpuInstanceByIdCalls() []struct{ ... }
- func (mock *DeviceMock) GetGpuInstanceId() (int, Return)
- func (mock *DeviceMock) GetGpuInstanceIdCalls() []struct{}
- func (mock *DeviceMock) GetGpuInstancePossiblePlacements(gpuInstanceProfileInfo *GpuInstanceProfileInfo) ([]GpuInstancePlacement, Return)
- func (mock *DeviceMock) GetGpuInstancePossiblePlacementsCalls() []struct{ ... }
- func (mock *DeviceMock) GetGpuInstanceProfileInfo(Profile int) (GpuInstanceProfileInfo, Return)
- func (mock *DeviceMock) GetGpuInstanceProfileInfoCalls() []struct{ ... }
- func (mock *DeviceMock) GetGpuInstances(Info *GpuInstanceProfileInfo) ([]GpuInstance, Return)
- func (mock *DeviceMock) GetGpuInstancesCalls() []struct{ ... }
- func (mock *DeviceMock) GetIndex() (int, Return)
- func (mock *DeviceMock) GetIndexCalls() []struct{}
- func (mock *DeviceMock) GetMaxMigDeviceCount() (int, Return)
- func (mock *DeviceMock) GetMaxMigDeviceCountCalls() []struct{}
- func (mock *DeviceMock) GetMemoryInfo() (Memory, Return)
- func (mock *DeviceMock) GetMemoryInfoCalls() []struct{}
- func (mock *DeviceMock) GetMigDeviceHandleByIndex(Index int) (Device, Return)
- func (mock *DeviceMock) GetMigDeviceHandleByIndexCalls() []struct{ ... }
- func (mock *DeviceMock) GetMigMode() (int, int, Return)
- func (mock *DeviceMock) GetMigModeCalls() []struct{}
- func (mock *DeviceMock) GetMinorNumber() (int, Return)
- func (mock *DeviceMock) GetMinorNumberCalls() []struct{}
- func (mock *DeviceMock) GetName() (string, Return)
- func (mock *DeviceMock) GetNameCalls() []struct{}
- func (mock *DeviceMock) GetNvLinkRemotePciInfo(n int) (PciInfo, Return)
- func (mock *DeviceMock) GetNvLinkRemotePciInfoCalls() []struct{ ... }
- func (mock *DeviceMock) GetNvLinkState(n int) (EnableState, Return)
- func (mock *DeviceMock) GetNvLinkStateCalls() []struct{ ... }
- func (mock *DeviceMock) GetPciInfo() (PciInfo, Return)
- func (mock *DeviceMock) GetPciInfoCalls() []struct{}
- func (mock *DeviceMock) GetSupportedEventTypes() (uint64, Return)
- func (mock *DeviceMock) GetSupportedEventTypesCalls() []struct{}
- func (mock *DeviceMock) GetTopologyCommonAncestor(device Device) (GpuTopologyLevel, Return)
- func (mock *DeviceMock) GetTopologyCommonAncestorCalls() []struct{ ... }
- func (mock *DeviceMock) GetUUID() (string, Return)
- func (mock *DeviceMock) GetUUIDCalls() []struct{}
- func (mock *DeviceMock) IsMigDeviceHandle() (bool, Return)
- func (mock *DeviceMock) IsMigDeviceHandleCalls() []struct{}
- func (mock *DeviceMock) RegisterEvents(v uint64, eventSet EventSet) Return
- func (mock *DeviceMock) RegisterEventsCalls() []struct{ ... }
- func (mock *DeviceMock) SetComputeMode(computeMode ComputeMode) Return
- func (mock *DeviceMock) SetComputeModeCalls() []struct{ ... }
- func (mock *DeviceMock) SetMigMode(Mode int) (Return, Return)
- func (mock *DeviceMock) SetMigModeCalls() []struct{ ... }
- type EnableState
- type EventData
- type EventSet
- type GpuInstance
- type GpuInstanceInfo
- type GpuInstanceMock
- func (mock *GpuInstanceMock) CreateComputeInstance(Info *ComputeInstanceProfileInfo) (ComputeInstance, Return)
- func (mock *GpuInstanceMock) CreateComputeInstanceCalls() []struct{ ... }
- func (mock *GpuInstanceMock) Destroy() Return
- func (mock *GpuInstanceMock) DestroyCalls() []struct{}
- func (mock *GpuInstanceMock) GetComputeInstanceById(ID int) (ComputeInstance, Return)
- func (mock *GpuInstanceMock) GetComputeInstanceByIdCalls() []struct{ ... }
- func (mock *GpuInstanceMock) GetComputeInstanceProfileInfo(Profile int, EngProfile int) (ComputeInstanceProfileInfo, Return)
- func (mock *GpuInstanceMock) GetComputeInstanceProfileInfoCalls() []struct{ ... }
- func (mock *GpuInstanceMock) GetComputeInstances(Info *ComputeInstanceProfileInfo) ([]ComputeInstance, Return)
- func (mock *GpuInstanceMock) GetComputeInstancesCalls() []struct{ ... }
- func (mock *GpuInstanceMock) GetInfo() (GpuInstanceInfo, Return)
- func (mock *GpuInstanceMock) GetInfoCalls() []struct{}
- type GpuInstancePlacement
- type GpuInstanceProfileInfo
- type GpuTopologyLevel
- type Interface
- type InterfaceMock
- func (mock *InterfaceMock) DeviceGetCount() (int, Return)
- func (mock *InterfaceMock) DeviceGetCountCalls() []struct{}
- func (mock *InterfaceMock) DeviceGetHandleByIndex(Index int) (Device, Return)
- func (mock *InterfaceMock) DeviceGetHandleByIndexCalls() []struct{ ... }
- func (mock *InterfaceMock) DeviceGetHandleByUUID(UUID string) (Device, Return)
- func (mock *InterfaceMock) DeviceGetHandleByUUIDCalls() []struct{ ... }
- func (mock *InterfaceMock) ErrorString(r Return) string
- func (mock *InterfaceMock) ErrorStringCalls() []struct{ ... }
- func (mock *InterfaceMock) EventSetCreate() (EventSet, Return)
- func (mock *InterfaceMock) EventSetCreateCalls() []struct{}
- func (mock *InterfaceMock) Init() Return
- func (mock *InterfaceMock) InitCalls() []struct{}
- func (mock *InterfaceMock) Lookup(s string) error
- func (mock *InterfaceMock) LookupCalls() []struct{ ... }
- func (mock *InterfaceMock) Shutdown() Return
- func (mock *InterfaceMock) ShutdownCalls() []struct{}
- func (mock *InterfaceMock) SystemGetCudaDriverVersion() (int, Return)
- func (mock *InterfaceMock) SystemGetCudaDriverVersionCalls() []struct{}
- func (mock *InterfaceMock) SystemGetDriverVersion() (string, Return)
- func (mock *InterfaceMock) SystemGetDriverVersionCalls() []struct{}
- type Memory
- type Option
- type PciInfo
- type Return
Constants ¶
const ( SUCCESS = Return(nvml.SUCCESS) ERROR_UNINITIALIZED = Return(nvml.ERROR_UNINITIALIZED) ERROR_INVALID_ARGUMENT = Return(nvml.ERROR_INVALID_ARGUMENT) ERROR_NOT_SUPPORTED = Return(nvml.ERROR_NOT_SUPPORTED) ERROR_NO_PERMISSION = Return(nvml.ERROR_NO_PERMISSION) ERROR_ALREADY_INITIALIZED = Return(nvml.ERROR_ALREADY_INITIALIZED) ERROR_NOT_FOUND = Return(nvml.ERROR_NOT_FOUND) ERROR_INSUFFICIENT_SIZE = Return(nvml.ERROR_INSUFFICIENT_SIZE) ERROR_INSUFFICIENT_POWER = Return(nvml.ERROR_INSUFFICIENT_POWER) ERROR_DRIVER_NOT_LOADED = Return(nvml.ERROR_DRIVER_NOT_LOADED) ERROR_TIMEOUT = Return(nvml.ERROR_TIMEOUT) ERROR_IRQ_ISSUE = Return(nvml.ERROR_IRQ_ISSUE) ERROR_LIBRARY_NOT_FOUND = Return(nvml.ERROR_LIBRARY_NOT_FOUND) ERROR_FUNCTION_NOT_FOUND = Return(nvml.ERROR_FUNCTION_NOT_FOUND) ERROR_CORRUPTED_INFOROM = Return(nvml.ERROR_CORRUPTED_INFOROM) ERROR_GPU_IS_LOST = Return(nvml.ERROR_GPU_IS_LOST) ERROR_RESET_REQUIRED = Return(nvml.ERROR_RESET_REQUIRED) ERROR_OPERATING_SYSTEM = Return(nvml.ERROR_OPERATING_SYSTEM) ERROR_LIB_RM_VERSION_MISMATCH = Return(nvml.ERROR_LIB_RM_VERSION_MISMATCH) ERROR_IN_USE = Return(nvml.ERROR_IN_USE) ERROR_MEMORY = Return(nvml.ERROR_MEMORY) ERROR_NO_DATA = Return(nvml.ERROR_NO_DATA) ERROR_VGPU_ECC_NOT_SUPPORTED = Return(nvml.ERROR_VGPU_ECC_NOT_SUPPORTED) ERROR_INSUFFICIENT_RESOURCES = Return(nvml.ERROR_INSUFFICIENT_RESOURCES) ERROR_UNKNOWN = Return(nvml.ERROR_UNKNOWN) )
Return constants
const ( DEVICE_ARCH_KEPLER = nvml.DEVICE_ARCH_KEPLER DEVICE_ARCH_MAXWELL = nvml.DEVICE_ARCH_MAXWELL DEVICE_ARCH_PASCAL = nvml.DEVICE_ARCH_PASCAL DEVICE_ARCH_VOLTA = nvml.DEVICE_ARCH_VOLTA DEVICE_ARCH_TURING = nvml.DEVICE_ARCH_TURING DEVICE_ARCH_AMPERE = nvml.DEVICE_ARCH_AMPERE DEVICE_ARCH_ADA = nvml.DEVICE_ARCH_ADA DEVICE_ARCH_HOPPER = nvml.DEVICE_ARCH_HOPPER DEVICE_ARCH_UNKNOWN = nvml.DEVICE_ARCH_UNKNOWN )
Device architecture constants
const ( BRAND_UNKNOWN = BrandType(nvml.BRAND_UNKNOWN) BRAND_QUADRO = BrandType(nvml.BRAND_QUADRO) BRAND_TESLA = BrandType(nvml.BRAND_TESLA) BRAND_NVS = BrandType(nvml.BRAND_NVS) BRAND_GRID = BrandType(nvml.BRAND_GRID) BRAND_GEFORCE = BrandType(nvml.BRAND_GEFORCE) BRAND_TITAN = BrandType(nvml.BRAND_TITAN) BRAND_NVIDIA_VAPPS = BrandType(nvml.BRAND_NVIDIA_VAPPS) BRAND_NVIDIA_VPC = BrandType(nvml.BRAND_NVIDIA_VPC) BRAND_NVIDIA_VCS = BrandType(nvml.BRAND_NVIDIA_VCS) BRAND_NVIDIA_VWS = BrandType(nvml.BRAND_NVIDIA_VWS) BRAND_NVIDIA_CLOUD_GAMING = BrandType(nvml.BRAND_NVIDIA_CLOUD_GAMING) BRAND_NVIDIA_VGAMING = BrandType(nvml.BRAND_NVIDIA_VGAMING) BRAND_QUADRO_RTX = BrandType(nvml.BRAND_QUADRO_RTX) BRAND_NVIDIA_RTX = BrandType(nvml.BRAND_NVIDIA_RTX) BRAND_NVIDIA = BrandType(nvml.BRAND_NVIDIA) BRAND_GEFORCE_RTX = BrandType(nvml.BRAND_GEFORCE_RTX) BRAND_TITAN_RTX = BrandType(nvml.BRAND_TITAN_RTX) BRAND_COUNT = BrandType(nvml.BRAND_COUNT) )
Device brand constants
const ( DEVICE_MIG_ENABLE = nvml.DEVICE_MIG_ENABLE DEVICE_MIG_DISABLE = nvml.DEVICE_MIG_DISABLE )
MIG Mode constants
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_6_SLICE = nvml.GPU_INSTANCE_PROFILE_6_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_1_SLICE_REV1 = nvml.GPU_INSTANCE_PROFILE_1_SLICE_REV1 GPU_INSTANCE_PROFILE_1_SLICE_REV2 = nvml.GPU_INSTANCE_PROFILE_1_SLICE_REV2 GPU_INSTANCE_PROFILE_2_SLICE_REV1 = nvml.GPU_INSTANCE_PROFILE_2_SLICE_REV1 GPU_INSTANCE_PROFILE_COUNT = nvml.GPU_INSTANCE_PROFILE_COUNT )
GPU Instance Profiles
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_6_SLICE = nvml.COMPUTE_INSTANCE_PROFILE_6_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_1_SLICE_REV1 = nvml.COMPUTE_INSTANCE_PROFILE_1_SLICE_REV1 COMPUTE_INSTANCE_PROFILE_COUNT = nvml.COMPUTE_INSTANCE_PROFILE_COUNT )
Compute Instance Profiles
const ( COMPUTE_INSTANCE_ENGINE_PROFILE_SHARED = nvml.COMPUTE_INSTANCE_ENGINE_PROFILE_SHARED COMPUTE_INSTANCE_ENGINE_PROFILE_COUNT = nvml.COMPUTE_INSTANCE_ENGINE_PROFILE_COUNT )
Compute Instance Engine Profiles
const ( EventTypeXidCriticalError = nvml.EventTypeXidCriticalError EventTypeSingleBitEccError = nvml.EventTypeSingleBitEccError EventTypeDoubleBitEccError = nvml.EventTypeDoubleBitEccError )
Event Types
const ( TOPOLOGY_INTERNAL = GpuTopologyLevel(nvml.TOPOLOGY_INTERNAL) TOPOLOGY_SINGLE = GpuTopologyLevel(nvml.TOPOLOGY_SINGLE) TOPOLOGY_MULTIPLE = GpuTopologyLevel(nvml.TOPOLOGY_MULTIPLE) TOPOLOGY_HOSTBRIDGE = GpuTopologyLevel(nvml.TOPOLOGY_HOSTBRIDGE) TOPOLOGY_NODE = GpuTopologyLevel(nvml.TOPOLOGY_NODE) TOPOLOGY_SYSTEM = GpuTopologyLevel(nvml.TOPOLOGY_SYSTEM) )
GPU Topology enumeration
const ( FEATURE_DISABLED = EnableState(nvml.FEATURE_DISABLED) FEATURE_ENABLED = EnableState(nvml.FEATURE_ENABLED) )
Generic enable/disable constants
const ( COMPUTEMODE_DEFAULT = ComputeMode(nvml.COMPUTEMODE_DEFAULT) COMPUTEMODE_EXCLUSIVE_THREAD = ComputeMode(nvml.COMPUTEMODE_EXCLUSIVE_THREAD) COMPUTEMODE_PROHIBITED = ComputeMode(nvml.COMPUTEMODE_PROHIBITED) COMPUTEMODE_EXCLUSIVE_PROCESS = ComputeMode(nvml.COMPUTEMODE_EXCLUSIVE_PROCESS) COMPUTEMODE_COUNT = ComputeMode(nvml.COMPUTEMODE_COUNT) )
Compute mode constants
const (
NVLINK_MAX_LINKS = nvml.NVLINK_MAX_LINKS
)
General untyped constants
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ComputeInstance ¶
type ComputeInstance interface { Destroy() Return GetInfo() (ComputeInstanceInfo, Return) }
ComputeInstance defines the functions implemented by a ComputeInstance
type ComputeInstanceInfo ¶
type ComputeInstanceInfo struct { Device Device GpuInstance GpuInstance Id uint32 ProfileId uint32 Placement ComputeInstancePlacement }
ComputeInstanceInfo holds info about a Compute Instance
type ComputeInstanceMock ¶
type ComputeInstanceMock struct { // DestroyFunc mocks the Destroy method. DestroyFunc func() Return // GetInfoFunc mocks the GetInfo method. GetInfoFunc func() (ComputeInstanceInfo, Return) // contains filtered or unexported fields }
ComputeInstanceMock is a mock implementation of ComputeInstance.
func TestSomethingThatUsesComputeInstance(t *testing.T) { // make and configure a mocked ComputeInstance mockedComputeInstance := &ComputeInstanceMock{ DestroyFunc: func() Return { panic("mock out the Destroy method") }, GetInfoFunc: func() (ComputeInstanceInfo, Return) { panic("mock out the GetInfo method") }, } // use mockedComputeInstance in code that requires ComputeInstance // and then make assertions. }
func (*ComputeInstanceMock) Destroy ¶
func (mock *ComputeInstanceMock) Destroy() Return
Destroy calls DestroyFunc.
func (*ComputeInstanceMock) DestroyCalls ¶
func (mock *ComputeInstanceMock) DestroyCalls() []struct { }
DestroyCalls gets all the calls that were made to Destroy. Check the length with:
len(mockedComputeInstance.DestroyCalls())
func (*ComputeInstanceMock) GetInfo ¶
func (mock *ComputeInstanceMock) GetInfo() (ComputeInstanceInfo, Return)
GetInfo calls GetInfoFunc.
func (*ComputeInstanceMock) GetInfoCalls ¶
func (mock *ComputeInstanceMock) GetInfoCalls() []struct { }
GetInfoCalls gets all the calls that were made to GetInfo. Check the length with:
len(mockedComputeInstance.GetInfoCalls())
type ComputeInstancePlacement ¶
type ComputeInstancePlacement nvml.ComputeInstancePlacement
ComputeInstancePlacement holds placement info about a Compute Instance
type ComputeInstanceProfileInfo ¶
type ComputeInstanceProfileInfo nvml.ComputeInstanceProfileInfo
ComputeInstanceProfileInfo holds info about a Compute Instance Profile
type ComputeMode ¶
type ComputeMode nvml.ComputeMode
ComputeMode represents the compute mode for a device
type Device ¶
type Device interface { CreateGpuInstanceWithPlacement(*GpuInstanceProfileInfo, *GpuInstancePlacement) (GpuInstance, Return) GetArchitecture() (DeviceArchitecture, Return) GetAttributes() (DeviceAttributes, Return) GetBrand() (BrandType, Return) GetComputeInstanceId() (int, Return) GetCudaComputeCapability() (int, int, Return) GetDeviceHandleFromMigDeviceHandle() (Device, Return) GetGpuInstanceById(ID int) (GpuInstance, Return) GetGpuInstanceId() (int, Return) GetGpuInstancePossiblePlacements(*GpuInstanceProfileInfo) ([]GpuInstancePlacement, Return) GetGpuInstanceProfileInfo(Profile int) (GpuInstanceProfileInfo, Return) GetGpuInstances(Info *GpuInstanceProfileInfo) ([]GpuInstance, Return) GetIndex() (int, Return) GetMaxMigDeviceCount() (int, Return) GetMemoryInfo() (Memory, Return) GetMigDeviceHandleByIndex(Index int) (Device, Return) GetMigMode() (int, int, Return) GetMinorNumber() (int, Return) GetName() (string, Return) GetNvLinkRemotePciInfo(int) (PciInfo, Return) GetNvLinkState(int) (EnableState, Return) GetPciInfo() (PciInfo, Return) GetSupportedEventTypes() (uint64, Return) GetTopologyCommonAncestor(Device) (GpuTopologyLevel, Return) GetUUID() (string, Return) IsMigDeviceHandle() (bool, Return) RegisterEvents(uint64, EventSet) Return SetComputeMode(ComputeMode) Return SetMigMode(Mode int) (Return, Return) // contains filtered or unexported methods }
Device defines the functions implemented by an NVML device
type DeviceArchitecture ¶
type DeviceArchitecture nvml.DeviceArchitecture
DeviceArchitecture represents the hardware architecture of a GPU device
type DeviceAttributes ¶
type DeviceAttributes nvml.DeviceAttributes
DeviceAttributes stores information about MIG devices
type DeviceMock ¶
type DeviceMock struct { // CreateGpuInstanceWithPlacementFunc mocks the CreateGpuInstanceWithPlacement method. CreateGpuInstanceWithPlacementFunc func(gpuInstanceProfileInfo *GpuInstanceProfileInfo, gpuInstancePlacement *GpuInstancePlacement) (GpuInstance, Return) // GetArchitectureFunc mocks the GetArchitecture method. GetArchitectureFunc func() (DeviceArchitecture, Return) // GetAttributesFunc mocks the GetAttributes method. GetAttributesFunc func() (DeviceAttributes, Return) // GetBrandFunc mocks the GetBrand method. GetBrandFunc func() (BrandType, Return) // GetComputeInstanceIdFunc mocks the GetComputeInstanceId method. GetComputeInstanceIdFunc func() (int, Return) // GetCudaComputeCapabilityFunc mocks the GetCudaComputeCapability method. GetCudaComputeCapabilityFunc func() (int, int, Return) // GetDeviceHandleFromMigDeviceHandleFunc mocks the GetDeviceHandleFromMigDeviceHandle method. GetDeviceHandleFromMigDeviceHandleFunc func() (Device, Return) // GetGpuInstanceByIdFunc mocks the GetGpuInstanceById method. GetGpuInstanceByIdFunc func(ID int) (GpuInstance, Return) // GetGpuInstanceIdFunc mocks the GetGpuInstanceId method. GetGpuInstanceIdFunc func() (int, Return) // GetGpuInstancePossiblePlacementsFunc mocks the GetGpuInstancePossiblePlacements method. GetGpuInstancePossiblePlacementsFunc func(gpuInstanceProfileInfo *GpuInstanceProfileInfo) ([]GpuInstancePlacement, Return) // GetGpuInstanceProfileInfoFunc mocks the GetGpuInstanceProfileInfo method. GetGpuInstanceProfileInfoFunc func(Profile int) (GpuInstanceProfileInfo, Return) // GetGpuInstancesFunc mocks the GetGpuInstances method. GetGpuInstancesFunc func(Info *GpuInstanceProfileInfo) ([]GpuInstance, Return) // GetIndexFunc mocks the GetIndex method. GetIndexFunc func() (int, Return) // GetMaxMigDeviceCountFunc mocks the GetMaxMigDeviceCount method. GetMaxMigDeviceCountFunc func() (int, Return) // GetMemoryInfoFunc mocks the GetMemoryInfo method. GetMemoryInfoFunc func() (Memory, Return) // GetMigDeviceHandleByIndexFunc mocks the GetMigDeviceHandleByIndex method. GetMigDeviceHandleByIndexFunc func(Index int) (Device, Return) // GetMigModeFunc mocks the GetMigMode method. GetMigModeFunc func() (int, int, Return) // GetMinorNumberFunc mocks the GetMinorNumber method. GetMinorNumberFunc func() (int, Return) // GetNameFunc mocks the GetName method. GetNameFunc func() (string, Return) // GetNvLinkRemotePciInfoFunc mocks the GetNvLinkRemotePciInfo method. GetNvLinkRemotePciInfoFunc func(n int) (PciInfo, Return) // GetNvLinkStateFunc mocks the GetNvLinkState method. GetNvLinkStateFunc func(n int) (EnableState, Return) // GetPciInfoFunc mocks the GetPciInfo method. GetPciInfoFunc func() (PciInfo, Return) // GetSupportedEventTypesFunc mocks the GetSupportedEventTypes method. GetSupportedEventTypesFunc func() (uint64, Return) // GetTopologyCommonAncestorFunc mocks the GetTopologyCommonAncestor method. GetTopologyCommonAncestorFunc func(device Device) (GpuTopologyLevel, Return) // GetUUIDFunc mocks the GetUUID method. GetUUIDFunc func() (string, Return) // IsMigDeviceHandleFunc mocks the IsMigDeviceHandle method. IsMigDeviceHandleFunc func() (bool, Return) // RegisterEventsFunc mocks the RegisterEvents method. RegisterEventsFunc func(v uint64, eventSet EventSet) Return // SetComputeModeFunc mocks the SetComputeMode method. SetComputeModeFunc func(computeMode ComputeMode) Return // SetMigModeFunc mocks the SetMigMode method. SetMigModeFunc func(Mode int) (Return, Return) // contains filtered or unexported fields }
DeviceMock is a mock implementation of Device.
func TestSomethingThatUsesDevice(t *testing.T) { // make and configure a mocked Device mockedDevice := &DeviceMock{ CreateGpuInstanceWithPlacementFunc: func(gpuInstanceProfileInfo *GpuInstanceProfileInfo, gpuInstancePlacement *GpuInstancePlacement) (GpuInstance, Return) { panic("mock out the CreateGpuInstanceWithPlacement method") }, GetArchitectureFunc: func() (DeviceArchitecture, Return) { panic("mock out the GetArchitecture method") }, GetAttributesFunc: func() (DeviceAttributes, Return) { panic("mock out the GetAttributes method") }, GetBrandFunc: func() (BrandType, Return) { panic("mock out the GetBrand method") }, GetComputeInstanceIdFunc: func() (int, Return) { panic("mock out the GetComputeInstanceId method") }, GetCudaComputeCapabilityFunc: func() (int, int, Return) { panic("mock out the GetCudaComputeCapability method") }, GetDeviceHandleFromMigDeviceHandleFunc: func() (Device, Return) { panic("mock out the GetDeviceHandleFromMigDeviceHandle method") }, GetGpuInstanceByIdFunc: func(ID int) (GpuInstance, Return) { panic("mock out the GetGpuInstanceById method") }, GetGpuInstanceIdFunc: func() (int, Return) { panic("mock out the GetGpuInstanceId method") }, GetGpuInstancePossiblePlacementsFunc: func(gpuInstanceProfileInfo *GpuInstanceProfileInfo) ([]GpuInstancePlacement, Return) { panic("mock out the GetGpuInstancePossiblePlacements method") }, GetGpuInstanceProfileInfoFunc: func(Profile int) (GpuInstanceProfileInfo, Return) { panic("mock out the GetGpuInstanceProfileInfo method") }, GetGpuInstancesFunc: func(Info *GpuInstanceProfileInfo) ([]GpuInstance, Return) { panic("mock out the GetGpuInstances method") }, GetIndexFunc: func() (int, Return) { panic("mock out the GetIndex method") }, GetMaxMigDeviceCountFunc: func() (int, Return) { panic("mock out the GetMaxMigDeviceCount method") }, GetMemoryInfoFunc: func() (Memory, Return) { panic("mock out the GetMemoryInfo method") }, GetMigDeviceHandleByIndexFunc: func(Index int) (Device, Return) { panic("mock out the GetMigDeviceHandleByIndex method") }, GetMigModeFunc: func() (int, int, Return) { panic("mock out the GetMigMode method") }, GetMinorNumberFunc: func() (int, Return) { panic("mock out the GetMinorNumber method") }, GetNameFunc: func() (string, Return) { panic("mock out the GetName method") }, GetNvLinkRemotePciInfoFunc: func(n int) (PciInfo, Return) { panic("mock out the GetNvLinkRemotePciInfo method") }, GetNvLinkStateFunc: func(n int) (EnableState, Return) { panic("mock out the GetNvLinkState method") }, GetPciInfoFunc: func() (PciInfo, Return) { panic("mock out the GetPciInfo method") }, GetSupportedEventTypesFunc: func() (uint64, Return) { panic("mock out the GetSupportedEventTypes method") }, GetTopologyCommonAncestorFunc: func(device Device) (GpuTopologyLevel, Return) { panic("mock out the GetTopologyCommonAncestor method") }, GetUUIDFunc: func() (string, Return) { panic("mock out the GetUUID method") }, IsMigDeviceHandleFunc: func() (bool, Return) { panic("mock out the IsMigDeviceHandle method") }, RegisterEventsFunc: func(v uint64, eventSet EventSet) Return { panic("mock out the RegisterEvents method") }, SetComputeModeFunc: func(computeMode ComputeMode) Return { panic("mock out the SetComputeMode method") }, SetMigModeFunc: func(Mode int) (Return, Return) { panic("mock out the SetMigMode method") }, nvmlDeviceHandleFunc: func() *nvml.Device { panic("mock out the nvmlDeviceHandle method") }, } // use mockedDevice in code that requires Device // and then make assertions. }
func (*DeviceMock) CreateGpuInstanceWithPlacement ¶
func (mock *DeviceMock) CreateGpuInstanceWithPlacement(gpuInstanceProfileInfo *GpuInstanceProfileInfo, gpuInstancePlacement *GpuInstancePlacement) (GpuInstance, Return)
CreateGpuInstanceWithPlacement calls CreateGpuInstanceWithPlacementFunc.
func (*DeviceMock) CreateGpuInstanceWithPlacementCalls ¶
func (mock *DeviceMock) CreateGpuInstanceWithPlacementCalls() []struct { GpuInstanceProfileInfo *GpuInstanceProfileInfo GpuInstancePlacement *GpuInstancePlacement }
CreateGpuInstanceWithPlacementCalls gets all the calls that were made to CreateGpuInstanceWithPlacement. Check the length with:
len(mockedDevice.CreateGpuInstanceWithPlacementCalls())
func (*DeviceMock) GetArchitecture ¶
func (mock *DeviceMock) GetArchitecture() (DeviceArchitecture, Return)
GetArchitecture calls GetArchitectureFunc.
func (*DeviceMock) GetArchitectureCalls ¶
func (mock *DeviceMock) GetArchitectureCalls() []struct { }
GetArchitectureCalls gets all the calls that were made to GetArchitecture. Check the length with:
len(mockedDevice.GetArchitectureCalls())
func (*DeviceMock) GetAttributes ¶
func (mock *DeviceMock) GetAttributes() (DeviceAttributes, Return)
GetAttributes calls GetAttributesFunc.
func (*DeviceMock) GetAttributesCalls ¶
func (mock *DeviceMock) GetAttributesCalls() []struct { }
GetAttributesCalls gets all the calls that were made to GetAttributes. Check the length with:
len(mockedDevice.GetAttributesCalls())
func (*DeviceMock) GetBrand ¶
func (mock *DeviceMock) GetBrand() (BrandType, Return)
GetBrand calls GetBrandFunc.
func (*DeviceMock) GetBrandCalls ¶
func (mock *DeviceMock) GetBrandCalls() []struct { }
GetBrandCalls gets all the calls that were made to GetBrand. Check the length with:
len(mockedDevice.GetBrandCalls())
func (*DeviceMock) GetComputeInstanceId ¶
func (mock *DeviceMock) GetComputeInstanceId() (int, Return)
GetComputeInstanceId calls GetComputeInstanceIdFunc.
func (*DeviceMock) GetComputeInstanceIdCalls ¶
func (mock *DeviceMock) GetComputeInstanceIdCalls() []struct { }
GetComputeInstanceIdCalls gets all the calls that were made to GetComputeInstanceId. Check the length with:
len(mockedDevice.GetComputeInstanceIdCalls())
func (*DeviceMock) GetCudaComputeCapability ¶
func (mock *DeviceMock) GetCudaComputeCapability() (int, int, Return)
GetCudaComputeCapability calls GetCudaComputeCapabilityFunc.
func (*DeviceMock) GetCudaComputeCapabilityCalls ¶
func (mock *DeviceMock) GetCudaComputeCapabilityCalls() []struct { }
GetCudaComputeCapabilityCalls gets all the calls that were made to GetCudaComputeCapability. Check the length with:
len(mockedDevice.GetCudaComputeCapabilityCalls())
func (*DeviceMock) GetDeviceHandleFromMigDeviceHandle ¶
func (mock *DeviceMock) GetDeviceHandleFromMigDeviceHandle() (Device, Return)
GetDeviceHandleFromMigDeviceHandle calls GetDeviceHandleFromMigDeviceHandleFunc.
func (*DeviceMock) GetDeviceHandleFromMigDeviceHandleCalls ¶
func (mock *DeviceMock) GetDeviceHandleFromMigDeviceHandleCalls() []struct { }
GetDeviceHandleFromMigDeviceHandleCalls gets all the calls that were made to GetDeviceHandleFromMigDeviceHandle. Check the length with:
len(mockedDevice.GetDeviceHandleFromMigDeviceHandleCalls())
func (*DeviceMock) GetGpuInstanceById ¶
func (mock *DeviceMock) GetGpuInstanceById(ID int) (GpuInstance, Return)
GetGpuInstanceById calls GetGpuInstanceByIdFunc.
func (*DeviceMock) GetGpuInstanceByIdCalls ¶
func (mock *DeviceMock) GetGpuInstanceByIdCalls() []struct { ID int }
GetGpuInstanceByIdCalls gets all the calls that were made to GetGpuInstanceById. Check the length with:
len(mockedDevice.GetGpuInstanceByIdCalls())
func (*DeviceMock) GetGpuInstanceId ¶
func (mock *DeviceMock) GetGpuInstanceId() (int, Return)
GetGpuInstanceId calls GetGpuInstanceIdFunc.
func (*DeviceMock) GetGpuInstanceIdCalls ¶
func (mock *DeviceMock) GetGpuInstanceIdCalls() []struct { }
GetGpuInstanceIdCalls gets all the calls that were made to GetGpuInstanceId. Check the length with:
len(mockedDevice.GetGpuInstanceIdCalls())
func (*DeviceMock) GetGpuInstancePossiblePlacements ¶
func (mock *DeviceMock) GetGpuInstancePossiblePlacements(gpuInstanceProfileInfo *GpuInstanceProfileInfo) ([]GpuInstancePlacement, Return)
GetGpuInstancePossiblePlacements calls GetGpuInstancePossiblePlacementsFunc.
func (*DeviceMock) GetGpuInstancePossiblePlacementsCalls ¶
func (mock *DeviceMock) GetGpuInstancePossiblePlacementsCalls() []struct { GpuInstanceProfileInfo *GpuInstanceProfileInfo }
GetGpuInstancePossiblePlacementsCalls gets all the calls that were made to GetGpuInstancePossiblePlacements. Check the length with:
len(mockedDevice.GetGpuInstancePossiblePlacementsCalls())
func (*DeviceMock) GetGpuInstanceProfileInfo ¶
func (mock *DeviceMock) GetGpuInstanceProfileInfo(Profile int) (GpuInstanceProfileInfo, Return)
GetGpuInstanceProfileInfo calls GetGpuInstanceProfileInfoFunc.
func (*DeviceMock) GetGpuInstanceProfileInfoCalls ¶
func (mock *DeviceMock) GetGpuInstanceProfileInfoCalls() []struct { Profile int }
GetGpuInstanceProfileInfoCalls gets all the calls that were made to GetGpuInstanceProfileInfo. Check the length with:
len(mockedDevice.GetGpuInstanceProfileInfoCalls())
func (*DeviceMock) GetGpuInstances ¶
func (mock *DeviceMock) GetGpuInstances(Info *GpuInstanceProfileInfo) ([]GpuInstance, Return)
GetGpuInstances calls GetGpuInstancesFunc.
func (*DeviceMock) GetGpuInstancesCalls ¶
func (mock *DeviceMock) GetGpuInstancesCalls() []struct { Info *GpuInstanceProfileInfo }
GetGpuInstancesCalls gets all the calls that were made to GetGpuInstances. Check the length with:
len(mockedDevice.GetGpuInstancesCalls())
func (*DeviceMock) GetIndex ¶
func (mock *DeviceMock) GetIndex() (int, Return)
GetIndex calls GetIndexFunc.
func (*DeviceMock) GetIndexCalls ¶
func (mock *DeviceMock) GetIndexCalls() []struct { }
GetIndexCalls gets all the calls that were made to GetIndex. Check the length with:
len(mockedDevice.GetIndexCalls())
func (*DeviceMock) GetMaxMigDeviceCount ¶
func (mock *DeviceMock) GetMaxMigDeviceCount() (int, Return)
GetMaxMigDeviceCount calls GetMaxMigDeviceCountFunc.
func (*DeviceMock) GetMaxMigDeviceCountCalls ¶
func (mock *DeviceMock) GetMaxMigDeviceCountCalls() []struct { }
GetMaxMigDeviceCountCalls gets all the calls that were made to GetMaxMigDeviceCount. Check the length with:
len(mockedDevice.GetMaxMigDeviceCountCalls())
func (*DeviceMock) GetMemoryInfo ¶
func (mock *DeviceMock) GetMemoryInfo() (Memory, Return)
GetMemoryInfo calls GetMemoryInfoFunc.
func (*DeviceMock) GetMemoryInfoCalls ¶
func (mock *DeviceMock) GetMemoryInfoCalls() []struct { }
GetMemoryInfoCalls gets all the calls that were made to GetMemoryInfo. Check the length with:
len(mockedDevice.GetMemoryInfoCalls())
func (*DeviceMock) GetMigDeviceHandleByIndex ¶
func (mock *DeviceMock) GetMigDeviceHandleByIndex(Index int) (Device, Return)
GetMigDeviceHandleByIndex calls GetMigDeviceHandleByIndexFunc.
func (*DeviceMock) GetMigDeviceHandleByIndexCalls ¶
func (mock *DeviceMock) GetMigDeviceHandleByIndexCalls() []struct { Index int }
GetMigDeviceHandleByIndexCalls gets all the calls that were made to GetMigDeviceHandleByIndex. Check the length with:
len(mockedDevice.GetMigDeviceHandleByIndexCalls())
func (*DeviceMock) GetMigMode ¶
func (mock *DeviceMock) GetMigMode() (int, int, Return)
GetMigMode calls GetMigModeFunc.
func (*DeviceMock) GetMigModeCalls ¶
func (mock *DeviceMock) GetMigModeCalls() []struct { }
GetMigModeCalls gets all the calls that were made to GetMigMode. Check the length with:
len(mockedDevice.GetMigModeCalls())
func (*DeviceMock) GetMinorNumber ¶
func (mock *DeviceMock) GetMinorNumber() (int, Return)
GetMinorNumber calls GetMinorNumberFunc.
func (*DeviceMock) GetMinorNumberCalls ¶
func (mock *DeviceMock) GetMinorNumberCalls() []struct { }
GetMinorNumberCalls gets all the calls that were made to GetMinorNumber. Check the length with:
len(mockedDevice.GetMinorNumberCalls())
func (*DeviceMock) GetName ¶
func (mock *DeviceMock) GetName() (string, Return)
GetName calls GetNameFunc.
func (*DeviceMock) GetNameCalls ¶
func (mock *DeviceMock) GetNameCalls() []struct { }
GetNameCalls gets all the calls that were made to GetName. Check the length with:
len(mockedDevice.GetNameCalls())
func (*DeviceMock) GetNvLinkRemotePciInfo ¶
func (mock *DeviceMock) GetNvLinkRemotePciInfo(n int) (PciInfo, Return)
GetNvLinkRemotePciInfo calls GetNvLinkRemotePciInfoFunc.
func (*DeviceMock) GetNvLinkRemotePciInfoCalls ¶
func (mock *DeviceMock) GetNvLinkRemotePciInfoCalls() []struct { N int }
GetNvLinkRemotePciInfoCalls gets all the calls that were made to GetNvLinkRemotePciInfo. Check the length with:
len(mockedDevice.GetNvLinkRemotePciInfoCalls())
func (*DeviceMock) GetNvLinkState ¶
func (mock *DeviceMock) GetNvLinkState(n int) (EnableState, Return)
GetNvLinkState calls GetNvLinkStateFunc.
func (*DeviceMock) GetNvLinkStateCalls ¶
func (mock *DeviceMock) GetNvLinkStateCalls() []struct { N int }
GetNvLinkStateCalls gets all the calls that were made to GetNvLinkState. Check the length with:
len(mockedDevice.GetNvLinkStateCalls())
func (*DeviceMock) GetPciInfo ¶
func (mock *DeviceMock) GetPciInfo() (PciInfo, Return)
GetPciInfo calls GetPciInfoFunc.
func (*DeviceMock) GetPciInfoCalls ¶
func (mock *DeviceMock) GetPciInfoCalls() []struct { }
GetPciInfoCalls gets all the calls that were made to GetPciInfo. Check the length with:
len(mockedDevice.GetPciInfoCalls())
func (*DeviceMock) GetSupportedEventTypes ¶
func (mock *DeviceMock) GetSupportedEventTypes() (uint64, Return)
GetSupportedEventTypes calls GetSupportedEventTypesFunc.
func (*DeviceMock) GetSupportedEventTypesCalls ¶
func (mock *DeviceMock) GetSupportedEventTypesCalls() []struct { }
GetSupportedEventTypesCalls gets all the calls that were made to GetSupportedEventTypes. Check the length with:
len(mockedDevice.GetSupportedEventTypesCalls())
func (*DeviceMock) GetTopologyCommonAncestor ¶
func (mock *DeviceMock) GetTopologyCommonAncestor(device Device) (GpuTopologyLevel, Return)
GetTopologyCommonAncestor calls GetTopologyCommonAncestorFunc.
func (*DeviceMock) GetTopologyCommonAncestorCalls ¶
func (mock *DeviceMock) GetTopologyCommonAncestorCalls() []struct { Device Device }
GetTopologyCommonAncestorCalls gets all the calls that were made to GetTopologyCommonAncestor. Check the length with:
len(mockedDevice.GetTopologyCommonAncestorCalls())
func (*DeviceMock) GetUUID ¶
func (mock *DeviceMock) GetUUID() (string, Return)
GetUUID calls GetUUIDFunc.
func (*DeviceMock) GetUUIDCalls ¶
func (mock *DeviceMock) GetUUIDCalls() []struct { }
GetUUIDCalls gets all the calls that were made to GetUUID. Check the length with:
len(mockedDevice.GetUUIDCalls())
func (*DeviceMock) IsMigDeviceHandle ¶
func (mock *DeviceMock) IsMigDeviceHandle() (bool, Return)
IsMigDeviceHandle calls IsMigDeviceHandleFunc.
func (*DeviceMock) IsMigDeviceHandleCalls ¶
func (mock *DeviceMock) IsMigDeviceHandleCalls() []struct { }
IsMigDeviceHandleCalls gets all the calls that were made to IsMigDeviceHandle. Check the length with:
len(mockedDevice.IsMigDeviceHandleCalls())
func (*DeviceMock) RegisterEvents ¶
func (mock *DeviceMock) RegisterEvents(v uint64, eventSet EventSet) Return
RegisterEvents calls RegisterEventsFunc.
func (*DeviceMock) RegisterEventsCalls ¶
func (mock *DeviceMock) RegisterEventsCalls() []struct { V uint64 EventSet EventSet }
RegisterEventsCalls gets all the calls that were made to RegisterEvents. Check the length with:
len(mockedDevice.RegisterEventsCalls())
func (*DeviceMock) SetComputeMode ¶
func (mock *DeviceMock) SetComputeMode(computeMode ComputeMode) Return
SetComputeMode calls SetComputeModeFunc.
func (*DeviceMock) SetComputeModeCalls ¶
func (mock *DeviceMock) SetComputeModeCalls() []struct { ComputeMode ComputeMode }
SetComputeModeCalls gets all the calls that were made to SetComputeMode. Check the length with:
len(mockedDevice.SetComputeModeCalls())
func (*DeviceMock) SetMigMode ¶
func (mock *DeviceMock) SetMigMode(Mode int) (Return, Return)
SetMigMode calls SetMigModeFunc.
func (*DeviceMock) SetMigModeCalls ¶
func (mock *DeviceMock) SetMigModeCalls() []struct { Mode int }
SetMigModeCalls gets all the calls that were made to SetMigMode. Check the length with:
len(mockedDevice.SetMigModeCalls())
type EnableState ¶
type EnableState nvml.EnableState
EnableState represents a generic enable/disable enum
type EventData ¶
type EventData struct { Device Device EventType uint64 EventData uint64 GpuInstanceId uint32 ComputeInstanceId uint32 }
EventData defines NVML event Data
type GpuInstance ¶
type GpuInstance interface { CreateComputeInstance(Info *ComputeInstanceProfileInfo) (ComputeInstance, Return) Destroy() Return GetComputeInstanceById(ID int) (ComputeInstance, Return) GetComputeInstanceProfileInfo(Profile int, EngProfile int) (ComputeInstanceProfileInfo, Return) GetComputeInstances(Info *ComputeInstanceProfileInfo) ([]ComputeInstance, Return) GetInfo() (GpuInstanceInfo, Return) }
GpuInstance defines the functions implemented by a GpuInstance
type GpuInstanceInfo ¶
type GpuInstanceInfo struct { Device Device Id uint32 ProfileId uint32 Placement GpuInstancePlacement }
GpuInstanceInfo holds info about a GPU Instance
type GpuInstanceMock ¶
type GpuInstanceMock struct { // CreateComputeInstanceFunc mocks the CreateComputeInstance method. CreateComputeInstanceFunc func(Info *ComputeInstanceProfileInfo) (ComputeInstance, Return) // DestroyFunc mocks the Destroy method. DestroyFunc func() Return // GetComputeInstanceByIdFunc mocks the GetComputeInstanceById method. GetComputeInstanceByIdFunc func(ID int) (ComputeInstance, Return) // GetComputeInstanceProfileInfoFunc mocks the GetComputeInstanceProfileInfo method. GetComputeInstanceProfileInfoFunc func(Profile int, EngProfile int) (ComputeInstanceProfileInfo, Return) // GetComputeInstancesFunc mocks the GetComputeInstances method. GetComputeInstancesFunc func(Info *ComputeInstanceProfileInfo) ([]ComputeInstance, Return) // GetInfoFunc mocks the GetInfo method. GetInfoFunc func() (GpuInstanceInfo, Return) // contains filtered or unexported fields }
GpuInstanceMock is a mock implementation of GpuInstance.
func TestSomethingThatUsesGpuInstance(t *testing.T) { // make and configure a mocked GpuInstance mockedGpuInstance := &GpuInstanceMock{ CreateComputeInstanceFunc: func(Info *ComputeInstanceProfileInfo) (ComputeInstance, Return) { panic("mock out the CreateComputeInstance method") }, DestroyFunc: func() Return { panic("mock out the Destroy method") }, GetComputeInstanceByIdFunc: func(ID int) (ComputeInstance, Return) { panic("mock out the GetComputeInstanceById method") }, GetComputeInstanceProfileInfoFunc: func(Profile int, EngProfile int) (ComputeInstanceProfileInfo, Return) { panic("mock out the GetComputeInstanceProfileInfo method") }, GetComputeInstancesFunc: func(Info *ComputeInstanceProfileInfo) ([]ComputeInstance, Return) { panic("mock out the GetComputeInstances method") }, GetInfoFunc: func() (GpuInstanceInfo, Return) { panic("mock out the GetInfo method") }, } // use mockedGpuInstance in code that requires GpuInstance // and then make assertions. }
func (*GpuInstanceMock) CreateComputeInstance ¶
func (mock *GpuInstanceMock) CreateComputeInstance(Info *ComputeInstanceProfileInfo) (ComputeInstance, Return)
CreateComputeInstance calls CreateComputeInstanceFunc.
func (*GpuInstanceMock) CreateComputeInstanceCalls ¶
func (mock *GpuInstanceMock) CreateComputeInstanceCalls() []struct { Info *ComputeInstanceProfileInfo }
CreateComputeInstanceCalls gets all the calls that were made to CreateComputeInstance. Check the length with:
len(mockedGpuInstance.CreateComputeInstanceCalls())
func (*GpuInstanceMock) Destroy ¶
func (mock *GpuInstanceMock) Destroy() Return
Destroy calls DestroyFunc.
func (*GpuInstanceMock) DestroyCalls ¶
func (mock *GpuInstanceMock) DestroyCalls() []struct { }
DestroyCalls gets all the calls that were made to Destroy. Check the length with:
len(mockedGpuInstance.DestroyCalls())
func (*GpuInstanceMock) GetComputeInstanceById ¶
func (mock *GpuInstanceMock) GetComputeInstanceById(ID int) (ComputeInstance, Return)
GetComputeInstanceById calls GetComputeInstanceByIdFunc.
func (*GpuInstanceMock) GetComputeInstanceByIdCalls ¶
func (mock *GpuInstanceMock) GetComputeInstanceByIdCalls() []struct { ID int }
GetComputeInstanceByIdCalls gets all the calls that were made to GetComputeInstanceById. Check the length with:
len(mockedGpuInstance.GetComputeInstanceByIdCalls())
func (*GpuInstanceMock) GetComputeInstanceProfileInfo ¶
func (mock *GpuInstanceMock) GetComputeInstanceProfileInfo(Profile int, EngProfile int) (ComputeInstanceProfileInfo, Return)
GetComputeInstanceProfileInfo calls GetComputeInstanceProfileInfoFunc.
func (*GpuInstanceMock) GetComputeInstanceProfileInfoCalls ¶
func (mock *GpuInstanceMock) GetComputeInstanceProfileInfoCalls() []struct { Profile int EngProfile int }
GetComputeInstanceProfileInfoCalls gets all the calls that were made to GetComputeInstanceProfileInfo. Check the length with:
len(mockedGpuInstance.GetComputeInstanceProfileInfoCalls())
func (*GpuInstanceMock) GetComputeInstances ¶
func (mock *GpuInstanceMock) GetComputeInstances(Info *ComputeInstanceProfileInfo) ([]ComputeInstance, Return)
GetComputeInstances calls GetComputeInstancesFunc.
func (*GpuInstanceMock) GetComputeInstancesCalls ¶
func (mock *GpuInstanceMock) GetComputeInstancesCalls() []struct { Info *ComputeInstanceProfileInfo }
GetComputeInstancesCalls gets all the calls that were made to GetComputeInstances. Check the length with:
len(mockedGpuInstance.GetComputeInstancesCalls())
func (*GpuInstanceMock) GetInfo ¶
func (mock *GpuInstanceMock) GetInfo() (GpuInstanceInfo, Return)
GetInfo calls GetInfoFunc.
func (*GpuInstanceMock) GetInfoCalls ¶
func (mock *GpuInstanceMock) GetInfoCalls() []struct { }
GetInfoCalls gets all the calls that were made to GetInfo. Check the length with:
len(mockedGpuInstance.GetInfoCalls())
type GpuInstancePlacement ¶
type GpuInstancePlacement nvml.GpuInstancePlacement
GpuInstancePlacement holds placement info about a GPU Instance
type GpuInstanceProfileInfo ¶
type GpuInstanceProfileInfo nvml.GpuInstanceProfileInfo
GpuInstanceProfileInfo holds info about a GPU Instance Profile
type GpuTopologyLevel ¶
type GpuTopologyLevel nvml.GpuTopologyLevel
GpuTopologyLevel represents level relationships within a system between two GPUs
type Interface ¶
type Interface interface { DeviceGetCount() (int, Return) DeviceGetHandleByIndex(Index int) (Device, Return) DeviceGetHandleByUUID(UUID string) (Device, Return) ErrorString(r Return) string EventSetCreate() (EventSet, Return) Init() Return Lookup(string) error Shutdown() Return SystemGetCudaDriverVersion() (int, Return) SystemGetDriverVersion() (string, Return) }
Interface defines the functions implemented by an NVML library
type InterfaceMock ¶
type InterfaceMock struct { // DeviceGetCountFunc mocks the DeviceGetCount method. DeviceGetCountFunc func() (int, Return) // DeviceGetHandleByIndexFunc mocks the DeviceGetHandleByIndex method. DeviceGetHandleByIndexFunc func(Index int) (Device, Return) // DeviceGetHandleByUUIDFunc mocks the DeviceGetHandleByUUID method. DeviceGetHandleByUUIDFunc func(UUID string) (Device, Return) // ErrorStringFunc mocks the ErrorString method. ErrorStringFunc func(r Return) string // EventSetCreateFunc mocks the EventSetCreate method. EventSetCreateFunc func() (EventSet, Return) // InitFunc mocks the Init method. InitFunc func() Return // LookupFunc mocks the Lookup method. LookupFunc func(s string) error // ShutdownFunc mocks the Shutdown method. ShutdownFunc func() Return // SystemGetCudaDriverVersionFunc mocks the SystemGetCudaDriverVersion method. SystemGetCudaDriverVersionFunc func() (int, Return) // SystemGetDriverVersionFunc mocks the SystemGetDriverVersion method. SystemGetDriverVersionFunc func() (string, Return) // contains filtered or unexported fields }
InterfaceMock is a mock implementation of Interface.
func TestSomethingThatUsesInterface(t *testing.T) { // make and configure a mocked Interface mockedInterface := &InterfaceMock{ DeviceGetCountFunc: func() (int, Return) { panic("mock out the DeviceGetCount method") }, DeviceGetHandleByIndexFunc: func(Index int) (Device, Return) { panic("mock out the DeviceGetHandleByIndex method") }, DeviceGetHandleByUUIDFunc: func(UUID string) (Device, Return) { panic("mock out the DeviceGetHandleByUUID method") }, ErrorStringFunc: func(r Return) string { panic("mock out the ErrorString method") }, EventSetCreateFunc: func() (EventSet, Return) { panic("mock out the EventSetCreate method") }, InitFunc: func() Return { panic("mock out the Init method") }, LookupFunc: func(s string) error { panic("mock out the Lookup method") }, ShutdownFunc: func() Return { panic("mock out the Shutdown method") }, SystemGetCudaDriverVersionFunc: func() (int, Return) { panic("mock out the SystemGetCudaDriverVersion method") }, SystemGetDriverVersionFunc: func() (string, Return) { panic("mock out the SystemGetDriverVersion method") }, } // use mockedInterface in code that requires Interface // and then make assertions. }
func (*InterfaceMock) DeviceGetCount ¶
func (mock *InterfaceMock) DeviceGetCount() (int, Return)
DeviceGetCount calls DeviceGetCountFunc.
func (*InterfaceMock) DeviceGetCountCalls ¶
func (mock *InterfaceMock) DeviceGetCountCalls() []struct { }
DeviceGetCountCalls gets all the calls that were made to DeviceGetCount. Check the length with:
len(mockedInterface.DeviceGetCountCalls())
func (*InterfaceMock) DeviceGetHandleByIndex ¶
func (mock *InterfaceMock) DeviceGetHandleByIndex(Index int) (Device, Return)
DeviceGetHandleByIndex calls DeviceGetHandleByIndexFunc.
func (*InterfaceMock) DeviceGetHandleByIndexCalls ¶
func (mock *InterfaceMock) DeviceGetHandleByIndexCalls() []struct { Index int }
DeviceGetHandleByIndexCalls gets all the calls that were made to DeviceGetHandleByIndex. Check the length with:
len(mockedInterface.DeviceGetHandleByIndexCalls())
func (*InterfaceMock) DeviceGetHandleByUUID ¶
func (mock *InterfaceMock) DeviceGetHandleByUUID(UUID string) (Device, Return)
DeviceGetHandleByUUID calls DeviceGetHandleByUUIDFunc.
func (*InterfaceMock) DeviceGetHandleByUUIDCalls ¶
func (mock *InterfaceMock) DeviceGetHandleByUUIDCalls() []struct { UUID string }
DeviceGetHandleByUUIDCalls gets all the calls that were made to DeviceGetHandleByUUID. Check the length with:
len(mockedInterface.DeviceGetHandleByUUIDCalls())
func (*InterfaceMock) ErrorString ¶
func (mock *InterfaceMock) ErrorString(r Return) string
ErrorString calls ErrorStringFunc.
func (*InterfaceMock) ErrorStringCalls ¶
func (mock *InterfaceMock) ErrorStringCalls() []struct { R Return }
ErrorStringCalls gets all the calls that were made to ErrorString. Check the length with:
len(mockedInterface.ErrorStringCalls())
func (*InterfaceMock) EventSetCreate ¶
func (mock *InterfaceMock) EventSetCreate() (EventSet, Return)
EventSetCreate calls EventSetCreateFunc.
func (*InterfaceMock) EventSetCreateCalls ¶
func (mock *InterfaceMock) EventSetCreateCalls() []struct { }
EventSetCreateCalls gets all the calls that were made to EventSetCreate. Check the length with:
len(mockedInterface.EventSetCreateCalls())
func (*InterfaceMock) InitCalls ¶
func (mock *InterfaceMock) InitCalls() []struct { }
InitCalls gets all the calls that were made to Init. Check the length with:
len(mockedInterface.InitCalls())
func (*InterfaceMock) Lookup ¶
func (mock *InterfaceMock) Lookup(s string) error
Lookup calls LookupFunc.
func (*InterfaceMock) LookupCalls ¶
func (mock *InterfaceMock) LookupCalls() []struct { S string }
LookupCalls gets all the calls that were made to Lookup. Check the length with:
len(mockedInterface.LookupCalls())
func (*InterfaceMock) Shutdown ¶
func (mock *InterfaceMock) Shutdown() Return
Shutdown calls ShutdownFunc.
func (*InterfaceMock) ShutdownCalls ¶
func (mock *InterfaceMock) ShutdownCalls() []struct { }
ShutdownCalls gets all the calls that were made to Shutdown. Check the length with:
len(mockedInterface.ShutdownCalls())
func (*InterfaceMock) SystemGetCudaDriverVersion ¶
func (mock *InterfaceMock) SystemGetCudaDriverVersion() (int, Return)
SystemGetCudaDriverVersion calls SystemGetCudaDriverVersionFunc.
func (*InterfaceMock) SystemGetCudaDriverVersionCalls ¶
func (mock *InterfaceMock) SystemGetCudaDriverVersionCalls() []struct { }
SystemGetCudaDriverVersionCalls gets all the calls that were made to SystemGetCudaDriverVersion. Check the length with:
len(mockedInterface.SystemGetCudaDriverVersionCalls())
func (*InterfaceMock) SystemGetDriverVersion ¶
func (mock *InterfaceMock) SystemGetDriverVersion() (string, Return)
SystemGetDriverVersion calls SystemGetDriverVersionFunc.
func (*InterfaceMock) SystemGetDriverVersionCalls ¶
func (mock *InterfaceMock) SystemGetDriverVersionCalls() []struct { }
SystemGetDriverVersionCalls gets all the calls that were made to SystemGetDriverVersion. Check the length with:
len(mockedInterface.SystemGetDriverVersionCalls())
type Option ¶
type Option func(*options)
Option represents a functional option to control behaviour.
func WithLibraryPath ¶
WithLibraryPath sets the NVML library name to use.