Documentation
¶
Overview ¶
Package snapshot bakes a snapshot: it starts the engine in a donor container, warms it up, records a canary, exports the weights pool, puts the engine to sleep, checkpoints CUDA, dumps the process tree with CRIU, archives the trees it wrote and publishes everything with one manifest.
Index ¶
- Constants
- Variables
- func AgentConfig(state string) agent.Config
- func Compress(ctx context.Context, src, dst string) (manifest.Manifest, error)
- func Describe(m manifest.Manifest) string
- func Hardware(table profile.HardwareTable, gpus []host.GPU, ranks int) (profile.Hardware, error)
- func Publish(ctx context.Context, s store.Store, sources []source, output string, ...) ([]manifest.File, error)
- func Run(ctx context.Context, o Options) (manifest.Manifest, error)
- func ServedName(options map[string]any) (string, error)
- func Surviving(exported []manifest.Allocation, table []vllm.Allocation) ([]manifest.Allocation, int)
- func Tools(work, criuPath, helperPath string) (agent.Config, error)
- type Options
Constants ¶
const DriverCheckEnv = "__RM_NO_VERSION_CHECK"
DriverCheckEnv is set in the engine at build time: it makes the NVIDIA driver skip its client/kernel version comparison. libcuda remembers the kernel module version it met at init and presents it again when cuda-checkpoint restores, so without it a snapshot restores only under the exact driver it was built on. With it, a restore under another release of the same branch works; another branch is still refused by the kernel module.
const EngineAddr = "127.0.0.1:8000"
EngineAddr is where the engine listens inside its container.
const EngineLog = guestWorkspace + "/logs/engine.log"
EngineLog is the engine's log file, in a tree the snapshot carries: a restored engine keeps writing it.
Variables ¶
var PeerOff = []string{
"vllm.disable-custom-all-reduce=true",
"env.NCCL_P2P_DISABLE=1",
"env.VLLM_ALLREDUCE_USE_FLASHINFER_PCIE_IPC=0",
"env.VLLM_ALLREDUCE_USE_SYMM_MEM=0",
}
PeerOff keeps an engine's collectives off the GPUs' peer path: vLLM's custom all-reduce and its FlashInfer and symmetric-memory all-reduces map the other ranks' memory through CUDA IPC, and NCCL_P2P_DISABLE reaches only NCCL, which then goes through shared host memory.
Functions ¶
func AgentConfig ¶
AgentConfig is what every agent needs, its sockets in state: the image's CRIU and cuda-checkpoint, the engine's address and the trees.
func Compress ¶
Compress writes a copy of the snapshot in src to dst with its process images, runtime trees and weights stored as zstd frames, as a build with --compress would have: the same snapshot in fewer bytes, for network storage. src keeps its files as they are, so it can still be pushed.
func Hardware ¶
Hardware finds the hardware row of the selected GPUs: all of one model, as many as the profile has ranks.
func Publish ¶
func Publish(ctx context.Context, s store.Store, sources []source, output string, workers int) ([]manifest.File, error)
Publish stores and links every source with up to workers files at once and returns the manifest's file list, sorted by path.
func ServedName ¶
ServedName is the first served model name of a launch.
func Surviving ¶
func Surviving(exported []manifest.Allocation, table []vllm.Allocation) ([]manifest.Allocation, int)
Surviving keeps the exported allocations the asleep table still has, renumbered, and reports how many went.
Types ¶
type Options ¶
type Options struct {
Profile string
ProfileDirs []string
ModelDir string
GPUs string
Output string
ID string
StateDir string
DockerSocket string
CRIU string
CUDACheckpoint string
// CUDABackend is the agent's cuda.Select mode: auto, driver or cli.
CUDABackend string
// Cuinterpose is a cuInterpose build directory, for profiles whose ipc
// is not native; default: cuinterpose/ next to this executable.
Cuinterpose string
Set []string
NoVerify bool
PartBytes int64
Threads int
ReadyTimeout time.Duration
// CPUTest runs without GPU devices or the io_uring check: the
// end-to-end test on a CPU host with a stand-in engine.
CPUTest bool
Version string
Progress *run.Progress
// InPlace bakes in this container, without Docker: the engine runs as a
// child of the agent, itself a child of this process, and sees real
// paths (docs/dmtcp.md).
InPlace bool
// Backend snapshots the process tree in place: auto, criu or dmtcp. A
// donor container always runs CRIU.
Backend string
// Compress stores the process images, runtime trees and weights in Output
// as zstd frames, for a snapshot restored from network storage: about
// 2.8x fewer bytes of images and 1.45x of BF16 weights to read, decoded
// in parallel as up stages its copy.
Compress bool
DMTCP dmtcp.Tools
}
Options of one bake.