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>
37 lines
1.5 KiB
Go
37 lines
1.5 KiB
Go
package fleetmetrics
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
"time"
|
|
|
|
"gitea.mynodes.xyz/ilker/llmgw/internal/agent/discovery"
|
|
"gitea.mynodes.xyz/ilker/llmgw/internal/control/inventory"
|
|
)
|
|
|
|
func TestAMIGInstanceHasItsOwnMemoryItsCardsHeatAndNoUtilisation(t *testing.T) {
|
|
// Card 0 in MIG mode: the sensor sample is the card's, 60 GB used across
|
|
// both instances and a utilisation the driver does not give per instance.
|
|
inst := discovery.GPU{Index: 1001, Name: "NVIDIA A100-SXM4-80GB MIG 3g.40gb", MemoryTotalMB: 40192, MemoryUsedMB: 21000,
|
|
MIG: &discovery.MIGDevice{ParentIndex: 0, ParentMemoryTotalMB: 81920, Device: 1, Profile: "3g.40gb"}}
|
|
n := inventory.Node{ID: "g1", State: inventory.Ready, GPUs: []discovery.GPU{inst},
|
|
Load: &inventory.Load{At: time.Now(), GPUs: []inventory.GPUSensor{{Index: 0, TempC: 61, PowerW: 250,
|
|
UtilPercent: 0, MemoryUsedMB: 60000, MemoryTotalMB: 81920}}}}
|
|
out := gather(t, fakeSource{nodes: []inventory.Node{n}})
|
|
labels := "class=a100-80g-mig-3g.40gb gpu=1001 node=g1"
|
|
for _, want := range []string{
|
|
"llmgw_gpu_memory_used_bytes " + labels + " -> 22020096000\n",
|
|
"llmgw_gpu_memory_total_bytes " + labels + " -> 42144366592\n",
|
|
"llmgw_gpu_temperature_celsius " + labels + " -> 61\n",
|
|
"llmgw_gpu_power_watts " + labels + " -> 250\n",
|
|
} {
|
|
if !strings.Contains(out, want) {
|
|
t.Errorf("missing %s in:\n%s", want, out)
|
|
}
|
|
}
|
|
// Not the card's zero, not anything: absent.
|
|
if strings.Contains(out, "llmgw_gpu_utilization_percent "+labels) {
|
|
t.Errorf("a utilisation was published for a MIG instance:\n%s", out)
|
|
}
|
|
}
|