Documentation ¶
Index ¶
- type DeviceManager
- type DevicePluginMount
- type MetaGpuDevicePlugin
- func (p *MetaGpuDevicePlugin) Allocate(_ctx context.Context, request *pluginapi.AllocateRequest) (*pluginapi.AllocateResponse, error)
- func (*MetaGpuDevicePlugin) GetDevicePluginOptions(context.Context, *pluginapi.Empty) (*pluginapi.DevicePluginOptions, error)
- func (p *MetaGpuDevicePlugin) GetPreferredAllocation(_ context.Context, request *pluginapi.PreferredAllocationRequest) (*pluginapi.PreferredAllocationResponse, error)
- func (p *MetaGpuDevicePlugin) ListAndWatch(_e *pluginapi.Empty, srv pluginapi.DevicePlugin_ListAndWatchServer) error
- func (*MetaGpuDevicePlugin) PreStartContainer(context.Context, *pluginapi.PreStartContainerRequest) (*pluginapi.PreStartContainerResponse, error)
- func (p *MetaGpuDevicePlugin) Register(logger *zap.Logger) error
- func (p *MetaGpuDevicePlugin) Serve(log *zap.Logger) error
- func (p *MetaGpuDevicePlugin) Start()
- func (p *MetaGpuDevicePlugin) Stop()
- type NvidiaDeviceManager
- func (m *NvidiaDeviceManager) CacheDevices(logger *zap.Logger)
- func (m *NvidiaDeviceManager) DeviceExists(physDeviceUUID string) bool
- func (m *NvidiaDeviceManager) GetAllocatedDeviceSpecs(logger *zap.Logger, devUUIDs []string) []*pluginapi.DeviceSpec
- func (m *NvidiaDeviceManager) GetPluginDevices(logger *zap.Logger) []*pluginapi.Device
- func (m *NvidiaDeviceManager) GetSharedDeviceResourceName() string
- func (m *NvidiaDeviceManager) GetUnixSocket() string
- func (m *NvidiaDeviceManager) LookupSharedDevice(devUUID string) *sharecfg.SharedDevice
- func (m *NvidiaDeviceManager) MetagpuAllocation(logger *zap.Logger, allocationSize int, availableMortalGPUIDs []string) ([]string, error)
- func (m *NvidiaDeviceManager) ParseRealDeviceIDs(logger *zap.Logger, mortalDevicesIDs []string) map[string]int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DeviceManager ¶
type DeviceManager interface { GetPluginDevices(logger *zap.Logger) []*pluginapi.Device GetUnixSocket() string ParseRealDeviceIDs(logger *zap.Logger, mortalDevicesIDs []string) map[string]int GetAllocatedDeviceSpecs(logger *zap.Logger, devUUIDs []string) []*pluginapi.DeviceSpec MetagpuAllocation(logger *zap.Logger, allocationSize int, availableDevIDs []string) ([]string, error) }
DeviceManager main interface of device plugin.
type DevicePluginMount ¶
type DevicePluginMount struct { HostPath string `json:"hostPath,omitempty" yaml:"hostPath,omitempty"` MountPath string `json:"mountPath,omitempty" yaml:"mountPath,omitempty"` }
DevicePluginMount for mounting host files.
type MetaGpuDevicePlugin ¶
type MetaGpuDevicePlugin struct { DeviceManager // contains filtered or unexported fields }
MetaGpuDevicePlugin device plugin implementation.
func NewMetaGpuDevicePlugin ¶
func NewMetaGpuDevicePlugin(logger *zap.Logger, containerToken string, pluginMounts []*DevicePluginMount, deviceSpecsEnable bool, metaGpuRecalculation chan bool, deviceMgr DeviceManager, ) *MetaGpuDevicePlugin
NewMetaGpuDevicePlugin constructor for the plugin.
func (*MetaGpuDevicePlugin) Allocate ¶
func (p *MetaGpuDevicePlugin) Allocate( _ctx context.Context, request *pluginapi.AllocateRequest, ) (*pluginapi.AllocateResponse, error)
Allocate implements Allocate device plugin API call.
func (*MetaGpuDevicePlugin) GetDevicePluginOptions ¶
func (*MetaGpuDevicePlugin) GetDevicePluginOptions(context.Context, *pluginapi.Empty, ) (*pluginapi.DevicePluginOptions, error)
GetDevicePluginOptions implements GetDevicePluginOptions device plugin API call.
func (*MetaGpuDevicePlugin) GetPreferredAllocation ¶
func (p *MetaGpuDevicePlugin) GetPreferredAllocation(_ context.Context, request *pluginapi.PreferredAllocationRequest, ) (*pluginapi.PreferredAllocationResponse, error)
GetPreferredAllocation implements GetPreferredAllocation device plugin API call.
func (*MetaGpuDevicePlugin) ListAndWatch ¶
func (p *MetaGpuDevicePlugin) ListAndWatch(_e *pluginapi.Empty, srv pluginapi.DevicePlugin_ListAndWatchServer) error
ListAndWatch implements ListAndWatch device plugin API call.
func (*MetaGpuDevicePlugin) PreStartContainer ¶
func (*MetaGpuDevicePlugin) PreStartContainer(context.Context, *pluginapi.PreStartContainerRequest, ) (*pluginapi.PreStartContainerResponse, error)
PreStartContainer stub for deviceplugin API hook.
func (*MetaGpuDevicePlugin) Register ¶
func (p *MetaGpuDevicePlugin) Register(logger *zap.Logger) error
Register implements Register device plugin API call.
func (*MetaGpuDevicePlugin) Serve ¶
func (p *MetaGpuDevicePlugin) Serve(log *zap.Logger) error
Serve starts GRPC server to handle deviceplugin API calls.
func (*MetaGpuDevicePlugin) Start ¶
func (p *MetaGpuDevicePlugin) Start()
Start starts internal plugin loops.
type NvidiaDeviceManager ¶
type NvidiaDeviceManager struct {
// contains filtered or unexported fields
}
NvidiaDeviceManager GPU manager.
func NewNvidiaDeviceManager ¶
func NewNvidiaDeviceManager(logger *zap.Logger, cacheTTL time.Duration, shareCfg *sharecfg.DeviceSharingConfig, allocator types.Allocator, ) (*NvidiaDeviceManager, error)
NewNvidiaDeviceManager creates a new instance of the device manager.
func (*NvidiaDeviceManager) CacheDevices ¶
func (m *NvidiaDeviceManager) CacheDevices(logger *zap.Logger)
CacheDevices starts a loop which retrieves available physical GPUs and populates local cache.
func (*NvidiaDeviceManager) DeviceExists ¶
func (m *NvidiaDeviceManager) DeviceExists(physDeviceUUID string) bool
DeviceExists checks if the given UUID is in shared devices.
func (*NvidiaDeviceManager) GetAllocatedDeviceSpecs ¶
func (m *NvidiaDeviceManager) GetAllocatedDeviceSpecs( logger *zap.Logger, devUUIDs []string, ) []*pluginapi.DeviceSpec
GetAllocatedDeviceSpecs return the list of pluginapi.DeviceSpec matching Nvidia Container Toolkit mounts
func (*NvidiaDeviceManager) GetPluginDevices ¶
func (m *NvidiaDeviceManager) GetPluginDevices(logger *zap.Logger) []*pluginapi.Device
GetPluginDevices implements device plugin API GetPluginDevices.
func (*NvidiaDeviceManager) GetSharedDeviceResourceName ¶
func (m *NvidiaDeviceManager) GetSharedDeviceResourceName() string
GetSharedDeviceResourceName returns a shared container resource name.
func (*NvidiaDeviceManager) GetUnixSocket ¶
func (m *NvidiaDeviceManager) GetUnixSocket() string
GetUnixSocket create a predictable and unique name for UNIX socket for device registration.
func (*NvidiaDeviceManager) LookupSharedDevice ¶
func (m *NvidiaDeviceManager) LookupSharedDevice(devUUID string) *sharecfg.SharedDevice
LookupSharedDevice returns a copy of a shared device, if found. nil otherwise.
func (*NvidiaDeviceManager) MetagpuAllocation ¶
func (m *NvidiaDeviceManager) MetagpuAllocation(logger *zap.Logger, allocationSize int, availableMortalGPUIDs []string, ) ([]string, error)
MetagpuAllocation performs devices allocation to fulfill request from the available devices. usedPreAllocsDevIDs is a bring-your-own state storage to keep track of device allocations performed by previous calls of the MetagpuAllocation during processing of the same ContainerPreferredAllocationRequest.
func (*NvidiaDeviceManager) ParseRealDeviceIDs ¶
func (m *NvidiaDeviceManager) ParseRealDeviceIDs( logger *zap.Logger, mortalDevicesIDs []string, ) map[string]int
ParseRealDeviceIDs extracts physical GPU UUIDs from mortalDevicesIDs. Returns a map where key - GPU UUID, value - how many MortalGPUs from mortalDevicesIDs belong to the GPU.