Every run records GPUs (PCIe link under load and maximum, ReBAR, P2P), runtime image/tag/digest and the engine version the server reports, model, quant, KV cache, context and concurrency, plus a whitelisted system summary and a description. Shown on the run page, compare and sweep views; passed to BetterBench as notes and to the launch80 preview as sections. Settings -> Hardware for manual values. Also: scripts/intel-probe.sh (read-only diagnostics for Intel hosts), and --quick is no longer passed together with --passes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
981c4170fc
commit
ee6c623e2a
45 files changed
+4627
-60
No files matched your search
@@ -6,15 +6,18 @@ import { access, mkdir, readFile } from "node:fs/promises";
|
||||
import { join } from "node:path";
|
||||
import { promisify } from "node:util";
|
||||
import { asc, eq } from "drizzle-orm";
|
||||
import { engineLabel, metaNotes, modelLabel, withLoadLinks } from "@/lib/benchmark-meta";
|
||||
import { REPORT_FILE, RESULTS_FILE, runDir } from "@/lib/benchmark-paths";
|
||||
import { effectiveHardware, runSetup } from "@/lib/benchmark-snapshot";
|
||||
import { db } from "@/lib/db/client";
|
||||
import { apiKeys, benchmarkLogs, benchmarkRuns, type BenchmarkSummary, deployments, type LogStream, runtimes } from "@/lib/db/schema";
|
||||
import { apiKeys, benchmarkLogs, benchmarkRuns, type BenchmarkSummary, deployments, type LogStream, type RunMeta, runtimes } from "@/lib/db/schema";
|
||||
import { ENGINE_PORT } from "@/lib/deploy-command";
|
||||
import { coreEnv } from "@/lib/env";
|
||||
import { abSummary } from "./ab-summary";
|
||||
import { AB_DEFAULT_MAX_PAIRS, AB_DEFAULT_MDE_PCT, AB_FILE, abArgs, betterbenchBin, betterbenchPython, runArgs, SUMMARY_SCRIPT, SUMMARY_VERSION } from "./betterbench";
|
||||
import { sanitizeLine } from "./job-log";
|
||||
import { log } from "./log";
|
||||
import { normalizePciAddress } from "./hardware";
|
||||
import { errorCauses } from "./log-causes";
|
||||
import { ResourceSampler } from "./resources";
|
||||
import { docker, workerImage } from "./runtimes";
|
||||
@@ -25,6 +28,9 @@ type Current = {
|
||||
deploymentIds: string[];
|
||||
child: ChildProcess;
|
||||
sampler: ResourceSampler | null;
|
||||
/** Recorded at the start; the PCIe links are replaced by the ones seen under load at the end. */
|
||||
meta: RunMeta | null;
|
||||
metaB: RunMeta | null;
|
||||
maxPairs: number | null;
|
||||
cancelled: boolean;
|
||||
lost: string | null;
|
||||
@@ -140,6 +146,32 @@ async function target(deploymentId: string | null): Promise<Target | null> {
|
||||
return { id: deploymentId, containerId: d.containerId, containerName: d.containerName, engine: d.engine, accelerator: d.accelerator };
|
||||
}
|
||||
|
||||
/** Which GPU links the sampler reads: sysfs where the GPU is on the visible PCI bus, nvidia-smi otherwise. */
|
||||
async function linkTargets(metas: (RunMeta | null)[]) {
|
||||
const addrs = [...new Set(metas.flatMap((m) => m?.gpus.map((g) => g.pciAddress) ?? []).filter((a): a is string => !!a))];
|
||||
const { nvidia } = await effectiveHardware();
|
||||
const nvidiaIndex: Record<number, string> = {};
|
||||
for (const g of nvidia) {
|
||||
const addr = g.pciAddress ? normalizePciAddress(g.pciAddress) : `nvidia-${g.index}`;
|
||||
if (addrs.includes(addr)) nvidiaIndex[g.index] = addr;
|
||||
}
|
||||
return { sysfs: addrs.filter((a) => !a.startsWith("nvidia-")), nvidiaIndex };
|
||||
}
|
||||
|
||||
/** A/B notes: the shared host facts once, the engine and model per side. */
|
||||
function abNotes(a: RunMeta | null, b: RunMeta | null, shared: Record<string, string>): Record<string, string> {
|
||||
const pick = ["gpus", "pcie_max", "p2p", "rebar", "system", "description"];
|
||||
const out: Record<string, string> = Object.fromEntries(Object.entries(shared).filter(([k]) => pick.includes(k)));
|
||||
for (const [side, m] of [["a", a], ["b", b]] as const) {
|
||||
if (!m) continue;
|
||||
out[`${side}_engine`] = engineLabel(m) || m.runtime.engine;
|
||||
out[`${side}_model`] = modelLabel(m);
|
||||
if (m.contextSize != null) out[`${side}_ctx`] = String(m.contextSize);
|
||||
if (m.concurrency != null) out[`${side}_concurrency`] = String(m.concurrency);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
const endpoint = (t: Target) => `http://${t.containerName}:${ENGINE_PORT[t.engine]}/v1`;
|
||||
|
||||
async function start(run: typeof benchmarkRuns.$inferSelect) {
|
||||
@@ -156,6 +188,10 @@ async function start(run: typeof benchmarkRuns.$inferSelect) {
|
||||
const keys = needsKey ? (await db().select({ key: apiKeys.key }).from(apiKeys).orderBy(asc(apiKeys.createdAt)).limit(1)).map((k) => k.key) : [];
|
||||
const s = run.snapshot;
|
||||
const maxPairs = run.settings.maxPairs ?? AB_DEFAULT_MAX_PAIRS;
|
||||
// What runs on what, recorded now (the deployments are up, so the server's version is known).
|
||||
const setup = await runSetup([a.id, b?.id ?? null]);
|
||||
const [meta, metaB] = setup.metas;
|
||||
const metaNotesA = meta ? metaNotes(meta, setup.system, run.description) : {};
|
||||
const args =
|
||||
run.kind === "ab" && b
|
||||
? abArgs({
|
||||
@@ -165,7 +201,12 @@ async function start(run: typeof benchmarkRuns.$inferSelect) {
|
||||
out: join(dir, AB_FILE),
|
||||
mdePct: run.settings.mdePct ?? AB_DEFAULT_MDE_PCT,
|
||||
maxPairs,
|
||||
notes: { a: s.deploymentName, b: run.snapshotB?.deploymentName ?? "B", ...(run.label ? { label: run.label } : {}) },
|
||||
notes: {
|
||||
a: s.deploymentName,
|
||||
b: run.snapshotB?.deploymentName ?? "B",
|
||||
...(run.label ? { label: run.label } : {}),
|
||||
...abNotes(meta, metaB, metaNotesA),
|
||||
},
|
||||
})
|
||||
: runArgs({
|
||||
endpoint: endpoint(a),
|
||||
@@ -179,6 +220,7 @@ async function start(run: typeof benchmarkRuns.$inferSelect) {
|
||||
image: s.image,
|
||||
...(s.options.modelFile ? { file: s.options.modelFile } : {}),
|
||||
ctx: String(s.options.contextSize),
|
||||
...metaNotesA,
|
||||
...(run.label ? { label: run.label } : {}),
|
||||
},
|
||||
});
|
||||
@@ -202,7 +244,10 @@ async function start(run: typeof benchmarkRuns.$inferSelect) {
|
||||
: `Benchmarking ${s.deploymentName} (${s.repoId} on ${s.runtimeName}) with BetterBench`,
|
||||
);
|
||||
addLog(run.id, "system", `$ betterbench ${args.join(" ")}`, keys);
|
||||
await db().update(benchmarkRuns).set({ state: "running", startedAt: new Date(), error: null, phase: null }).where(eq(benchmarkRuns.id, run.id));
|
||||
await db()
|
||||
.update(benchmarkRuns)
|
||||
.set({ state: "running", startedAt: new Date(), error: null, phase: null, meta, metaB, system: setup.system })
|
||||
.where(eq(benchmarkRuns.id, run.id));
|
||||
|
||||
// Resource use of the server(s) under test; GPUs when any side runs on NVIDIA.
|
||||
const c = docker();
|
||||
@@ -212,6 +257,7 @@ async function start(run: typeof benchmarkRuns.$inferSelect) {
|
||||
c,
|
||||
[{ side: "a" as const, containerId: a.containerId }, ...(b ? [{ side: "b" as const, containerId: b.containerId }] : [])],
|
||||
nvidia ? workerImage() : null,
|
||||
await linkTargets([meta, metaB]),
|
||||
)
|
||||
: null;
|
||||
await sampler?.start().catch((err) => log.warn(`resource sampling failed: ${message(err)}`));
|
||||
@@ -223,6 +269,8 @@ async function start(run: typeof benchmarkRuns.$inferSelect) {
|
||||
deploymentIds: [a.id, ...(b ? [b.id] : [])],
|
||||
child,
|
||||
sampler,
|
||||
meta,
|
||||
metaB,
|
||||
maxPairs: run.kind === "ab" ? maxPairs : null,
|
||||
cancelled: false,
|
||||
lost: null,
|
||||
@@ -247,6 +295,14 @@ async function done(cur: Current, code: number | null, signal: NodeJS.Signals |
|
||||
}
|
||||
const resources = (await cur.sampler?.stop().catch(() => null)) ?? null;
|
||||
if (current === cur) current = null;
|
||||
if (resources?.links) {
|
||||
const loaded = (m: RunMeta | null) => withLoadLinks(m, resources.links, !!m?.overridden.includes("pcie link"));
|
||||
await db()
|
||||
.update(benchmarkRuns)
|
||||
.set({ meta: loaded(cur.meta), metaB: loaded(cur.metaB) })
|
||||
.where(eq(benchmarkRuns.id, id))
|
||||
.catch((err) => log.warn(`benchmark ${id}: link update failed: ${message(err)}`));
|
||||
}
|
||||
const dir = runDir(id);
|
||||
const results = join(dir, cur.kind === "ab" ? AB_FILE : RESULTS_FILE);
|
||||
const hasReport = cur.kind === "run" && (await exists(join(dir, REPORT_FILE)));
|
||||
|
||||
Reference in new issue
Block a user