utils

package
v0.1.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ResourceName = "alibabacloud.com/gpu-mem"        // Pod's GPU Memory request for each GPU
	CountName    = "alibabacloud.com/gpu-count"      // Pod's GPU number request => Total GPU Memory == Resource * Count
	DeviceIndex  = "alibabacloud.com/gpu-index"      // Exists when the pod are assigned/predefined to a GPU device
	AssumeTime   = "alibabacloud.com/assume-time"    // To retrieve the scheduling latency
	ModelName    = "alibabacloud.com/gpu-card-model" // node annotation
)

Variables

This section is empty.

Functions

func AssignedNonTerminatedPod

func AssignedNonTerminatedPod(pod *v1.Pod) bool

AssignedNonTerminatedPod selects pods that are assigned and non-terminal (scheduled and running).

func GetGpuCountFromPodAnnotation

func GetGpuCountFromPodAnnotation(pod *v1.Pod) (gpuCount int64)

GetGpuCountFromPodAnnotation gets the GPU Count of the pod

func GetGpuCountInNode

func GetGpuCountInNode(node *v1.Node) int

GetGpuCountInNode Get the GPU count of the node

func GetGpuIdFromAnnotation

func GetGpuIdFromAnnotation(pod *v1.Pod) (id string)

GetGpuIdFromAnnotation gets GPU ID from Annotation, could be "1" or "0-1-2-3" for multi-GPU allocations

func GetGpuIdListFromAnnotation

func GetGpuIdListFromAnnotation(pod *v1.Pod) (idl []int, err error)

GetGpuIdListFromAnnotation gets GPU ID List from Annotation, could be [1] or [0, 1, 2, 3] for multi-GPU allocations

func GetGpuMemoryAndCountFromPodAnnotation

func GetGpuMemoryAndCountFromPodAnnotation(pod *v1.Pod) (gpuMem int64, gpuNum int64)

GetGpuMemoryAndCountFromPodAnnotation gets GPU Memory (for each GPU) and GPU Number requested by the Pod

func GetGpuMemoryFromPodAnnotation

func GetGpuMemoryFromPodAnnotation(pod *v1.Pod) (gpuMemory int64)

GetGpuMemoryFromPodAnnotation gets the GPU Memory of the pod

func GetGpuModel

func GetGpuModel(node *v1.Node) string

func GetTotalGpuMemory

func GetTotalGpuMemory(node *v1.Node) int64

GetTotalGpuMemory Get the total GPU memory of the Node

func GetUpdatedPodAnnotationSpec

func GetUpdatedPodAnnotationSpec(oldPod *v1.Pod, devId string) (newPod *v1.Pod)

GetUpdatedPodAnnotationSpec updates pod env with devId

func GpuIdStrToIntList

func GpuIdStrToIntList(id string) (idl []int, err error)

GpuIdStrToIntList follows the string formed in func (n *GpuNodeInfo) AllocateGpuId

func IsCompletePod

func IsCompletePod(pod *v1.Pod) bool

IsCompletePod determines if the pod is complete

func IsGpuSharingNode

func IsGpuSharingNode(node *v1.Node) bool

IsGpuSharingNode Is the Node for GPU sharing

Types

This section is empty.

Jump to

Keyboard shortcuts

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