nodeinfo

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DraDriverCpu_CpuID    resourcev1.QualifiedName = "dra.cpu/cpuID"
	DraDriverCpu_CoreID   resourcev1.QualifiedName = "dra.cpu/coreID"
	DraDriverCpu_SocketID resourcev1.QualifiedName = "dra.cpu/socketID"
	DraDriverCpu_CoreType resourcev1.QualifiedName = "dra.cpu/coreType"
)

Resource attributes

View Source
const (
	DraExampleDriver   = "gpu.example.com"
	DraDriverGpuNvidia = "gpu.nvidia.com"
)
View Source
const DraDriverCpu = "dra.cpu"
View Source
const (
	DraExampleDriver_Index resourcev1.QualifiedName = "index"
)

Resource attributes. DraExampleDriver uses "index" in Device.Attributes. DraDriverGpuNvidia uses Name "gpu-<minor>", (e.g. "gpu-0", "gpu-1" from CanonicalName in NVIDIA k8s-dra-driver-gpu).

Variables

This section is empty.

Functions

This section is empty.

Types

type CPUInfo

type CPUInfo struct {
	// Name of enumerated CPU
	Name string `json:"name"`

	// CpuID is the enumerated CPU ID
	CpuID int `json:"cpuID"`

	// CoreID is the logical core ID, unique within each SocketID
	CoreID int `json:"coreID"`

	// SocketID is the physical socket ID
	SocketID int `json:"socketID"`

	// CPU Sibling of the CpuID
	SiblingCpuID cpuset.CPUSet `json:"siblingCpuID"`

	// Core Type (e-core or p-core)
	CoreType CoreType `json:"coreType,omitempty"`
}

CPUInfo holds information about a single CPU.

func NewCPUInfos

func NewCPUInfos(rSlice *resourcev1.ResourceSlice) []*CPUInfo

type CPUMap

type CPUMap struct {
	// CPUInfoMap stores the raw CPUInfos as a map,
	// where the index is the CPU ID, and the value is the CPUInfo.
	CPUInfoMap map[int]*CPUInfo `json:"cpuInfoMap"`

	// AbstractToMachine is a map of abstract to machine cores,
	// where the index is the core, and the value is the set of CpuIDs.
	AbstractToMachine []cpuset.CPUSet `json:"abstractToMachine"`

	// MachineToAbstract is the map of machine to abstract cores,
	// where the index is CpuID, and the value is the core index from AbstractToMachine.
	MachineToAbstract map[int]int `json:"machineToAbstract"`
}

CPUMap holds the Slurm abstract to machine core map.

func NewCPUMap

func NewCPUMap(cpuInfos []*CPUInfo) CPUMap

func (CPUMap) GetOnesBitmap

func (cpuMap CPUMap) GetOnesBitmap() bitmap.Bitmap

GetOnesBitmap returns a bitmap with all available bits set to one.

func (CPUMap) ToAbstractCPUs

func (cpuMap CPUMap) ToAbstractCPUs(macCpuSet cpuset.CPUSet) bitmap.Bitmap

ToAbstractCPUs converts the machine CPU set into an abstract CPU Bitmap.

func (CPUMap) ToMachineCPUs

func (cpuMap CPUMap) ToMachineCPUs(absBitmap bitmap.Bitmap) cpuset.CPUSet

ToMachineCPUs converts the abstract CPU Bitmap into a machine CPU set.

type CoreType

type CoreType int

CoreType is an enum for the type of CPU core.

const (
	// CoreTypeUndefined is the default zero value.
	CoreTypeUndefined CoreType = iota
	// CoreTypeStandard is a standard CPU core.
	CoreTypeStandard
	// CoreTypePerformance is a performance core (p-core).
	CoreTypePerformance
	// CoreTypeEfficiency is an efficiency core (e-core).
	CoreTypeEfficiency
)

func (CoreType) String

func (c CoreType) String() string

String returns the string representation of a CoreType.

type GPUInfo

type GPUInfo struct {
	// Name of the GPU device
	Name string `json:"name"`

	// Index is the GPU Index
	Index int `json:"index"`
}

GPUInfo holds information about a single GPU.

func NewGPUInfos

func NewGPUInfos(ctx context.Context, rSlice *resourcev1.ResourceSlice) []*GPUInfo

type GPUMap

type GPUMap struct {
	// Driver indicates the Device Driver name.
	Driver string `json:"driver"`

	// GPUInfoMap stores the raw GPUInfos as a map,
	// where the index is the GPU index, and the value is the GPUInfo.
	GPUInfoMap map[int]*GPUInfo `json:"gpuInfoMap"`
}

func NewGPUMap

func NewGPUMap(driver string, gpuInfos []*GPUInfo) GPUMap

type NodeInfo

type NodeInfo struct {
	CpuMap CPUMap
	GpuMap GPUMap
}

Represents a Kubernetes node for Slurm.

func NewNodeInfo

func NewNodeInfo(ctx context.Context, kubeclient client.Client, nodeName string) (*NodeInfo, error)

func (*NodeInfo) GetDeviceRequestAllocationResult

func (n *NodeInfo) GetDeviceRequestAllocationResult(ctx context.Context, kubeclient client.Client, resources *slurmcontrol.NodeResources) ([]resourcev1.DeviceRequestAllocationResult, error)

func (*NodeInfo) GetDeviceRequests

func (n *NodeInfo) GetDeviceRequests(ctx context.Context, kubeclient client.Client, resources *slurmcontrol.NodeResources) ([]resourcev1.DeviceRequest, error)

func (*NodeInfo) GetGresAndGresConf

func (n *NodeInfo) GetGresAndGresConf() (gres, gresConf string)

GetGresAndGresConf returns Slurm GRES and GresConf strings for this node's devices. GRES and GresConf are derived from DRA ResourceSlices (e.g. GPU devices); CPU is not included. Returns ("", "") when the node has no GRES devices.

Jump to

Keyboard shortcuts

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