types

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AttributeMediaExtensions = nvdev.AttributeMediaExtensions
)

Variables

This section is empty.

Functions

func AssertValidMigProfileFormat added in v0.5.2

func AssertValidMigProfileFormat(profile string) error

AssertValidMigProfileFormat checks if the string is in the proper format to represent a MIG profile

func SetMockNVdevlib added in v0.5.2

func SetMockNVdevlib()

Types

type ComputeInstanceState added in v0.4.0

type ComputeInstanceState struct {
	ProfileID    int
	EngProfileID int
}

ComputeInstanceState stores the MIG state for a specific ComputeInstance.

type DeviceID

type DeviceID uint32

DeviceID represents a GPU Device ID as read from a GPUs PCIe config space.

func NewDeviceID

func NewDeviceID(device, vendor uint16) DeviceID

NewDeviceID constructs a new 'DeviceID' from the device and vendor values pulled from a GPUs PCIe config space.

func NewDeviceIDFromString

func NewDeviceIDFromString(str string) (DeviceID, error)

NewDeviceIDFromString constructs a 'DeviceID' from its string representation.

func (DeviceID) GetDevice

func (d DeviceID) GetDevice() uint16

GetDevice returns the 'device' portion of a 'DeviceID'.

func (DeviceID) GetVendor

func (d DeviceID) GetVendor() uint16

GetVendor returns the 'vendor' portion of a 'DeviceID'.

func (DeviceID) String

func (d DeviceID) String() string

String returns a 'DeviceID' as a string.

type DeviceState added in v0.4.0

type DeviceState struct {
	UUID         string
	MigMode      mig.Mode
	GpuInstances []GpuInstanceState
}

DeviceState stores the MIG state for a specific GPU.

type GpuInstanceState added in v0.4.0

type GpuInstanceState struct {
	ProfileID        int
	Placement        nvml.GpuInstancePlacement
	ComputeInstances []ComputeInstanceState
}

GpuInstanceState stores the MIG state for a specific GPUInstance.

type MigConfig

type MigConfig map[string]int

MigConfig holds a map of strings representing a MigProfile to a count of that profile type. It is meant to represent the set of MIG profiles (and how many of a particular type) should be instantiated on a GPU.

func NewMigConfig added in v0.4.0

func NewMigConfig(mps []*MigProfile) MigConfig

NewMigConfig creates a new 'MigConfig' from a slice of 'MigProfile's.

func (MigConfig) AssertValidFormat added in v0.5.2

func (m MigConfig) AssertValidFormat() error

AssertValidFormat checks to ensure that all of the 'MigProfiles's making up a 'MigConfig' are of a valid format.

func (MigConfig) Contains

func (m MigConfig) Contains(profile string) bool

Contains checks if the provided 'profile' is part of the 'MigConfig'.

func (MigConfig) Equals

func (m MigConfig) Equals(config MigConfig) bool

Equals checks if two 'MigConfig's are equal. Equality is determined by comparing the profiles contained in each 'MigConfig'.

func (MigConfig) Flatten

func (m MigConfig) Flatten() []*MigProfile

Flatten converts a 'MigConfig' into a slice of 'MigProfile's. Duplicate 'MigProfile's will exist in this slice for each profile represented in the 'MigConfig'.

func (MigConfig) IsSubsetOf

func (m MigConfig) IsSubsetOf(config MigConfig) bool

IsSubsetOf checks if the provided 'MigConfig' is a subset of the originating 'MigConfig'.

type MigConfigGroup

type MigConfigGroup interface {
	GetDeviceTypes() []*MigProfile
	GetPossibleConfigurations() []MigConfig
	AssertValidConfiguration(MigConfig) error
}

MigConfigGroup provides an interface for intaracting with a logical group of 'MigConfig's. One such group is the set of all valid MigConfigs for the A100, for example.

type MigConfigGroupBase

type MigConfigGroupBase struct {
	Configs []MigConfig
}

MigConfigGroupBase is a base struct for constructing a full 'MigConfigGroup'. It holds the slice of 'MigConfig' structs associated with the group.

func (*MigConfigGroupBase) AssertValidConfiguration

func (m *MigConfigGroupBase) AssertValidConfiguration(config MigConfig) error

AssertValidConfiguration checks to ensure that the supplied 'MigConfig' is both valid and part of the 'MigConfigGroup'.

func (*MigConfigGroupBase) GetPossibleConfigurations

func (m *MigConfigGroupBase) GetPossibleConfigurations() []MigConfig

GetPossibleConfigurations gets all possible configurations associated with a 'MigConfigGroup'.

type MigConfigGroups

type MigConfigGroups map[DeviceID]MigConfigGroup

MigConfigGroups holds the mapping from a specific 'DeviceID' to a 'MigConfigGroup'.

type MigProfile

type MigProfile struct {
	nvdev.MigProfileInfo
}

MigProfile represents a specific MIG profile. Examples include "1g.5gb", "2g.10gb", "1c.2g.10gb", or "1c.1g.5gb+me", etc.

func MustParseMigProfile added in v0.4.0

func MustParseMigProfile(profile string) *MigProfile

MustParseMigProfile does the same as Parse(), but never throws an error.

func NewMigProfile

func NewMigProfile(giProfileID, ciProfileID, ciEngProfileID int, migMemorySizeMB, deviceMemorySizeBytes uint64) (*MigProfile, error)

NewMigProfile constructs a new Profile struct using info from the giProfiles and ciProfiles used to create it.

func ParseMigProfile added in v0.4.0

func ParseMigProfile(profile string) (*MigProfile, error)

ParseMigProfile converts a string representation of a MigProfile into an object.

func (MigProfile) HasAttribute added in v0.4.0

func (m MigProfile) HasAttribute(attr string) bool

HasAttribute checks if the MigProfile has the specified attribute associated with it.

type MigState added in v0.4.0

type MigState struct {
	Devices []DeviceState
}

MigState stores the MIG state for a set of GPUs.

Jump to

Keyboard shortcuts

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