Documentation ¶
Index ¶
- func AddDefaultResourcesToConfig(config *spec.Config) error
- type AnnotatedID
- type AnnotatedIDs
- type Device
- type DeviceMap
- type Devices
- func (ds Devices) AlignedAllocationSupported() bool
- func (ds Devices) Contains(ids ...string) bool
- func (ds Devices) Difference(ods Devices) Devices
- func (ds Devices) GetByID(id string) *Device
- func (ds Devices) GetByIndex(index string) *Device
- func (ds Devices) GetIDs() []string
- func (ds Devices) GetIndices() []string
- func (ds Devices) GetPaths() []string
- func (ds Devices) GetPluginDevices() []*pluginapi.Device
- func (ds Devices) GetUUIDs() []string
- func (ds Devices) Subset(ids []string) Devices
- type ResourceManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddDefaultResourcesToConfig ¶
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.
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 TotalMemory uint64 ComputeCapability string // Replicas stores the total number of times this device is replicated. // If this is 0 or 1 then the device is not shared. Replicas int }
Device wraps pluginapi.Device with extra metadata and functions.
func BuildDevice ¶ added in v0.13.0
BuildDevice builds an rm.Device with the specified index and deviceInfo
func (Device) AlignedAllocationSupported ¶ added in v0.15.0
AlignedAllocationSupported checks whether the device supports an aligned allocation
func (Device) GetUUID ¶ added in v0.13.0
GetUUID returns the UUID for the device from the annotated ID.
func (Device) IsMigDevice ¶
IsMigDevice returns checks whether d is a MIG device or not.
type DeviceMap ¶ added in v0.13.0
type DeviceMap map[spec.ResourceName]Devices
DeviceMap stores a set of devices per resource name.
type Devices ¶
Devices wraps a map[string]*Device with some functions.
func (Devices) AlignedAllocationSupported ¶ added in v0.15.0
AlignedAllocationSupported checks whether all devices support an aligned allocation
func (Devices) Difference ¶
Difference returns the set of devices contained in ds but not in ods.
func (Devices) GetByID ¶
GetByID returns a reference to the device matching the specified ID (nil otherwise).
func (Devices) GetByIndex ¶
GetByIndex returns a reference to the device matching the specified Index (nil otherwise).
func (Devices) GetIndices ¶
GetIndices returns the Indices from all devices in the Devices
func (Devices) GetPluginDevices ¶
GetPluginDevices returns the plugin Devices from all devices in the Devices
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 ValidateRequest(AnnotatedIDs) error }
ResourceManager provides an interface for listing a set of Devices and checking health on them
func NewNVMLResourceManagers ¶ added in v0.13.0
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 ¶
NewResourceManagers returns a []ResourceManager, one for each resource in 'config'.
func NewTegraResourceManagers ¶ added in v0.13.0
func NewTegraResourceManagers(config *spec.Config) ([]ResourceManager, error)
NewTegraResourceManagers returns a set of ResourceManagers for tegra resources