device

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDeviceMapByNode added in v0.3.0

func NewDeviceMapByNode(node *corev1.Node) (map[int]*Device, error)

Types

type ClaimDevice

type ClaimDevice struct {
	Id     int    `json:"id"`
	Uuid   string `json:"uuid"`
	Cores  int    `json:"cores"`
	Memory int    `json:"memory"`
}

func (*ClaimDevice) MarshalText

func (c *ClaimDevice) MarshalText() (string, error)

func (*ClaimDevice) UnmarshalText

func (c *ClaimDevice) UnmarshalText(text string) error

type ContainerDevices

type ContainerDevices struct {
	Name    string        `json:"name"`
	Devices []ClaimDevice `json:"devices"`
}

func GetCurrentPreAllocateContainerDevice

func GetCurrentPreAllocateContainerDevice(pod *corev1.Pod) (*ContainerDevices, error)

GetCurrentPreAllocateContainerDevice find the device information pre allocated to the current container.

func (*ContainerDevices) MarshalText

func (c *ContainerDevices) MarshalText() (string, error)

func (*ContainerDevices) UnmarshalText

func (c *ContainerDevices) UnmarshalText(text string) error

type Device added in v0.3.0

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

func NewDevice added in v0.3.0

func NewDevice(dev DeviceInfo) *Device

func NewFakeDevice added in v0.3.0

func NewFakeDevice(id, usedNum, totalNum, usedCore, totalCore, usedMem, totalMem, numa int) *Device

func (*Device) AllocatableCores added in v0.3.0

func (dev *Device) AllocatableCores() int

AllocatableCores returns the remaining cores of this GPU device

func (*Device) AllocatableMemory added in v0.3.0

func (dev *Device) AllocatableMemory() int

AllocatableMemory returns the remaining memory of this GPU device

func (*Device) AllocatableNumber added in v0.3.0

func (dev *Device) AllocatableNumber() int

AllocatableNumber returns the remaining number of this GPU device

func (*Device) GetBusID added in v0.3.0

func (dev *Device) GetBusID() string

GetBusID returns the busId of this device

func (*Device) GetComputeCapability added in v0.3.0

func (dev *Device) GetComputeCapability() float32

GetComputeCapability returns the capability of this device

func (*Device) GetID added in v0.3.0

func (dev *Device) GetID() int

GetID returns the idx of this device

func (*Device) GetNUMA added in v0.3.0

func (dev *Device) GetNUMA() int

GetNUMA returns the numa of this device

func (*Device) GetTotalCores added in v0.3.0

func (dev *Device) GetTotalCores() int

GetTotalCores returns the totalCore of this device

func (*Device) GetTotalMemory added in v0.3.0

func (dev *Device) GetTotalMemory() int

GetTotalMemory returns the totalMemory of this device

func (*Device) GetTotalNumber added in v0.3.0

func (dev *Device) GetTotalNumber() int

GetTotalNumber returns the totalNum of this device

func (*Device) GetType added in v0.3.0

func (dev *Device) GetType() string

GetType returns the type of this device

func (*Device) GetUUID added in v0.3.0

func (dev *Device) GetUUID() string

GetUUID returns the uuid of this device

func (*Device) Healthy added in v0.3.0

func (dev *Device) Healthy() bool

Healthy return whether the device is healthy

func (*Device) IsMIG added in v0.3.0

func (dev *Device) IsMIG() bool

type DeviceInfo

type DeviceInfo struct {
	Id         int     `json:"id"`
	Type       string  `json:"type"`
	Uuid       string  `json:"uuid"`
	Core       int     `json:"core"`
	Memory     int     `json:"memory"`
	Number     int     `json:"number"`
	Numa       int     `json:"numa"`
	Mig        bool    `json:"mig"`
	BusId      string  `json:"busId"`
	Capability float32 `json:"capability"`
	Healthy    bool    `json:"healthy"`
}

type NodeDeviceInfo added in v0.3.0

type NodeDeviceInfo []DeviceInfo

func ParseNodeDeviceInfo added in v0.3.0

func ParseNodeDeviceInfo(val string) (NodeDeviceInfo, error)

func (*NodeDeviceInfo) Decode added in v0.4.1

func (n *NodeDeviceInfo) Decode(val string) error

func (NodeDeviceInfo) Encode added in v0.3.0

func (n NodeDeviceInfo) Encode() (string, error)

type NodeInfo

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

func NewFakeNodeInfo added in v0.3.0

func NewFakeNodeInfo(node *corev1.Node, devices []*Device) *NodeInfo

func NewNodeInfo

func NewNodeInfo(node *corev1.Node, pods []*corev1.Pod) (*NodeInfo, error)

func (*NodeInfo) AddUsedResources added in v0.3.0

func (n *NodeInfo) AddUsedResources(id int, core int, memory int) error

AddUsedResources records the used GPU core and memory

func (*NodeInfo) GetAvailableCores added in v0.3.0

func (n *NodeInfo) GetAvailableCores() int

GetAvailableCores returns the remaining cores of this node

func (*NodeInfo) GetAvailableMemory

func (n *NodeInfo) GetAvailableMemory() int

GetAvailableMemory returns the remaining memory of this node

func (*NodeInfo) GetAvailableNumber

func (n *NodeInfo) GetAvailableNumber() int

GetAvailableNumber returns the remaining number of this node

func (*NodeInfo) GetDeviceCount

func (n *NodeInfo) GetDeviceCount() int

GetDeviceCount returns the number of GPU devices

func (*NodeInfo) GetDeviceMap

func (n *NodeInfo) GetDeviceMap() map[int]*Device

GetDeviceMap returns each GPU device information structure

func (*NodeInfo) GetMaxCapability

func (n *NodeInfo) GetMaxCapability() float32

GetMaxCapability returns the maxCapability of GPU devices

func (*NodeInfo) GetName

func (n *NodeInfo) GetName() string

GetName returns node name

func (*NodeInfo) GetNode

func (n *NodeInfo) GetNode() *corev1.Node

GetNode returns the original node structure of kubernetes

func (*NodeInfo) GetTotalCores added in v0.3.0

func (n *NodeInfo) GetTotalCores() int

GetTotalCores returns the total cores of this node

func (*NodeInfo) GetTotalMemory

func (n *NodeInfo) GetTotalMemory() int

GetTotalMemory returns the total memory of this node

func (*NodeInfo) GetTotalNumber

func (n *NodeInfo) GetTotalNumber() int

GetTotalNumber returns the total number of this node

type NodeTopologyInfo added in v0.3.0

type NodeTopologyInfo []TopologyInfo

func ParseNodeTopology added in v0.3.0

func ParseNodeTopology(val string) (NodeTopologyInfo, error)

func (*NodeTopologyInfo) Decode added in v0.4.1

func (n *NodeTopologyInfo) Decode(val string) error

func (NodeTopologyInfo) Encode added in v0.3.0

func (n NodeTopologyInfo) Encode() (string, error)

type PodDevices

type PodDevices []ContainerDevices

func GetPodAssignDevices

func GetPodAssignDevices(pod *corev1.Pod) PodDevices

func (*PodDevices) MarshalText

func (p *PodDevices) MarshalText() (string, error)

func (*PodDevices) UnmarshalText

func (p *PodDevices) UnmarshalText(text string) error

type TopologyInfo added in v0.3.0

type TopologyInfo struct {
	Index int                         `json:"index"`
	Links map[int][]links.P2PLinkType `json:"links"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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