gpu

package
v1.10.26 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package gpu inventories node GPUs over the Docker API, so the node agent needs no changes.

Index

Constants

This section is empty.

Variables

View Source
var ErrDeviceNotOnNode = errors.New("gpu device does not belong to this node")
View Source
var ErrGPUDisabled = errors.New("GPU support is disabled on this platform")

Functions

This section is empty.

Types

type Config

type Config struct {
	Enabled       bool
	NvidiaRuntime string // container runtime name that signals the NVIDIA toolkit
	ProbeImage    string // one-shot image the inventory probe runs nvidia-smi in
}

Config carries the GPU knobs from the platform config.

type NoDeviceError

type NoDeviceError struct {
	Node      string
	Kind      string
	Requested int
	Available int
}

NoDeviceError names the node and requested kind so the deploy log is actionable.

func (*NoDeviceError) Code

func (e *NoDeviceError) Code() string

func (*NoDeviceError) Error

func (e *NoDeviceError) Error() string

type NodeDocker

type NodeDocker interface {
	For(serverID uint) (docker.Client, error)
	LocalID() uint
}

type Service

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

func NewService

NewService builds the GPU service. quota is wired separately via SetQuota.

func (*Service) Devices

func (s *Service) Devices(serverID uint) ([]models.GPUDevice, error)

Devices lists every discovered device on a node (enabled or not).

func (*Service) Enabled

func (s *Service) Enabled() bool

Enabled reports whether GPU support is switched on.

func (*Service) Inventory

func (s *Service) Inventory(ctx context.Context) error

A per-node probe failure must never fail the whole sweep.

func (*Service) InventoryNode

func (s *Service) InventoryNode(ctx context.Context, serverID uint) (int, error)

Most nodes have no GPU, so a missing runtime or failed probe yields zero devices, not an error; new devices arrive disabled.

func (*Service) NodeCapable

func (s *Service) NodeCapable(ctx context.Context, serverID uint) bool

Lets the admin UI explain a node with no listed GPUs.

func (*Service) Preflight

func (s *Service) Preflight(app *models.Application) error

func (*Service) ResolveDevices

func (s *Service) ResolveDevices(ctx context.Context, app *models.Application, runtimes []string) ([]docker.GPURequest, error)

A node without the NVIDIA runtime is refused up front rather than failing cryptically at container start.

func (*Service) SetDevice

func (s *Service) SetDevice(serverID, gpuID uint, enabled, shared *bool) (*models.GPUDevice, error)

func (*Service) SetQuota

func (s *Service) SetQuota(q *quota.Service)

nil skips capability and quota checks, matching the single-tenant no-gating stance.

Jump to

Keyboard shortcuts

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