deviceshare

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NvidiaGPU = 1 << iota
	HygonDCU
	KoordGPU
	GPUCore
	GPUMemory
	GPUMemoryRatio
	FPGA
	RDMA
)
View Source
const (
	// Name is the name of the plugin used in the plugin registry and configurations.
	Name = "DeviceShare"
)

Variables

View Source
var ResourceCombinationsMapper = map[uint]func(podRequest corev1.ResourceList) corev1.ResourceList{
	GPUMemory: func(podRequest corev1.ResourceList) corev1.ResourceList {
		return corev1.ResourceList{
			apiext.ResourceGPUMemory: podRequest[apiext.ResourceGPUMemory],
		}
	},
	GPUMemoryRatio: func(podRequest corev1.ResourceList) corev1.ResourceList {
		return corev1.ResourceList{
			apiext.ResourceGPUMemoryRatio: podRequest[apiext.ResourceGPUMemoryRatio],
		}
	},
	GPUCore | GPUMemory: func(podRequest corev1.ResourceList) corev1.ResourceList {
		return corev1.ResourceList{
			apiext.ResourceGPUCore:   podRequest[apiext.ResourceGPUCore],
			apiext.ResourceGPUMemory: podRequest[apiext.ResourceGPUMemory],
		}
	},
	GPUCore | GPUMemoryRatio: func(podRequest corev1.ResourceList) corev1.ResourceList {
		return corev1.ResourceList{
			apiext.ResourceGPUCore:        podRequest[apiext.ResourceGPUCore],
			apiext.ResourceGPUMemoryRatio: podRequest[apiext.ResourceGPUMemoryRatio],
		}
	},
	KoordGPU: func(podRequest corev1.ResourceList) corev1.ResourceList {
		return corev1.ResourceList{
			apiext.ResourceGPUCore:        podRequest[apiext.ResourceGPU],
			apiext.ResourceGPUMemoryRatio: podRequest[apiext.ResourceGPU],
		}
	},
	NvidiaGPU: func(podRequest corev1.ResourceList) corev1.ResourceList {
		nvidiaGPU := podRequest[apiext.ResourceNvidiaGPU]
		return corev1.ResourceList{
			apiext.ResourceGPUCore:        *resource.NewQuantity(nvidiaGPU.Value()*100, resource.DecimalSI),
			apiext.ResourceGPUMemoryRatio: *resource.NewQuantity(nvidiaGPU.Value()*100, resource.DecimalSI),
		}
	},
	HygonDCU: func(podRequest corev1.ResourceList) corev1.ResourceList {
		hygonDCU := podRequest[apiext.ResourceHygonDCU]
		return corev1.ResourceList{
			apiext.ResourceGPUCore:        *resource.NewQuantity(hygonDCU.Value()*100, resource.DecimalSI),
			apiext.ResourceGPUMemoryRatio: *resource.NewQuantity(hygonDCU.Value()*100, resource.DecimalSI),
		}
	},
	FPGA: func(podRequest corev1.ResourceList) corev1.ResourceList {
		return corev1.ResourceList{
			apiext.ResourceFPGA: podRequest[apiext.ResourceFPGA],
		}
	},
	RDMA: func(podRequest corev1.ResourceList) corev1.ResourceList {
		return corev1.ResourceList{
			apiext.ResourceRDMA: podRequest[apiext.ResourceRDMA],
		}
	},
}

Functions

func ConvertDeviceRequest added in v1.3.0

func ConvertDeviceRequest(podRequest corev1.ResourceList, combination uint) corev1.ResourceList

func GetPodDeviceRequests added in v1.4.0

func GetPodDeviceRequests(pod *corev1.Pod) (map[schedulingv1alpha1.DeviceType]corev1.ResourceList, error)

func New

func New(obj runtime.Object, handle framework.Handle) (framework.Plugin, error)

func ValidateDeviceRequest added in v1.3.0

func ValidateDeviceRequest(podRequest corev1.ResourceList) (uint, error)

func ValidatePercentageResource added in v1.3.0

func ValidatePercentageResource(q resource.Quantity) bool

Types

type AutopilotAllocator added in v1.4.0

type AutopilotAllocator struct {
	// contains filtered or unexported fields
}

func (*AutopilotAllocator) Allocate added in v1.4.0

