utils

package
v0.4.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ResourceName = "cerit.io/gpu-mem"
	CountName    = "cerit.io/gpu-count"

	EnvNVGPU              = "NVIDIA_VISIBLE_DEVICES"
	EnvResourceIndex      = "CERIT_IO_GPU_MEM_IDX"
	EnvResourceByPod      = "CERIT_IO_GPU_MEM_POD"
	EnvResourceByDev      = "CERIT_IO_GPU_MEM_DEV"
	EnvAssignedFlag       = "CERIT_IO_GPU_MEM_ASSIGNED"
	EnvResourceAssumeTime = "CERIT_IO_GPU_MEM_ASSUME_TIME"
)

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 GetGPUCountInNode

func GetGPUCountInNode(node *v1.Node) int

Get the GPU count of the node

func GetGPUIDFromAnnotation

func GetGPUIDFromAnnotation(pod *v1.Pod) int

GetGPUIDFromAnnotation gets GPU ID from Annotation

func GetGPUIDFromEnv

func GetGPUIDFromEnv(pod *v1.Pod) int

GetGPUIDFromEnv gets GPU ID from Env

func GetGPUMemoryFromContainerResource

func GetGPUMemoryFromContainerResource(container v1.Container) int

GetGPUMemoryFromPodResource gets GPU Memory of the Container

func GetGPUMemoryFromPodAnnotation

func GetGPUMemoryFromPodAnnotation(pod *v1.Pod) (gpuMemory uint)

GetGPUMemoryFromPodAnnotation gets the GPU Memory of the pod, choose the larger one between gpu memory and gpu init container memory

func GetGPUMemoryFromPodEnv

func GetGPUMemoryFromPodEnv(pod *v1.Pod) (gpuMemory uint)

GetGPUMemoryFromPodEnv gets the GPU Memory of the pod, choose the larger one between gpu memory and gpu init container memory

func GetGPUMemoryFromPodResource

func GetGPUMemoryFromPodResource(pod *v1.Pod) int

GetGPUMemoryFromPodResource gets GPU Memory of the Pod

func GetTotalGPUMemory

func GetTotalGPUMemory(node *v1.Node) int

Get the total GPU memory of the Node

func GetUpdatedPodAnnotationSpec

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

GetUpdatedPodAnnotationSpec updates pod env with devId

func GetUpdatedPodEnvSpec

func GetUpdatedPodEnvSpec(oldPod *v1.Pod, devId int, totalGPUMemByDev int) (newPod *v1.Pod)

GetUpdatedPodEnvSpec updates pod env with devId

func IsCompletePod

func IsCompletePod(pod *v1.Pod) bool

IsCompletePod determines if the pod is complete

func IsGPUSharingNode

func IsGPUSharingNode(node *v1.Node) bool

Is the Node for GPU sharing

func IsGPUsharingPod

func IsGPUsharingPod(pod *v1.Pod) bool

IsGPUsharingPod determines if it's the pod for GPU sharing

func PatchPodAnnotationSpec added in v0.2.0

func PatchPodAnnotationSpec(oldPod *v1.Pod, devId int, totalGPUMemByDev int) ([]byte, error)

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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