rm

package
v0.0.0-...-1c0ec14 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddDefaultResourcesToConfig

func AddDefaultResourcesToConfig(config *spec.Config) error

AddDefaultResourcesToConfig adds default resource matching rules to config.Resources

Types

type AnnotatedID

type AnnotatedID string

AnnotatedID represents an ID with a replica number embedded in it.

func NewAnnotatedID

func NewAnnotatedID(id string, replica int) AnnotatedID

NewAnnotatedID creates a new AnnotatedID from an ID and a replica number.

func (AnnotatedID) GetID

func (r AnnotatedID) GetID() string

GetID returns just the ID part of the replicated ID

func (AnnotatedID) HasAnnotations

func (r AnnotatedID) HasAnnotations() bool

HasAnnotations checks if an AnnotatedID has any annotations or not.

func (AnnotatedID) Split

func (r AnnotatedID) Split() (string, int)

Split splits a AnnotatedID into its ID and replica number parts.

func (AnnotatedID) String

func (r AnnotatedID) String() string

type AnnotatedIDs

type AnnotatedIDs []string

AnnotatedIDs can be used to treat a []string as a []AnnotatedID.

func (AnnotatedIDs) AnyHasAnnotations

func (rs AnnotatedIDs) AnyHasAnnotations() bool

AnyHasAnnotations checks if any ID has annotations or not.

func (AnnotatedIDs) GetIDs

func (rs AnnotatedIDs) GetIDs() []string

GetIDs returns just the ID parts of the annotated IDs as a []string

type Device

type Device struct {
	pluginapi.Device
	Paths []string
	Index string
}

Device wraps pluginapi.Device with extra metadata and functions.

func BuildDevice

func BuildDevice(index string, d deviceInfo) (*Device, error)

BuildDevice builds an rm.Device with the specified index and deviceInfo

func (Device) GetUUID

func (d Device) GetUUID() string

GetUUID returns the UUID for the device from the annotated ID.

func (Device) IsMigDevice

func (d Device) IsMigDevice() bool

IsMigDevice returns checks whether d is a MIG device or not.

type DeviceMap

type DeviceMap map[spec.ResourceName]Devices

DeviceMap stores a set of devices per resource name.

func NewDeviceMap

func NewDeviceMap(nvmllib nvml.Interface, config *spec.Config) (DeviceMap, error)

NewDeviceMap creates a device map for the specified NVML library and config.

type Devices

type Devices map[string]*Device

Devices wraps a map[string]*Device with some functions.

func (Devices) Contains

func (ds Devices) Contains(ids ...string) bool

Contains checks if Devices contains devices matching all ids.

func (Devices) ContainsMigDevices

func (ds Devices) ContainsMigDevices() bool

ContainsMigDevices checks if Devices contains any MIG devices or not

func (Devices) Difference

func (ds Devices) Difference(ods Devices) Devices

Difference returns the set of devices contained in ds but not in ods.

func (Devices) GetByID

func (ds Devices) GetByID(id string) *Device

GetByID returns a reference to the device matching the specified ID (nil otherwise).

func (Devices) GetByIndex

func (ds Devices) GetByIndex(index string) *Device

GetByIndex returns a reference to the device matching the specified Index (nil otherwise).

func (Devices) GetIDs

func (ds Devices) GetIDs() []string

GetIDs returns the ids from all devices in the Devices

func (Devices) GetIndices

func (ds Devices) GetIndices() []string

GetIndices returns the Indices from all devices in the Devices

func (Devices) GetPaths

func (ds Devices) GetPaths() []string

GetPaths returns the Paths from all devices in the Devices

func (Devices) GetPluginDevices

func (ds Devices) GetPluginDevices() []*pluginapi.Device

GetPluginDevices returns the plugin Devices from all devices in the Devices

func (Devices) Subset

func (ds Devices) Subset(ids []string) Devices

Subset returns the subset of devices in Devices matching the provided ids. If any id in ids is not in Devices, then the subset that did match will be returned.

type MPSAnnotatedID

type MPSAnnotatedID string

func NewMPSAnnotatedID

func NewMPSAnnotatedID(id string, partition int, replica int, rtype string) MPSAnnotatedID

NewMPSAnnotatedID creates a new AnnotatedID from an ID, a replica number the memory of an MPS resource.

func (MPSAnnotatedID) GetID

func (r MPSAnnotatedID) GetID() string

GetID returns just the ID part of the replicated ID

func (MPSAnnotatedID) GetPartition

func (r MPSAnnotatedID) GetPartition() int

GetMemoryGB returns just the memoryGB part of the MPS ID

func (MPSAnnotatedID) GetRType

func (r MPSAnnotatedID) GetRType() string

GetRType returns the resource type

func (MPSAnnotatedID) GetReplicas

func (r MPSAnnotatedID) GetReplicas() int

GetReplicas returns the total replicas of a resource

func (MPSAnnotatedID) Split

func (r MPSAnnotatedID) Split() (string, int, int, string)

Split splits a MPSAnnotatedID into its ID, its memory GB, and replica number parts. Anshul - Modified configuration for the MPS devices

func (MPSAnnotatedID) String

func (r MPSAnnotatedID) String() string

type ResourceManager

type ResourceManager interface {
	Resource() spec.ResourceName
	Devices() Devices
	GetDevicePaths([]string) []string
	GetPreferredAllocation(available, required []string, size int) ([]string, error)
	CheckHealth(stop <-chan interface{}, unhealthy chan<- *Device) error
}

ResourceManager provides an interface for listing a set of Devices and checking health on them

func NewNVMLResourceManagers

func NewNVMLResourceManagers(nvmllib nvml.Interface, config *spec.Config) ([]ResourceManager, error)

NewNVMLResourceManagers returns a set of ResourceManagers, one for each NVML resource in 'config'.

func NewResourceManagers

func NewResourceManagers(nvmllib nvml.Interface, config *spec.Config) ([]ResourceManager, error)

NewResourceManagers returns a []ResourceManager, one for each resource in 'config'.

func NewTegraResourceManagers

func NewTegraResourceManagers(config *spec.Config) ([]ResourceManager, error)

NewTegraResourceManagers returns a set of ResourceManagers for tegra resources

Jump to

Keyboard shortcuts

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