func (a *AutopilotAllocator) Allocate(
	required, preferred map[schedulingv1alpha1.DeviceType]sets.Int,
	requiredDeviceResources, preemptibleDeviceResources map[schedulingv1alpha1.DeviceType]deviceResources,
) (apiext.DeviceAllocations, *framework.Status)

func (*AutopilotAllocator) Prepare added in v1.4.0

func (a *AutopilotAllocator) Prepare() *framework.Status

type DefaultDeviceHandler added in v1.4.0

type DefaultDeviceHandler struct {
	// contains filtered or unexported fields
}

func (*DefaultDeviceHandler) CalcDesiredRequestsAndCount added in v1.4.0

func (h *DefaultDeviceHandler) CalcDesiredRequestsAndCount(_ *corev1.Node, _ *corev1.Pod, podRequests corev1.ResourceList, nodeDevice *nodeDevice, hint *apiext.DeviceHint) (corev1.ResourceList, int, *framework.Status)

type DeviceAllocator added in v1.4.0

type DeviceAllocator interface {
	Allocate(requestCtx *requestContext, nodeDevice *nodeDevice, desiredCount int, maxDesiredCount int, preferredPCIEs sets.String) ([]*apiext.DeviceAllocation, *framework.Status)
}

type DeviceHandler added in v1.4.0

type DeviceHandler interface {
	CalcDesiredRequestsAndCount(node *corev1.Node, pod *corev1.Pod, podRequests corev1.ResourceList, nodeDevice *nodeDevice, hint *apiext.DeviceHint) (corev1.ResourceList, int, *framework.Status)
}

type GPUHandler added in v1.4.0

type GPUHandler struct {
}

func (*GPUHandler) CalcDesiredRequestsAndCount added in v1.4.0

func (h *GPUHandler) CalcDesiredRequestsAndCount(node *corev1.Node, pod *corev1.Pod, podRequests corev1.ResourceList, nodeDevice *nodeDevice, hint *apiext.DeviceHint) (corev1.ResourceList, int, *framework.Status)

type NUMATopology added in v1.4.0

type NUMATopology struct {
	// contains filtered or unexported fields
}

type NodeDeviceSummary

type NodeDeviceSummary struct {
	DeviceTotal map[v1.ResourceName]*resource.Quantity `json:"deviceTotal"`
	DeviceFree  map[v1.ResourceName]*resource.Quantity `json:"deviceFree"`
	DeviceUsed  map[v1.ResourceName]*resource.Quantity `json:"deviceUsed"`

	DeviceTotalDetail map[schedulingv1alpha1.DeviceType]deviceResources `json:"deviceTotalDetail"`
	DeviceFreeDetail  map[schedulingv1alpha1.DeviceType]deviceResources `json:"deviceFreeDetail"`
	DeviceUsedDetail  map[schedulingv1alpha1.DeviceType]deviceResources `json:"deviceUsedDetail"`

	AllocateSet map[schedulingv1alpha1.DeviceType]map[string]map[int]v1.ResourceList `json:"allocateSet"`
}

func NewNodeDeviceSummary

func NewNodeDeviceSummary() *NodeDeviceSummary

type PCIe added in v1.4.0

type PCIe struct {
	PCIeIndex
	// contains filtered or unexported fields
}

type PCIeIndex added in v1.4.0

type PCIeIndex struct {
	// contains filtered or unexported fields
}

type Plugin

type Plugin struct {
	// contains filtered or unexported fields
}

func (*Plugin) AddPod added in v1.2.0

func (p *Plugin) AddPod(ctx context.Context, cycleState *framework.CycleState, podToSchedule *corev1.Pod, podInfoToAdd *framework.PodInfo, nodeInfo *framework.NodeInfo) *framework.Status

func (*Plugin) Allocate added in v1.4.0

func (p *Plugin) Allocate(ctx context.Context, cycleState *framework.CycleState, affinity topologymanager.NUMATopologyHint, pod *corev1.Pod, nodeName string) *framework.Status

func (*Plugin) EventsToRegister added in v1.3.0

func (p *Plugin) EventsToRegister() []framework.ClusterEvent

func (*Plugin) Filter

func (p *Plugin) Filter(ctx context.Context, cycleState *framework.CycleState, pod *corev1.Pod, nodeInfo *framework.NodeInfo) *framework.Status

func (*Plugin) FilterReservation added in v1.2.0

func (p *Plugin) FilterReservation(ctx context.Context, cycleState *framework.CycleState, pod *corev1.Pod, reservationInfo *frameworkext.ReservationInfo, nodeName string) *framework.Status

