Documentation
¶
Index ¶
- Constants
- type CPUAllocation
- type CPUInfo
- type CPUMap
- type CPUTopologyCache
- type CoreType
- type NodeInfo
- func (n *NodeInfo) AllocateCPUs(ctx context.Context, kubeclient client.Client, ...) (*CPUAllocation, error)
- func (n *NodeInfo) EncodeApplied(extra string) (string, error)
- func (n *NodeInfo) Geometry() (sockets, coresPerSocket, threadsPerCore int, err error)
- func (n *NodeInfo) NUMACores() map[int][]int
- func (n *NodeInfo) ValidateCPUFingerprint(extra string) error
Constants ¶
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
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" )
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 (CPUMap) GetOnesBitmap ¶
GetOnesBitmap returns a bitmap with all available bits set to one.
func (CPUMap) ToAbstractCPUs ¶
ToAbstractCPUs converts the machine CPU set into an abstract CPU Bitmap.
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 )
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 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
EncodeApplied adds the CPU fingerprint to the GRES inventory in Extra.
func (*NodeInfo) Geometry ¶ added in v1.3.0
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
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
ValidateCPUFingerprint checks that this topology matches Slurm's registration. Use the same NodeInfo to translate the allocation bitmap.