Documentation ¶
Index ¶
- Constants
- type CommandLineFlags
- type Config
- type Duration
- type Flags
- type GFDCommandLineFlags
- type MPS
- type MPSResource
- type PluginCommandLineFlags
- type ReplicatedDeviceRef
- type ReplicatedDevices
- type ReplicatedResource
- type Resource
- type ResourceName
- type ResourcePattern
- type Resources
- type Sharing
- type TimeSlicing
Constants ¶
const ( ResourceNamePrefix = "nvidia.com" MaxResourceNameLength = 63 )
Constants related to resource names
const ( MigStrategyNone = "none" MigStrategySingle = "single" MigStrategyMixed = "mixed" )
Constants representing the various MIG strategies
const ( DeviceListStrategyEnvvar = "envvar" DeviceListStrategyVolumeMounts = "volume-mounts" )
Constants to represent the various device list strategies
const ( DeviceIDStrategyUUID = "uuid" DeviceIDStrategyIndex = "index" )
Constants to represent the various device id strategies
const Version = "v1"
Version indicates the version of the 'Config' struct used to hold configuration information.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommandLineFlags ¶
type CommandLineFlags struct { MigStrategy *string `json:"migStrategy" yaml:"migStrategy"` FailOnInitError *bool `json:"failOnInitError" yaml:"failOnInitError"` NvidiaDriverRoot *string `json:"nvidiaDriverRoot,omitempty" yaml:"nvidiaDriverRoot,omitempty"` GDSEnabled *bool `json:"gdsEnabled" yaml:"gdsEnabled"` MOFEDEnabled *bool `json:"mofedEnabled" yaml:"mofedEnabled"` Plugin *PluginCommandLineFlags `json:"plugin,omitempty" yaml:"plugin,omitempty"` GFD *GFDCommandLineFlags `json:"gfd,omitempty" yaml:"gfd,omitempty"` }
CommandLineFlags holds the list of command line flags used to configure the device plugin and GFD.
type Config ¶
type Config struct { Version string `json:"version" yaml:"version"` Flags Flags `json:"flags,omitempty" yaml:"flags,omitempty"` Resources Resources `json:"resources,omitempty" yaml:"resources,omitempty"` Sharing Sharing `json:"sharing,omitempty" yaml:"sharing,omitempty"` }
Config is a versioned struct used to hold configuration information.
type Duration ¶
Duration wraps a time.Duration function with custom JSON marshaling/unmarshaling
func (Duration) MarshalJSON ¶
MarshalJSON marshals 'Duration' to its raw bytes representation
func (*Duration) UnmarshalJSON ¶
UnmarshalJSON unmarshals raw bytes into a 'Duration' type.
type Flags ¶
type Flags struct {
CommandLineFlags
}
Flags holds the full list of flags used to configure the device plugin and GFD.
type GFDCommandLineFlags ¶
type GFDCommandLineFlags struct { Oneshot *bool `json:"oneshot" yaml:"oneshot"` NoTimestamp *bool `json:"noTimestamp" yaml:"noTimestamp"` SleepInterval *Duration `json:"sleepInterval" yaml:"sleepInterval"` OutputFile *string `json:"outputFile" yaml:"outputFile"` MachineTypeFile *string `json:"machineTypeFile" yaml:"machineTypeFile"` }
GFDCommandLineFlags holds the list of command line flags specific to GFD.
type MPS ¶
type MPS struct { FailRequestsGreaterThanOne bool `json:"failRequestsGreaterThanOne,omitempty" yaml:"failRequestsGreaterThanOne,omitempty"` Resources []MPSResource `json:"resources,omitempty" yaml:"resources,omitempty"` }
MPS defines the set of GPU replicas (e.g. slices) backed by MPS
func (*MPS) UnmarshalJSON ¶
UnmarshalJSON unmarshals raw bytes into a 'MPS' struct.
type MPSResource ¶
type MPSResource struct { Name ResourceName `json:"name" yaml:"name"` Rename ResourceName `json:"rename,omitempty" yaml:"rename,omitempty"` Partition int `json:"partition" yaml:"partition"` Rtype string `json:"rtype" yaml:"rtype"` Replicas int `json:"replicas" yaml:"replicas"` Devices []ReplicatedDeviceRef `json:"devices" yaml:"devices,flow"` }
MPSResource represents a resource to be replicated (e.g. sliced) through MPS Anshul - Modified resource structure to store the type of resource
func (*MPSResource) UnmarshalJSON ¶
func (s *MPSResource) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals raw bytes into a 'MPSResource' struct. Anshul - Modified reading of json configuration
type PluginCommandLineFlags ¶
type PluginCommandLineFlags struct { PassDeviceSpecs *bool `json:"passDeviceSpecs" yaml:"passDeviceSpecs"` DeviceListStrategy *string `json:"deviceListStrategy" yaml:"deviceListStrategy"` DeviceIDStrategy *string `json:"deviceIDStrategy" yaml:"deviceIDStrategy"` }
PluginCommandLineFlags holds the list of command line flags specific to the device plugin.
type ReplicatedDeviceRef ¶
type ReplicatedDeviceRef string
ReplicatedDeviceRef can either be a full GPU index, a MIG index, or a UUID (full GPU or MIG)
func (ReplicatedDeviceRef) IsGPUIndex ¶
func (d ReplicatedDeviceRef) IsGPUIndex() bool
IsGPUIndex checks if a ReplicatedDeviceRef is a full GPU index
func (ReplicatedDeviceRef) IsGpuUUID ¶
func (d ReplicatedDeviceRef) IsGpuUUID() bool
IsGpuUUID checks if a ReplicatedDeviceRef is a GPU UUID A GPU UUID must be of the form GPU-b1028956-cfa2-0990-bf4a-5da9abb51763
func (ReplicatedDeviceRef) IsMigIndex ¶
func (d ReplicatedDeviceRef) IsMigIndex() bool
IsMigIndex checks if a ReplicatedDeviceRef is a MIG index
func (ReplicatedDeviceRef) IsMigUUID ¶
func (d ReplicatedDeviceRef) IsMigUUID() bool
IsMigUUID checks if a ReplicatedDeviceRef is a MIG UUID A MIG UUID can be of one of two forms:
- MIG-b1028956-cfa2-0990-bf4a-5da9abb51763
- MIG-GPU-b1028956-cfa2-0990-bf4a-5da9abb51763/3/0
func (ReplicatedDeviceRef) IsUUID ¶
func (d ReplicatedDeviceRef) IsUUID() bool
IsUUID checks if a ReplicatedDeviceRef is a UUID
func (ReplicatedDeviceRef) String ¶
func (d ReplicatedDeviceRef) String() string
type ReplicatedDevices ¶
type ReplicatedDevices struct { All bool Count int List []ReplicatedDeviceRef }
ReplicatedDevices encapsulates the set of devices that should be replicated for a given resource. This struct should be treated as a 'union' and only one of the fields in this struct should be set at any given time.
func (*ReplicatedDevices) MarshalJSON ¶
func (s *ReplicatedDevices) MarshalJSON() ([]byte, error)
MarshalJSON marshals ReplicatedDevices to its raw bytes representation
func (*ReplicatedDevices) UnmarshalJSON ¶
func (s *ReplicatedDevices) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals raw bytes into a 'ReplicatedDevices' struct.
type ReplicatedResource ¶
type ReplicatedResource struct { Name ResourceName `json:"name" yaml:"name"` Rename ResourceName `json:"rename,omitempty" yaml:"rename,omitempty"` Devices ReplicatedDevices `json:"devices" yaml:"devices,flow"` Replicas int `json:"replicas" yaml:"replicas"` }
ReplicatedResource represents a resource to be replicated.
func (*ReplicatedResource) UnmarshalJSON ¶
func (s *ReplicatedResource) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals raw bytes into a 'ReplicatedResource' struct.
type Resource ¶
type Resource struct { Pattern ResourcePattern `json:"pattern" yaml:"pattern"` Name ResourceName `json:"name" yaml:"name"` }
Resource pairs a pattern matcher with a resource name.
func NewResource ¶
NewResource builds a resource from a name and pattern
func (*Resource) UnmarshalJSON ¶
UnmarshalJSON unmarshals raw bytes into a 'Resource' struct.
type ResourceName ¶
type ResourceName string
ResourceName represents a valid resource name in Kubernetes
func NewResourceName ¶
func NewResourceName(n string) (ResourceName, error)
NewResourceName builds a resource name from the standard prefix and a name. An error is returned if the format is incorrect.
func (ResourceName) DefaultSharedRename ¶
func (r ResourceName) DefaultSharedRename() ResourceName
DefaultSharedRename returns the default renaming to apply when this resource is shared
func (ResourceName) Split ¶
func (r ResourceName) Split() (string, string)
Split splits a full resource name into prefix and name
func (*ResourceName) UnmarshalJSON ¶
func (r *ResourceName) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals raw bytes into a 'ResourceName' type.
type ResourcePattern ¶
type ResourcePattern string
ResourcePattern is used to match a resource name to a specific pattern
func (ResourcePattern) Matches ¶
func (p ResourcePattern) Matches(s string) bool
Matches checks if the provided string matches the ResourcePattern or not.
type Resources ¶
type Resources struct { GPUs []Resource `json:"gpus" yaml:"gpus"` MIGs []Resource `json:"mig,omitempty" yaml:"mig,omitempty"` }
Resources lists full GPUs and MIG devices separately.
func (*Resources) AddGPUResource ¶
AddGPUResource adds a GPU resource to the list of GPU resources.
func (*Resources) AddMIGResource ¶
AddMIGResource adds a MIG resource to the list of MIG resources.
type Sharing ¶
type Sharing struct { TimeSlicing TimeSlicing `json:"timeSlicing,omitempty" yaml:"timeSlicing,omitempty"` MPS MPS `json:"mps,omitempty" yaml:"mps,omitempty"` }
Sharing encapsulates the set of sharing strategies that are supported.
type TimeSlicing ¶
type TimeSlicing struct { RenameByDefault bool `json:"renameByDefault,omitempty" yaml:"renameByDefault,omitempty"` FailRequestsGreaterThanOne bool `json:"failRequestsGreaterThanOne,omitempty" yaml:"failRequestsGreaterThanOne,omitempty"` Resources []ReplicatedResource `json:"resources,omitempty" yaml:"resources,omitempty"` }
TimeSlicing defines the set of replicas to be made for timeSlicing available resources.
func (*TimeSlicing) UnmarshalJSON ¶
func (s *TimeSlicing) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals raw bytes into a 'TimeSlicing' struct.