Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Allocator ¶
type Allocator struct {
GPUs []*Device
// contains filtered or unexported fields
}
Allocator defines the primary object for allocating and freeing the available GPUs on a node.
func NewAllocator ¶
NewAllocator creates a new Allocator using the given allocation policy
func NewBestEffortAllocator ¶
NewBestEffortAllocator creates a new Allocator using the BestEffort allocation policy
func NewSimpleAllocator ¶
NewSimpleAllocator creates a new Allocator using the Simple allocation policy
func (*Allocator) Allocate ¶
Allocate a set of 'num' GPUs from the allocator. If 'num' devices cannot be allocated, return an empty slice.
func (*Allocator) AllocateSpecific ¶
AllocateSpecific allocates a specific set of GPUs from the allocator. Return an error if any of the specified devices cannot be allocated.
type Device ¶
Device represents a GPU device as reported by NVML, including all of its Point-to-Point link information.
func NewDevices ¶ added in v0.2.0
Create a list of Devices from all available nvml.Devices.
func NewDevicesFrom ¶ added in v0.2.0
Create a list of Devices from the specific set of GPU uuids passed in.
type DeviceSet ¶
DeviceSet is used to hold and manipulate a set of unique GPU devices.
func NewDeviceSet ¶
NewDeviceSet creates a new DeviceSet.
func (DeviceSet) ContainsAll ¶ added in v0.2.0
ContainsAll checks if a list of devices is present in a DeviceSet.
func (DeviceSet) SortedSlice ¶
SortedSlice etunrs returns a slice of devices, sorted by device index from a DeviceSet.
type GPUType ¶
type GPUType int
GPUType represents the valid set of GPU types a Static DGX policy can be created for.
type P2PLink ¶
type P2PLink struct {
GPU *Device
Type nvml.P2PLinkType
}
P2PLink represents a Point-to-Point link between two GPU devices. The link is between the Device struct this struct is embedded in and the GPU Device contained in the P2PLink struct itself.
type Policy ¶
type Policy interface {
// Allocate is meant to do the heavy-lifting of implementing the actual
// allocation strategy of the policy. It takes a slice of devices to
// allocate GPUs from, and an amount 'size' to allocate from that slice. It
// then returns a subset of devices of length 'size'. If the policy is
// unable to allocate 'size' GPUs from the slice of input devices, it
// returns an empty slice.
Allocate(available []*Device, required []*Device, size int) []*Device
}
Policy defines an interface for plugagable allocation policies to be added to an Allocator.
func NewBestEffortPolicy ¶
func NewBestEffortPolicy() Policy
NewBestEffortPolicy creates a new BestEffortPolicy.
func NewStaticDGX1Policy ¶
NewStaticDGX1Policy creates a new StaticDGX1Policy for gpuType.
func NewStaticDGX2Policy ¶
func NewStaticDGX2Policy() Policy
NewStaticDGX2Policy creates a new StaticDGX2Policy.