host

package
v2.0.0-beta.5 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: Apache-2.0 Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package host reads the facts a snapshot depends on from the machine: the GPUs (nvidia-smi), their topology, the driver and kernel, and holds an exclusive lease on the GPUs a run uses.

Index

Constants

This section is empty.

Variables

View Source
var SMI = "nvidia-smi"

SMI is the nvidia-smi executable.

Functions

func Busy

func Busy(ctx context.Context, gpus []GPU) (int, error)

Busy counts compute processes on the GPUs.

func CPUFlags

func CPUFlags() []string

CPUFlags are the first CPU's feature flags, sorted: a restored process may use any instruction the donor's CPU had.

func Describe

func Describe(gpus []GPU) string

Describe summarizes GPUs by model: "8× NVIDIA H100 80GB HBM3".

func IOUringDisabled

func IOUringDisabled() (int, error)

IOUringDisabled is kernel.io_uring_disabled; CRIU cannot dump io_uring, so a snapshot needs 2.

func Kernel

func Kernel() string

Kernel is uname -r.

func Leased

func Leased(dir string, g GPU) bool

Leased reports whether a warmctl run holds the GPU's lease in dir.

func MissingFlags

func MissingFlags(donor, here []string) []string

MissingFlags are the donor's CPU flags this host lacks.

func ParseIndices

func ParseIndices(spec string) ([]int, error)

ParseIndices reads "0-3,6".

func Processes

func Processes(ctx context.Context) (map[string]int, error)

Processes counts the compute processes on each GPU, by UUID.

func Topology

func Topology(ctx context.Context, gpus []GPU) (string, string, error)

Topology is the class of the links between the GPUs (nvlink or pcie) and a digest of nvidia-smi's matrix for the record.

func TopologyClass

func TopologyClass(matrix string, gpus []GPU) string

TopologyClass is nvlink when every pair of the selected GPUs is joined by NVLink, pcie otherwise; a single GPU is "single".

Types

type GPU

type GPU struct {
	Index     int    `json:"index"`
	UUID      string `json:"uuid"`
	Name      string `json:"name"`
	PCIBusID  string `json:"pci_bus_id"`
	MemoryMiB int64  `json:"memory_mib"`
	Driver    string `json:"driver"`
}

GPU is one device as nvidia-smi reports it.

func Inventory

func Inventory(ctx context.Context) ([]GPU, error)

Inventory lists every GPU of the host.

func ParseInventory

func ParseInventory(text string) ([]GPU, error)

ParseInventory reads nvidia-smi's CSV.

func Pick

func Pick(all []GPU, n int, name string, procs map[string]int, locks string) ([]GPU, error)

Pick chooses n GPUs named name, in PCI order, that run no compute process (procs, from Processes) and that no warmctl run leases in locks.

func Select

func Select(all []GPU, spec string) ([]GPU, error)

Select picks GPUs by index list ("0-3,6") or all when spec is empty, in PCI bus order: the order CUDA gives ranks with CUDA_DEVICE_ORDER=PCI_BUS_ID.

type Lease

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

Lease holds an exclusive flock per GPU for the life of a run.

func Acquire

func Acquire(dir string, gpus []GPU) (*Lease, error)

Acquire locks <dir>/gpu-<uuid>.lock for every GPU without waiting.

func (*Lease) Release

func (l *Lease) Release()

Release drops the locks.

Jump to

Keyboard shortcuts

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