plugin

package
v0.0.0-...-91ab7b7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

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
	GetSharedDeviceResourceName() string
	GetUnixSocket() string
	ParseRealDeviceIDs(logger *zap.Logger, mortalDevicesIDs []string) map[string]int
	GetAllocatedDeviceSpecs(logger *zap.Logger, devUUIDs []string) []*pluginapi.DeviceSpec
	LookupSharedDevice(devUUID string) *sharecfg.SharedDevice
	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

Allocate implements Allocate device plugin API call.

func (*MetaGpuDevicePlugin) GetDevicePluginOptions

GetDevicePluginOptions implements GetDevicePluginOptions device plugin API call.

func (*MetaGpuDevicePlugin) GetPreferredAllocation

GetPreferredAllocation implements GetPreferredAllocation device plugin API call.

func (*MetaGpuDevicePlugin) ListAndWatch

ListAndWatch implements ListAndWatch device plugin API call.

func (*MetaGpuDevicePlugin) PreStartContainer

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.

func (*MetaGpuDevicePlugin) Stop

func (p *MetaGpuDevicePlugin) Stop()

Stop stops the plugin.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL