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 (*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.
type DeviceList ¶
type DeviceList []*Device
DeviceList stores an ordered list of devices.
func NewDevices ¶
func NewDevices(opts ...Option) (DeviceList, error)
NewDevices creates a list of Devices from all available nvml.Devices using the specified options.
func NewDevicesFrom ¶
func NewDevicesFrom(uuids []string) (DeviceList, error)
NewDevicesFrom creates a list of Devices from the specific set of GPU uuids passed in.
func (DeviceList) AddLink ¶
func (d DeviceList) AddLink(from, to int, linkType links.P2PLinkType)
func (DeviceList) Devices ¶ added in v0.4.0
func (d DeviceList) Devices() []*Device
func (DeviceList) Filter ¶
func (d DeviceList) Filter(uuids []string) (DeviceList, error)
Filter filters out the selected devices from the list. Note that the specified uuids must exist in the list of devices.
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 ¶
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 Option ¶
type Option func(*deviceListBuilder)
Option defines a type for functional options for constructing device lists.
func WithDeviceLib ¶
WithDeviceLib provides an option to set the library used for device enumeration.
func WithNvmlLib ¶
WithNvmlLib provides an option to set the nvml library.
type P2PLink ¶
type P2PLink struct {
GPU *Device
Type links.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 pluggable allocation policies to be added to an Allocator.
func NewBestEffortPolicy ¶
func NewBestEffortPolicy() Policy
NewBestEffortPolicy creates a new BestEffortPolicy.