Documentation
¶
Overview ¶
Package gpuallocator handles GPU allocation
Index ¶
- func IsQuotaError(err error) bool
- func RefreshGPUNodeCapacity(ctx context.Context, k8sClient client.Client, node *tfv1.GPUNode, ...) ([]string, error)
- type AllocRequest
- type CompactFirst
- type GpuAllocator
- func (s *GpuAllocator) Alloc(ctx context.Context, req AllocRequest) ([]*tfv1.GPU, error)
- func (s *GpuAllocator) Dealloc(ctx context.Context, workloadNameNamespace tfv1.NameNamespace, ...)
- func (s *GpuAllocator) SetupWithManager(ctx context.Context, mgr manager.Manager) (<-chan struct{}, error)
- func (s *GpuAllocator) Stop()
- type LowLoadFirst
- type QuotaExceededError
- type QuotaStore
- type QuotaStoreEntry
- type Strategy
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsQuotaError ¶ added in v1.34.6
IsQuotaError checks if the error is a quota-related error
Types ¶
type AllocRequest ¶ added in v1.34.0
type AllocRequest struct { // Name of the GPU pool to allocate from PoolName string // Namespace information for the workload WorkloadNameNamespace tfv1.NameNamespace // Resource requirements for the allocation Request tfv1.Resource // Number of GPUs to allocate Count uint // Specific GPU model to allocate, empty string means any model GPUModel string // Node affinity requirements NodeAffinity *v1.NodeAffinity }
AllocRequest encapsulates all parameters needed for GPU allocation
type CompactFirst ¶
type CompactFirst struct{}
CompactFirst selects GPU with minimum available resources (most utilized) to efficiently pack workloads and maximize GPU utilization
func (CompactFirst) SelectGPUs ¶
SelectGPUs selects multiple GPUs from the same node with the least available resources (most packed)
type GpuAllocator ¶
func NewGpuAllocator ¶
func (*GpuAllocator) Alloc ¶
func (s *GpuAllocator) Alloc(ctx context.Context, req AllocRequest) ([]*tfv1.GPU, error)
Alloc allocates a request to a gpu or multiple gpus from the same node.
func (*GpuAllocator) Dealloc ¶
func (s *GpuAllocator) Dealloc(ctx context.Context, workloadNameNamespace tfv1.NameNamespace, request tfv1.Resource, gpus []types.NamespacedName)
Dealloc a request from gpu to release available resources on it.
func (*GpuAllocator) SetupWithManager ¶
func (s *GpuAllocator) SetupWithManager(ctx context.Context, mgr manager.Manager) (<-chan struct{}, error)
SetupWithManager sets up the GpuAllocator with the Manager.
type LowLoadFirst ¶
type LowLoadFirst struct{}
LowLoadFirst selects GPU with maximum available resources (least utilized) to distribute workloads more evenly across GPUs
func (LowLoadFirst) SelectGPUs ¶
SelectGPUs selects multiple GPUs from the same node with the most available resources (least loaded)
type QuotaExceededError ¶ added in v1.34.6
type QuotaExceededError struct { Namespace string Resource string Requested resource.Quantity Available resource.Quantity Limit resource.Quantity }
QuotaExceededError represents a quota exceeded error with detailed information
func (*QuotaExceededError) Error ¶ added in v1.34.6
func (e *QuotaExceededError) Error() string
type QuotaStore ¶ added in v1.34.6
QuotaStore manages GPU resource quotas in memory for atomic operations
func NewQuotaStore ¶ added in v1.34.6
func NewQuotaStore(client client.Client) *QuotaStore
NewQuotaStore creates a new quota store
func (*QuotaStore) AllocateQuota ¶ added in v1.34.6
func (qs *QuotaStore) AllocateQuota(namespace string, req AllocRequest)
AllocateQuota atomically allocates quota resources This function is called under GPU allocator's storeMutex
func (*QuotaStore) DeallocateQuota ¶ added in v1.34.6
func (qs *QuotaStore) DeallocateQuota(namespace string, request tfv1.Resource, replicas int32)
DeallocateQuota atomically deallocates quota resources This function is called under GPU allocator's storeMutex
func (*QuotaStore) GetQuotaStatus ¶ added in v1.34.6
func (qs *QuotaStore) GetQuotaStatus(namespace string) (*tfv1.GPUResourceUsage, *tfv1.GPUResourceUsage, bool)
GetQuotaStatus returns current quota status for a namespace
type QuotaStoreEntry ¶ added in v1.34.6
type QuotaStoreEntry struct {
// contains filtered or unexported fields
}
QuotaStoreEntry represents quota information in memory