Discovery reports a card in MIG mode as its instances instead of the whole card, on both paths: nvidia-smi (-L names them, -q -x gives their memory, ids and processes) and NVML (GetMigMode, GetMaxMigDeviceCount, GetMigDeviceHandleByIndex, behind an interface so it is tested with a fake). Each instance has its MIG UUID, its own memory, and a class from the card's and the profile: a100-80g-mig-3g.40gb. Placement numbers instances 1000 + 100 x card + instance and every view shows them as card/migN. A replica on MIG runs on exactly one instance: a process opens one MIG device and instances have no NVLink between them, so tp, pp, gpus or nodes above one on a MIG class are refused in catalog validation and again in placement, and the planner offers one instance or none. The agent gives the engine CUDA_VISIBLE_DEVICES=MIG-<uuid> (no Vulkan device variable on MIG). Memory and processes are per instance; heat, power and wear the card's; utilisation is left out rather than reported as zero. A card in MIG mode with nothing carved stays out of placement with the reason, and llmgw doctor reports each card's mode and instances and warns of the states in which nothing can run. ctl nodes, ctl status, the console and the plan count devices by class. docs/install.md has a MIG section. Written against fakes of nvidia-smi and NVML output; not yet run on MIG hardware. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
39 lines
1.5 KiB
Go
39 lines
1.5 KiB
Go
package catalog
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestAProfileOnAMIGClassRunsOnExactlyOneInstance(t *testing.T) {
|
|
// One instance, by default or said outright, is a profile like any other.
|
|
for _, p := range []Profile{
|
|
{Name: "vllm", Engine: "vllm", GPUClass: "a100-80g-mig-3g.40gb"},
|
|
{Name: "llama", Engine: "llamacpp", GPUClass: "a100-80g-mig-3g.40gb", GPUsPerNode: 1, TP: 1},
|
|
} {
|
|
c, err := New([]Model{model("m", p)})
|
|
if err != nil {
|
|
t.Fatalf("%s on one MIG instance: %v", p.Name, err)
|
|
}
|
|
m, _ := c.Resolve("m")
|
|
if pl := m.PlacementProfiles()[0]; pl.GPUsPerNode != 1 || pl.Nodes != 1 {
|
|
t.Errorf("%s: placement asked for %+v", p.Name, pl)
|
|
}
|
|
}
|
|
// More than one is refused where the model is defined: a process opens
|
|
// one MIG device, and instances have no NVLink between them, so the
|
|
// replica would be placed and then fail at start.
|
|
for _, p := range []Profile{
|
|
{Name: "tp2", Engine: "vllm", GPUClass: "a100-80g-mig-3g.40gb", TP: 2},
|
|
{Name: "pp2", Engine: "vllm", GPUClass: "a100-80g-mig-3g.40gb", TP: 1, PP: 2, GPUsPerNode: 2},
|
|
{Name: "nodes", Engine: "vllm", GPUClass: "a100-80g-mig-3g.40gb", TP: 2, Nodes: 2, GPUsPerNode: 1},
|
|
{Name: "layers", Engine: "llamacpp", GPUClass: "a100-80g-mig-3g.40gb", GPUsPerNode: 2},
|
|
{Name: "old-tp", Engine: "llamacpp", GPUClass: "a100-80g-mig-3g.40gb", TP: 2},
|
|
} {
|
|
_, err := New([]Model{model("m", p)})
|
|
if err == nil || !strings.Contains(err.Error(), "MIG instance") {
|
|
t.Errorf("%s: %v", p.Name, err)
|
|
}
|
|
}
|
|
}
|