func (*Plugin) FinalRestoreReservation added in v1.3.0

func (p *Plugin) FinalRestoreReservation(ctx context.Context, cycleState *framework.CycleState, pod *corev1.Pod, nodeToStates frameworkext.NodeReservationRestoreStates) *framework.Status

func (*Plugin) GetPodTopologyHints added in v1.4.0

func (p *Plugin) GetPodTopologyHints(ctx context.Context, cycleState *framework.CycleState, pod *corev1.Pod, nodeName string) (map[string][]topologymanager.NUMATopologyHint, *framework.Status)

func (*Plugin) Name

func (p *Plugin) Name() string

func (*Plugin) NormalizeReservationScore added in v1.4.0

func (p *Plugin) NormalizeReservationScore(ctx context.Context, cycleState *framework.CycleState, pod *corev1.Pod, scores frameworkext.ReservationScoreList) *framework.Status

func (*Plugin) NormalizeScore added in v1.3.0

func (p *Plugin) NormalizeScore(ctx context.Context, cycleState *framework.CycleState, pod *corev1.Pod, scores framework.NodeScoreList) *framework.Status

func (*Plugin) PreBind

func (p *Plugin) PreBind(ctx context.Context, cycleState *framework.CycleState, pod *corev1.Pod, nodeName string) *framework.Status

func (*Plugin) PreBindReservation added in v1.2.0

func (p *Plugin) PreBindReservation(ctx context.Context, cycleState *framework.CycleState, reservation *schedulingv1alpha1.Reservation, nodeName string) *framework.Status

func (*Plugin) PreFilter

func (p *Plugin) PreFilter(ctx context.Context, cycleState *framework.CycleState, pod *corev1.Pod) (*framework.PreFilterResult, *framework.Status)

func (*Plugin) PreFilterExtensions

func (p *Plugin) PreFilterExtensions() framework.PreFilterExtensions

func (*Plugin) PreRestoreReservation added in v1.3.0

func (p *Plugin) PreRestoreReservation(ctx context.Context, cycleState *framework.CycleState, pod *corev1.Pod) *framework.Status

func (*Plugin) RegisterEndpoints

func (p *Plugin) RegisterEndpoints(group *gin.RouterGroup)

func (*Plugin) RemovePod added in v1.2.0

func (p *Plugin) RemovePod(ctx context.Context, cycleState *framework.CycleState, podToSchedule *corev1.Pod, podInfoToRemove *framework.PodInfo, nodeInfo *framework.NodeInfo) *framework.Status

func (*Plugin) ReservationScoreExtensions added in v1.4.0

func (p *Plugin) ReservationScoreExtensions() frameworkext.ReservationScoreExtensions

func (*Plugin) Reserve

func (p *Plugin) Reserve(ctx context.Context, cycleState *framework.CycleState, pod *corev1.Pod, nodeName string) *framework.Status

func (*Plugin) ResizePod added in v1.4.0

func (p *Plugin) ResizePod(ctx context.Context, cycleState *framework.CycleState, pod *corev1.Pod, nodeName string) *framework.Status

func (*Plugin) RestoreReservation added in v1.3.0

func (p *Plugin) RestoreReservation(ctx context.Context, cycleState *framework.CycleState, podToSchedule *corev1.Pod, matched []*frameworkext.ReservationInfo, unmatched []*frameworkext.ReservationInfo, nodeInfo *framework.NodeInfo) (interface{}, *framework.Status)

func (*Plugin) Score added in v1.3.0

func (p *Plugin) Score(ctx context.Context, cycleState *framework.CycleState, pod *corev1.Pod, nodeName string) (int64, *framework.Status)

func (*Plugin) ScoreExtensions added in v1.3.0

func (p *Plugin) ScoreExtensions() framework.ScoreExtensions

func (*Plugin) ScoreReservation added in v1.3.0

func (p *Plugin) ScoreReservation(ctx context.Context, cycleState *framework.CycleState, pod *corev1.Pod, reservationInfo *frameworkext.ReservationInfo, nodeName string) (int64, *framework.Status)

func (*Plugin) Unreserve

func (p *Plugin) Unreserve(ctx context.Context, cycleState *framework.CycleState, pod *corev1.Pod, nodeName string)

type VFAllocation added in v1.4.0

type VFAllocation struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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