Files
Kaname/src/worker/betterbench.test.ts
T
Pascal LinxweilerandClaude Opus 5.5 9e167a44f6 Benchmarks with BetterBench, launch80-style reports and publishing, GPU support
- Benchmarks: BetterBench 0.6.1 (pinned by checksum) runs against a running
  deployment, one at a time; quick/full/custom passes, phase selection, live
  step and output, cancel, run again, compare runs side by side.
- Report page after launch80's bench.betterbench.v1: headline tiles,
  "Read these first" caveats (quick, sample gate, max_tokens truncation,
  batched streams, failures, skipped depths, prefix-cache hits), charts, full
  tables with daggered under-sampled cells, method text. All figures come from
  BetterBench's own report functions.
- Publish to launch80 as a double opt-in: L80 dry run builds the exact payload
  for inspection, an explicit confirmation publishes that file (L80 CLI 0.4.0
  pinned by checksum, L80_TOKEN worker-only). Endpoint and host never leave.
- GPUs: runtime accelerator (CPU, NVIDIA, /dev/dri, ROCm) with presets for the
  official CUDA/Vulkan/Intel/ROCm builds; NVIDIA GPUs probed via nvidia-smi in
  a short-lived container; per-deployment GPU picking, -ngl, split mode,
  tensor split, MoE offload, vLLM tensor parallel and GPU memory share.
- llama.cpp --cache-ram option (1 GiB for new deployments) and a memory
  estimate that counts it and the KV cache: the 8 GiB default made containers
  thrash at their memory limit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 20:54:38 +02:00

55 lines
2.3 KiB
TypeScript

import assert from "node:assert/strict";
import { describe, it } from "node:test";
import { runArgs } from "./betterbench";
import { stepOf } from "./benchmarks";
describe("betterbench runArgs", () => {
const base = { endpoint: "http://kaname-x-abc123:8080/v1", model: "unsloth/Qwen3-0.6B-GGUF", out: "/data/benchmarks/R/results.json", maxModelLen: 4096 };
it("builds a quick run with phases and notes, never checking for updates", () => {
const args = runArgs({ ...base, settings: { quick: true, passes: null, warmup: null, phases: ["decode", "prefill"] }, notes: { ctx: "4096", label: "q8 kv" } });
assert.deepEqual(args, [
"run",
"--endpoint",
"http://kaname-x-abc123:8080/v1",
"--model",
"unsloth/Qwen3-0.6B-GGUF",
"--out",
"/data/benchmarks/R/results.json",
"--max-model-len",
"4096",
"--quick",
"--decode",
"--prefill",
"--note",
"ctx=4096",
"--note",
"label=q8 kv",
"--no-update-check",
]);
});
it("passes explicit passes and warmup, and no phase flags for a full run", () => {
const args = runArgs({ ...base, maxModelLen: null, settings: { quick: false, passes: 10, warmup: 2, phases: [] }, notes: {} });
assert.ok(args.includes("--passes") && args[args.indexOf("--passes") + 1] === "10");
assert.ok(args.includes("--warmup") && args[args.indexOf("--warmup") + 1] === "2");
assert.ok(!args.includes("--quick") && !args.includes("--decode") && !args.includes("--max-model-len"));
});
it("turns progress lines into steps", () => {
assert.equal(stepOf("[single] chat: warmup 1 + 5 runs"), "Generation: chat");
assert.equal(stepOf("[prefill] depth ~2000 tok: warmup 2 + 8"), "Prompt processing: depth ~2000 tok");
assert.equal(stepOf("model max context: 4096 tokens"), null);
});
});
describe("parseNvidiaSmi", () => {
it("reads nvidia-smi CSV", async () => {
const { parseNvidiaSmi } = await import("./runtimes");
assert.deepEqual(parseNvidiaSmi("0, GPU-02d5eae7-e371-6b8f-adaf-2b18648bdb84, NVIDIA GeForce RTX 3080, 10240, 617.14\n"), [
{ vendor: "nvidia", index: 0, uuid: "GPU-02d5eae7-e371-6b8f-adaf-2b18648bdb84", name: "NVIDIA GeForce RTX 3080", memoryMb: 10240, driver: "617.14" },
]);
assert.deepEqual(parseNvidiaSmi("NVIDIA-SMI has failed"), []);
});
});