gpuconfig

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client manages the NVIDIA GPU Device Plugin configuration in a Kubernetes cluster.

func NewClient

func NewClient(
	k8sClient k8s.Client,
	configMapName string,
	configMapNamespace string,
	defaultConfigName string,
) *Client

NewClient returns a new Client.

func (*Client) CreateOrUpdateConfigMap

func (c *Client) CreateOrUpdateConfigMap(ctx context.Context, dpconfig *Config) error

CreateOrUpdateConfigMap creates or updates the ConfigMap for the NVIDIA GPU Device Plugin configuration.

func (*Client) DeleteConfigMapIfExists

func (c *Client) DeleteConfigMapIfExists(ctx context.Context) error

DeleteConfigMapIfExists deletes the ConfigMap for the NVIDIA GPU Device Plugin configuration if it exists.

type CommandLineFlags

type CommandLineFlags struct {
	MigStrategy             *string `yaml:"migStrategy"`
	FailOnInitError         *bool   `yaml:"failOnInitError,omitempty"`
	MpsRoot                 *string `yaml:"mpsRoot,omitempty"`
	NvidiaDriverRoot        *string `yaml:"nvidiaDriverRoot,omitempty"`
	NvidiaDevRoot           *string `yaml:"nvidiaDevRoot,omitempty"`
	GDSEnabled              *bool   `yaml:"gdsEnabled,omitempty"`
	MOFEDEnabled            *bool   `yaml:"mofedEnabled,omitempty"`
	UseNodeFeatureAPI       *bool   `yaml:"useNodeFeatureAPI,omitempty"`
	DeviceDiscoveryStrategy *string `yaml:"deviceDiscoveryStrategy,omitempty"`
}

CommandLineFlags holds the list of command line flags used to configure the device plugin and GFD.

type Config

type Config struct {
	Version string  `yaml:"version"`
	Flags   Flags   `yaml:"flags,omitempty"`
	Sharing Sharing `yaml:"sharing,omitempty"`
}

Config is a versioned struct used to hold configuration information.

func CreateTimeSlicingDevicePluginConfig

func CreateTimeSlicingDevicePluginConfig(gpus int) *Config

CreateTimeSlicingDevicePluginConfig returns a v1.Config that configures the NVIDIA GPU device plugin for time slicing.

Link: https://docs.nvidia.com/datacenter/cloud-native/gpu-operator/latest/gpu-sharing.html

type Flags

type Flags struct {
	CommandLineFlags
}

Flags contains the command line flags used.

type ReplicatedDeviceRef

type ReplicatedDeviceRef string

ReplicatedDeviceRef can either be a full GPU index, a MIG index, or a UUID (full GPU or MIG)

type ReplicatedDevices

type ReplicatedDevices struct {
	All   bool
	Count int
	List  []ReplicatedDeviceRef
}

ReplicatedDevices encapsulates the set of devices that should be replicated for a given resource. This struct should be treated as a 'union' and only one of the fields in this struct should be set at any given time.

type ReplicatedResource

type ReplicatedResource struct {
	Name     ResourceName      `yaml:"name"`
	Rename   ResourceName      `yaml:"rename,omitempty"`
	Devices  ReplicatedDevices `yaml:"devices,flow,omitempty"`
	Replicas int               `yaml:"replicas"`
}

ReplicatedResource represents a resource to be replicated.

type ReplicatedResources

type ReplicatedResources struct {
	RenameByDefault            bool                 `yaml:"renameByDefault,omitempty"`
	FailRequestsGreaterThanOne bool                 `yaml:"failRequestsGreaterThanOne,omitempty"`
	Resources                  []ReplicatedResource `yaml:"resources,omitempty"`
}

ReplicatedResources defines generic options for replicating devices.

type ResourceName

type ResourceName string

ResourceName represents a valid resource name in Kubernetes

type Sharing

type Sharing struct {
	// TimeSlicing defines the set of replicas to be made for timeSlicing available resources.
	TimeSlicing ReplicatedResources `yaml:"timeSlicing,omitempty"`
	// MPS defines the set of replicas to be shared using MPS
	MPS *ReplicatedResources `yaml:"mps,omitempty"`
}

Sharing encapsulates the set of sharing strategies that are supported.

Jump to

Keyboard shortcuts

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