Documentation ¶
Index ¶
- Constants
- func AsResources(g gpu.Geometry) map[v1.ResourceName]int
- func ExtractGpuId(resourceId string) string
- func ExtractProfileNameStr(r v1.ResourceName) (string, error)
- func GetRequestedProfiles(pod v1.Pod) map[ProfileName]int
- func IsGpuSlice(r v1.ResourceName) bool
- func NewClient(resourceClient resource.Client, nvmlClient nvml.Client) gpu.Client
- type GPU
- type Node
- func (n *Node) AddPod(pod v1.Pod) error
- func (n *Node) Clone() interface{}
- func (n *Node) Geometry() map[gpu.Slice]int
- func (n *Node) GetName() string
- func (n *Node) HasFreeCapacity() bool
- func (n *Node) NodeInfo() framework.NodeInfo
- func (n *Node) UpdateGeometryFor(slices map[gpu.Slice]int) (bool, error)
- type ProfileName
Constants ¶
const ( // ReplicaGpuIdSeparator is the separator used to separate the GPU ID from the replica ID in the // GPU devices exposed by the NVIDIA device plugin as shared GPUs. ReplicaGpuIdSeparator = "::" // MinSliceMemoryGB is the smallest slice size that can be created on slicing shared GPUs. MinSliceMemoryGB = 1 )
Variables ¶
This section is empty.
Functions ¶
func AsResources ¶
func AsResources(g gpu.Geometry) map[v1.ResourceName]int
func ExtractGpuId ¶
ExtractGpuId returns the GPU ID corresponding to the resource ID provided as argument.
func ExtractProfileNameStr ¶
func ExtractProfileNameStr(r v1.ResourceName) (string, error)
func GetRequestedProfiles ¶
func GetRequestedProfiles(pod v1.Pod) map[ProfileName]int
func IsGpuSlice ¶
func IsGpuSlice(r v1.ResourceName) bool
Types ¶
type GPU ¶
type GPU struct { Model gpu.Model Index int MemoryGB int UsedProfiles map[ProfileName]int FreeProfiles map[ProfileName]int }
func NewGpuOrPanic ¶
func (*GPU) AddPod ¶
AddPod adds a Pod to the GPU by updating the free and used slices according to the ones requested by the Pod.
AddPod returns an error if the GPU does not have enough free slices for the Pod.
func (*GPU) GetGeometry ¶
func (*GPU) HasFreeCapacity ¶
func (*GPU) UpdateGeometryFor ¶
UpdateGeometryFor tries to update the geometry of the GPU in order to create the highest possible number of required slices provided as argument, without deleting any of the used slices.
The method returns true if the GPU geometry gets updated, false otherwise.
type Node ¶
func (*Node) AddPod ¶
AddPod adds a Pod to the node by updating the free and used slices of the Node GPUs according to the slices requested by the Pod.
AddPod returns an error if the node does not have any GPU providing enough free slices resources for the Pod.
func (*Node) Geometry ¶
Geometry returns the overall geometry of the node, which corresponds to the sum of the geometries of all the GPUs present in the Node.
func (*Node) HasFreeCapacity ¶
HasFreeCapacity returns true if any of the GPUs of the node has enough free capacity for hosting more pods.
type ProfileName ¶
type ProfileName string
func ExtractProfileName ¶
func ExtractProfileName(resourceName v1.ResourceName) (ProfileName, error)
ExtractProfileName extracts the name of the slicing profile from the provided resource name, and returns an error if the resource name is not a valid NVIDIA slicing resource.
Example:
nvidia.com/10gb => 10gb nvidia.com/gpu => error
func NewProfile ¶
func NewProfile(sizeGb int) ProfileName
func (ProfileName) AsResourceName ¶
func (p ProfileName) AsResourceName() v1.ResourceName
func (ProfileName) GetMemorySizeGB ¶
func (p ProfileName) GetMemorySizeGB() int
func (ProfileName) SmallerThan ¶
func (p ProfileName) SmallerThan(other gpu.Slice) bool
func (ProfileName) String ¶
func (p ProfileName) String() string