Documentation
¶
Index ¶
- Variables
- func GetDeviceScore(info *device.Device) float64
- func GetNodeScore(info *device.NodeInfo) float64
- func GetNumaNodeScore(devices []*device.Device) float64
- func NewAllocator(nodeInfo *device.NodeInfo) *allocator
- func NewDeviceBinpackPriority() *sortPriority[*device.Device]
- func NewDeviceSpreadPriority() *sortPriority[*device.Device]
- func NewNodeBinpackPriority() *sortPriority[*device.NodeInfo]
- func NewNodeSpreadPriority() *sortPriority[*device.NodeInfo]
- func NewSortPriority[T any](less ...LessFunc[T]) *sortPriority[T]
- type Callback
- type LessFunc
- type NumaNodeDevice
- func (n NumaNodeDevice) BinpackCallback(callback Callback)
- func (n NumaNodeDevice) DefaultCallback(callback Callback)
- func (n NumaNodeDevice) MaxDeviceNumberForNumaNode() int
- func (n NumaNodeDevice) SchedulerPolicyCallback(policy util.SchedulerPolicy, callback Callback)
- func (n NumaNodeDevice) SpreadCallback(callback Callback)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ByAllocatableMemoryAsc Compare the assignable memory of two devices in ascending order ByAllocatableMemoryAsc = func(p1, p2 *device.Device) bool { return p1.AllocatableMemory() < p2.AllocatableMemory() } // ByAllocatableMemoryDes Compare the assignable memory of two devices in descending order ByAllocatableMemoryDes = func(p1, p2 *device.Device) bool { return p1.AllocatableMemory() > p2.AllocatableMemory() } // ByAllocatableCoresAsc Compare the assignable cores of two devices in ascending order ByAllocatableCoresAsc = func(p1, p2 *device.Device) bool { return p1.AllocatableCores() < p2.AllocatableCores() } // ByAllocatableCoresDes Compare the assignable cores of two devices in descending order ByAllocatableCoresDes = func(p1, p2 *device.Device) bool { return p1.AllocatableCores() > p2.AllocatableCores() } // ByDeviceIdAsc Compare the device id of two devices in ascending order ByDeviceIdAsc = func(p1, p2 *device.Device) bool { return p1.GetID() < p2.GetID() } ByAllocatableNumberDes = func(p1, p2 *device.Device) bool { return p1.AllocatableNumber() > p2.AllocatableNumber() } ByNumaAsc = func(p1, p2 *device.Device) bool { return p1.GetNUMA() < p2.GetNUMA() } ByNodeNameAsc = func(p1, p2 *device.NodeInfo) bool { return p1.GetName() < p2.GetName() } // ByNodeScoreAsc Sort in ascending order based on node scores, // to avoid double counting scores, a score cache was used. ByNodeScoreAsc = func() func(p1, p2 *device.NodeInfo) bool { nodeScoreMap := map[string]float64{} return func(p1, p2 *device.NodeInfo) bool { p1Score, ok := nodeScoreMap[p1.GetName()] if !ok { p1Score = GetNodeScore(p1) nodeScoreMap[p1.GetName()] = p1Score } p2Score, ok := nodeScoreMap[p2.GetName()] if !ok { p2Score = GetNodeScore(p2) nodeScoreMap[p2.GetName()] = p2Score } return p1Score < p2Score } } // ByNodeScoreDes Sort in descending order based on node scores, // to avoid double counting scores, a score cache was used. ByNodeScoreDes = func() func(p1, p2 *device.NodeInfo) bool { nodeScoreMap := map[string]float64{} return func(p1, p2 *device.NodeInfo) bool { p1Score, ok := nodeScoreMap[p1.GetName()] if !ok { p1Score = GetNodeScore(p1) nodeScoreMap[p1.GetName()] = p1Score } p2Score, ok := nodeScoreMap[p2.GetName()] if !ok { p2Score = GetNodeScore(p2) nodeScoreMap[p2.GetName()] = p2Score } return p1Score > p2Score } } )
Functions ¶
func GetDeviceScore ¶
GetDeviceScore Calculate device score: assignableResource / totalResource = scorePercentage
func GetNodeScore ¶
GetNodeScore Calculate node score: freeResource / totalResource = scorePercentage
func GetNumaNodeScore ¶
GetNumaNodeScore Calculate the average score of all devices on the numa node
func NewAllocator ¶
func NewDeviceSpreadPriority ¶
func NewNodeBinpackPriority ¶
func NewNodeSpreadPriority ¶
func NewSortPriority ¶
Types ¶
type NumaNodeDevice ¶
func CanNotCrossNumaNode ¶
func CanNotCrossNumaNode(gpuNumber int, devices []*device.Device) (NumaNodeDevice, bool)
func NewNumaNodeDevice ¶
func NewNumaNodeDevice(devices []*device.Device) NumaNodeDevice
func (NumaNodeDevice) BinpackCallback ¶
func (n NumaNodeDevice) BinpackCallback(callback Callback)
func (NumaNodeDevice) DefaultCallback ¶
func (n NumaNodeDevice) DefaultCallback(callback Callback)
func (NumaNodeDevice) MaxDeviceNumberForNumaNode ¶
func (n NumaNodeDevice) MaxDeviceNumberForNumaNode() int
func (NumaNodeDevice) SchedulerPolicyCallback ¶
func (n NumaNodeDevice) SchedulerPolicyCallback(policy util.SchedulerPolicy, callback Callback)
func (NumaNodeDevice) SpreadCallback ¶
func (n NumaNodeDevice) SpreadCallback(callback Callback)
Click to show internal directories.
Click to hide internal directories.