types

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: May 30, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AttributeMediaExtensions holds the string representation for the media extension MIG profile attribute.
	AttributeMediaExtensions = "me"
)

Variables

This section is empty.

Functions

This section is empty.

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) AssertValid

func (m MigConfig) AssertValid() error

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

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 {
	C              int
	G              int
	GB             int
	GIProfileID    int
	CIProfileID    int
	CIEngProfileID int
}

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, giProfileInfo *nvml.GpuInstanceProfileInfo, ciProfileInfo *nvml.ComputeInstanceProfileInfo) *MigProfile

NewMigProfile constructs a new MigProfile 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) Attributes added in v0.4.0

func (m MigProfile) Attributes() []string

Attributes returns the list of attributes associated with a MigProfile

func (MigProfile) Equals added in v0.4.0

func (m MigProfile) Equals(other *MigProfile) bool

Equals checks if two MigProfiles are identical or not

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.

func (MigProfile) String added in v0.4.0

func (m MigProfile) String() string

String returns the string representation of a MigProfile.

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