Documentation ¶
Index ¶
Constants ¶
View Source
const MB uint64 = 1024 * 1024
MB - 1 megabyte.
Variables ¶
Functions ¶
func IsManagedDevice ¶
func IsManagedDevice(devCfg *DeviceSharingConfig, devUuid, modelName string, migId int) bool
IsManagedDevice checks if the given device has sharing configuration.
Types ¶
type DeviceSharingConfig ¶
type DeviceSharingConfig struct { // Uuid - NVIDIA device UUID. Uuid []string `json:"uuid,omitempty" yaml:"uuid,omitempty"` // Model - human readable GPU model name // used for selecting GPUs to handle. // If Uuid is set, then Model is ignored. ModelName []string `json:"modelName,omitempty" yaml:"modelName,omitempty"` // Migid - MIG device id. Migid []int `json:"migid,omitempty" yaml:"migid,omitempty"` // ResourceName - Kubernetes resource name to handle. ResourceName string `json:"resourceName,omitempty" yaml:"resourceName,omitempty"` // MetagpusPerGpu - number of meta GPUs to split the GPU on. MetagpusPerGpu uint64 `json:"metagpusPerGpu,omitempty" yaml:"metagpusPerGpu,omitempty"` // MetagpusPerGpuMemoryChunkMB - GPU memory chunk size to // split the GPU to meta GPUs with the MetagpusPerGpuMemoryChunkMB // memory sizes. MetagpusPerGpuMemoryChunkMB uint64 `json:"metagpusPerGpuMemoryChunkMB,omitempty" yaml:"metagpusPerGpuMemoryChunkMB,omitempty"` //nolint:lll // Struct tags. // ReservedChunks - number of MortalGPU chunks which will be excluded from // allocation so that they can be used by other workloads. ReservedChunks uint64 `json:"reservedChunks,omitempty" yaml:"reservedChunks,omitempty"` }
func (*DeviceSharingConfig) ComputeSharesInfo ¶
func (d *DeviceSharingConfig) ComputeSharesInfo(totalMemory uint64) (SharesInfo, error)
ComputeSharesInfo computes shares info based on the sharing configuration and total device memory.
func (*DeviceSharingConfig) MarshalLogObject ¶
func (d *DeviceSharingConfig) MarshalLogObject(enc zapcore.ObjectEncoder) error
MarshalLogObject - implements zap.ObjectLogMarshaler.
type DevicesSharingConfigs ¶
type DevicesSharingConfigs struct { Configs []*DeviceSharingConfig // contains filtered or unexported fields }
func NewDeviceSharingConfig ¶
func NewDeviceSharingConfig(logger *zap.Logger, cfg []*DeviceSharingConfig) *DevicesSharingConfigs
func (*DevicesSharingConfigs) GetDeviceSharingConfig ¶
func (c *DevicesSharingConfigs) GetDeviceSharingConfig(devUuid, modelName string, migId int) (*DeviceSharingConfig, error)
type SharedDevice ¶
type SharedDevice struct { string `json:"uuid,omitempty" yaml:"uuid"` Index int `json:"index,omitempty" yaml:"index"` Shares SharesInfo `json:"shares,omitempty" yaml:"shares"` }UUID
SharedDevice a physical GPU (or a MIG partition) which is shared between containers.
func (*SharedDevice) ComputeMemFromShares ¶
func (sd *SharedDevice) ComputeMemFromShares(sharesCount int) uint64
ComputeMemFromShares returns how much GPU RAM is the given number of shares represent.
func (*SharedDevice) Copy ¶
func (sd *SharedDevice) Copy() *SharedDevice
Copy returns a copy of the data.
func (*SharedDevice) MarshalLogObject ¶
func (sd *SharedDevice) MarshalLogObject(enc zapcore.ObjectEncoder) error
MarshalLogObject - implements zap.ObjectLogMarshaler.
type SharesInfo ¶
SharesInfo contains information about how a GPU device is supposed to be split.
func (*SharesInfo) MarshalLogObject ¶
func (si *SharesInfo) MarshalLogObject(enc zapcore.ObjectEncoder) error
MarshalLogObject - implements zap.ObjectLogMarshaler.
Click to show internal directories.
Click to hide internal directories.