Each engine has a list of builds, best first, from what its project publishes and how each was compiled: llama.cpp CUDA 13.3, CUDA 12.8 (driver 570 for the GPUs it ships as PTX), then Vulkan, never the CPU build on an NVIDIA node; vLLM CUDA 13, then CUDA 12.9, and for GPUs older than every build of the version asked for, the newest built for them (V100: 0.19.1). The node takes the first its hardware meets and that installs and computes on the GPU, moving on when one does not, and reports the version it runs. GPU processes are read from nvidia-smi's full report, so Vulkan engines count as on their GPU. Refs #2. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
39 lines
1.3 KiB
Go
39 lines
1.3 KiB
Go
package discovery
|
|
|
|
import (
|
|
"reflect"
|
|
"testing"
|
|
)
|
|
|
|
func TestGPUProcessesOfEveryKindAreListedByIndex(t *testing.T) {
|
|
report := `<?xml version="1.0" ?>
|
|
<nvidia_smi_log>
|
|
<driver_version>580.65.06</driver_version>
|
|
<gpu id="00000000:17:00.0"><product_name>Tesla V100-SXM2-32GB</product_name>
|
|
<processes></processes>
|
|
</gpu>
|
|
<gpu id="00000000:65:00.0"><product_name>Tesla V100-SXM2-32GB</product_name>
|
|
<processes>
|
|
<process_info><pid>4100</pid><type>C</type><process_name>llama-server</process_name></process_info>
|
|
<process_info><pid>4300</pid><type>G</type><process_name>llama-server</process_name></process_info>
|
|
</processes>
|
|
</gpu>
|
|
<gpu id="00000000:B3:00.0"><processes>
|
|
<process_info><pid>4200</pid><type>C+G</type></process_info>
|
|
</processes></gpu>
|
|
</nvidia_smi_log>`
|
|
got, err := parseGPUProcesses([]byte(report))
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
// A Vulkan engine is a graphics process ("G") and is on its GPU all the
|
|
// same; a compute-only query would have missed it.
|
|
want := map[int][]int{1: {4100, 4300}, 2: {4200}}
|
|
if !reflect.DeepEqual(got, want) {
|
|
t.Errorf("got %v, want %v", got, want)
|
|
}
|
|
if _, err := parseGPUProcesses([]byte("not xml")); err == nil {
|
|
t.Error("a report that does not parse was read as no processes")
|
|
}
|
|
}
|