nodeinfo

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: Apache-2.0 Imports: 26 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 (
	// DraDriverCpu_NUMANodeID identifies the NUMA node of a NUMA-grouped device.
	DraDriverCpu_NUMANodeID resourcev1.QualifiedName = "dra.cpu/numaNodeID"
	DraDriverCpu_CPUIDs     resourcev1.QualifiedName = "dra.cpu/cpuIDs"
	DraDriverCpu_SMTLayout  resourcev1.QualifiedName = "dra.cpu/smtLayout"
	DraDriverCpu_SMTEnabled resourcev1.QualifiedName = "dra.cpu/smtEnabled"
	DraDriverCpu_Capacity   resourcev1.QualifiedName = "dra.cpu/cpu"
)
View Source
const DraDriverCpu = "dra.cpu"

Variables

This section is empty.

Functions

This section is empty.

Types

type CPUAllocation added in v1.3.0

type CPUAllocation struct {
	Requests []resourcev1.DeviceRequest
	Results  []resourcev1.DeviceRequestAllocationResult
	Config   []resourcev1.DeviceClaimConfiguration
	CPUCount int64
}

CPUAllocation holds claim spec and status data from one verified topology snapshot. CPUCount counts Linux CPUs; each result represents one socket share.

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"`

	// NUMANodeID identifies the Slurm socket for NUMA-grouped inventory.
	// SocketID retains the physical package for topology validation.
	NUMANodeID *int `json:"numaNodeID,omitempty"`

	// 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, error)

NewCPUInfos expands socket or NUMA node devices into allocatable CPUs. Each core is identified by its lowest allocatable Linux CPU ID.

type CPUMap

type CPUMap struct {
	// Pool is the DRA ResourceSlice pool name for these CPUs.
	Pool string `json:"pool"`

	// 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(pool string, 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 CPUTopologyCache added in v1.3.0

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

CPUTopologyCache derives immutable CPU topology once per node inventory change. It retains only CPU informer references and one derived snapshot per queried node. Allocation results and DeviceClass decisions are never cached.

func NewCPUTopologyCache added in v1.3.0

func NewCPUTopologyCache(informer cpuSliceInformer) (*CPUTopologyCache, error)

func (*CPUTopologyCache) AllocateCPUs added in v1.3.0

func (c *CPUTopologyCache) AllocateCPUs(ctx context.Context, reader client.Client, node string, resources *slurmcontrol.NodeResources, className, allocationKey string) (*CPUAllocation, error)

func (*CPUTopologyCache) OnAdd added in v1.3.0

func (c *CPUTopologyCache) OnAdd(obj any, _ bool)

func (*CPUTopologyCache) OnDelete added in v1.3.0

func (c *CPUTopologyCache) OnDelete(obj any)

func (*CPUTopologyCache) OnUpdate added in v1.3.0

func (c *CPUTopologyCache) OnUpdate(_, obj any)

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 NodeInfo

type NodeInfo struct {
	CpuMap CPUMap
	// CPUDevices holds the socket or NUMA node devices by name.
	CPUDevices map[string]resourcev1.Device
}

Represents a Kubernetes node for Slurm.

func NewNodeInfo

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

func NewNodeInfoFromResourceSlices added in v1.3.0

func NewNodeInfoFromResourceSlices(nodeName string, resourceSlices []resourcev1.ResourceSlice) (*NodeInfo, error)

NewNodeInfoFromResourceSlices builds CPU topology from an existing ResourceSlice snapshot.

func (*NodeInfo) AllocateCPUs added in v1.3.0

func (n *NodeInfo) AllocateCPUs(ctx context.Context, kubeclient client.Client, resources *slurmcontrol.NodeResources, className, allocationKey string) (*CPUAllocation, error)

func (*NodeInfo) EncodeApplied added in v1.3.0

func (n *NodeInfo) EncodeApplied(extra string) (string, error)

EncodeApplied adds the CPU fingerprint to the GRES inventory in Extra.

func (*NodeInfo) Geometry added in v1.3.0

func (n *NodeInfo) Geometry() (sockets, coresPerSocket, threadsPerCore int, err error)

Geometry returns socket, core, and thread counts after excluding reserved CPUs. NUMA-grouped devices are Slurm sockets, including domains sharing a package. Sockets must have equal core counts, and cores must have equal thread counts.

func (*NodeInfo) NUMACores added in v1.3.0

func (n *NodeInfo) NUMACores() map[int][]int

NUMACores returns the Slurm cores of each NUMA node, or nil unless the CPU inventory is grouped by NUMA node. Each NUMA domain is a whole Slurm socket.

func (*NodeInfo) ValidateCPUFingerprint added in v1.3.0

func (n *NodeInfo) ValidateCPUFingerprint(extra string) error

ValidateCPUFingerprint checks that this topology matches Slurm's registration. Use the same NodeInfo to translate the allocation bitmap.

Jump to

Keyboard shortcuts

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