Group notes by topic, detect PCIe and power limit, default to quick

- Notes are one per topic (gpu, pcie, power_limit, host, engine, parallel,
  precision, run) instead of 27 flat keys; nothing appears twice. The context
  size is left to BetterBench's own chip. meta.json keeps every raw value.
- collect-env.sh reads the PCIe slot link (through on-card switches) and
  reports unknown inside a VM; --pcie declares it there.
- --power-limit is optional: the GPU's limit is used when omitted.
- --special-notes adds free text for anything unusual about a run.
- Plain bench.sh is now the quick smoke run; --full is the publishable one.
- Standard bumped to 0.2.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
claudeandClaude Opus 5.5 committed 2026-10-28 23:28:53 +01:00
1 parent 1ac7622005
commit 279de33646
5 files changed
+195 -31

No files matched your search

+37 -11
View File
@@ -21,9 +21,11 @@ BetterBench itself is used unmodified, only through its CLI.
| `--kv` | KV cache dtype | `f16`, `q8_0`, `int8_k_int4_v` | | `--kv` | KV cache dtype | `f16`, `q8_0`, `int8_k_int4_v` |
| `--spec` | speculative decoding: `none` or `METHOD:N` (`mtp`, `eagle`, `eagle3`, `ngram`, `draft`) | `mtp:5` | | `--spec` | speculative decoding: `none` or `METHOD:N` (`mtp`, `eagle`, `eagle3`, `ngram`, `draft`) | `mtp:5` |
| `--thinking` | thinking mode **configured on the server**: `off`, `on`, `low`, `medium`, `high`, `default` | `default` | | `--thinking` | thinking mode **configured on the server**: `off`, `on`, `low`, `medium`, `high`, `default` | `default` |
| `--power-limit` | GPU power limit in W, or `stock` | `200` |
| `--submitter` | who ran it | `pascal` | | `--submitter` | who ran it | `pascal` |
The GPU power limit is read from the GPU. Pass `--power-limit W` (or `stock`) only
where it can't be detected, or to declare it; a mismatch is noted in the result.
BetterBench can't send `chat_template_kwargs` / `reasoning_effort`, so the thinking BetterBench can't send `chat_template_kwargs` / `reasoning_effort`, so the thinking
mode must be fixed in the server's chat template or launch flags and declared here. mode must be fixed in the server's chat template or launch flags and declared here.
5. **Results come from `bench.sh` only.** It adds everything it can detect itself 5. **Results come from `bench.sh` only.** It adds everything it can detect itself
@@ -34,15 +36,20 @@ BetterBench itself is used unmodified, only through its CLI.
On the inference server (or any machine that reaches it and has BetterBench 0.6.1): On the inference server (or any machine that reaches it and has BetterBench 0.6.1):
```sh ```sh
./bench.sh --endpoint http://localhost:8080/v1 --model llamacpp-sycl/qwen3.8-27b-q4-mtp \ ./bench.sh --endpoint http://localhost:8080/v1 --model vllm/lfm3-1.7b \
--tp 1 --pp 1 --quant Q4_K_M --kv f16 --spec mtp:5 --thinking default \ --tp 1 --pp 1 --quant bf16 --kv bf16 --spec none --thinking default \
--power-limit 200 --submitter pascal \ --submitter pascal --server-cmd-file my-server-cmd.txt
--server-cmd-file my-server-cmd.txt
``` ```
- `--quick` - smoke run (BetterBench `--quick`); recorded as `run_mode=quick`, not for submission. That is a quick smoke run (BetterBench `--quick`, a few minutes) to check the setup.
Add `--full` for the run that counts; it takes much longer and occupies the GPU.
- `--full` - the complete, publishable run; recorded as `run=full · ...`.
- `--no-concurrency` - skip the concurrency sweep; recorded as `concurrency=off`. - `--no-concurrency` - skip the concurrency sweep; recorded as `concurrency=off`.
- `--dry-run` - print the BetterBench command and exit. - `--dry-run` - print the BetterBench command and exit.
- `--pcie "Gen4 x16"` - declare the slot link where it can't be read (VMs).
- `--special-notes "..."` - free text for anything unusual about the run (custom
kernels, undervolt, patched engine). Recorded as `special_notes`.
- `--api-key KEY` or `$BETTERBENCH_API_KEY` - never stored. - `--api-key KEY` or `$BETTERBENCH_API_KEY` - never stored.
- Each mandatory flag can also come from `BENCH_<NAME>` (e.g. `BENCH_SUBMITTER`). - Each mandatory flag can also come from `BENCH_<NAME>` (e.g. `BENCH_SUBMITTER`).
- Results go to `results/` next to this file, or `--results-dir` / `$BENCH_RESULTS_DIR`. - Results go to `results/` next to this file, or `--results-dir` / `$BENCH_RESULTS_DIR`.
@@ -60,11 +67,30 @@ Each run produces `results/<timestamp>-<submitter>-<model>-<engine>-<gpu>/` with
## Recorded notes ## Recorded notes
Declared: `submitter tp pp quant kv spec thinking power_limit`, plus `bench_standard The notes are grouped, one per topic, so the report and compare page stay readable:
run_mode concurrency`. Detected (by `collect-env.sh`): `gpu_vendor gpu_model gpu_count
gpu_vram_gb gpu_driver gpu_power_limit_w cpu_model ram_gb os kernel proxy engine | note | example |
engine_version engine_slots model_file ctx`. `gpu_vram_gb` is per GPU. Anything |---|---|
undetectable is `unknown`. | `submitter` | `pascal` |
| `gpu` | `1x Intel Arc Pro B65 · 32 GB · driver 1.17.39395` (VRAM per GPU) |
| `pcie` | `Gen4 x16`, `Gen1 x16 now, Gen4 x16 max` (idle downclock), `Gen4 x16 (declared)` |
| `power_limit` | `200 W`, or `180 W (GPU reports 200 W)` when they disagree |
| `host` | `AMD EPYC 7282 16-Core Processor · 60 GB RAM · Ubuntu 26.04.1 LTS · kernel 7.0.0-38-generic · VM kvm` |
| `engine` | `vllm 0.30.0 · via llama-swap`, `llama.cpp b11913-7aca0d2ea · 4 slots · via llama-swap` |
| `model_file` | `/models/Qwen3.8-27B-Q4_0.gguf` |
| `parallel` | `tp 1 · pp 1` |
| `precision` | `weights Q4_0 · kv f16` |
| `spec`, `thinking` | `mtp:5`, `default` |
| `run` | `full · concurrency on · bench-standard 0.2.0` |
| `special_notes` | only when given: free text from `--special-notes` |
The context size shows as BetterBench's own context chip. Parts that can't be detected
are left out. `meta.json` keeps every raw value (`mandatory`, `collected` from
`collect-env.sh`) for scripts.
PCIe is the link into the slot. Cards with their own PCIe switch, like Intel Arc, are
read at the switch's upstream port. Inside a VM the link can't be read: run
`collect-env.sh` on the hypervisor or pass `--pcie "Gen4 x16"`.
Engine detection: llama.cpp via `/props`, vLLM via `/version` + `/v1/models`; behind Engine detection: llama.cpp via `/props`, vLLM via `/version` + `/v1/models`; behind
llama-swap through `/upstream/<model>/...`, which also yields the launch command. llama-swap through `/upstream/<model>/...`, which also yields the launch command.
+2 -1
View File
@@ -9,7 +9,8 @@ Send the whole run directory `results/<timestamp>-<submitter>-<model>-<engine>-<
| `meta.json` | detected + declared setup, the exact BetterBench command | | `meta.json` | detected + declared setup, the exact BetterBench command |
| `server-cmd.txt` | the server launch command (from `--server-cmd-file`, or from llama-swap) | | `server-cmd.txt` | the server launch command (from `--server-cmd-file`, or from llama-swap) |
Only full runs count: `run_mode=full` in `meta.json`. Quick runs are smoke tests. Only full runs count (`bench.sh --full`): the `run` note starts with `full`. Runs
without `--full` are quick smoke tests.
If `server-cmd.txt` is missing, pass `--server-cmd-file` next time, or add the launch If `server-cmd.txt` is missing, pass `--server-cmd-file` next time, or add the launch
command by hand. Values of variables or flags named like `*TOKEN*`, `*KEY*`, `*SECRET*`, command by hand. Values of variables or flags named like `*TOKEN*`, `*KEY*`, `*SECRET*`,
+107 -16
View File
@@ -3,13 +3,20 @@
# #
# usage: bench.sh --endpoint URL --model ID # usage: bench.sh --endpoint URL --model ID
# --tp N --pp N --quant Q --kv KV --spec none|METHOD:N # --tp N --pp N --quant Q --kv KV --spec none|METHOD:N
# --thinking MODE --power-limit W|stock --submitter NAME # --thinking MODE --submitter NAME
# [--api-key KEY] [--server-cmd-file FILE] [--env-file FILE] # [--power-limit W|stock] [--api-key KEY] [--server-cmd-file FILE]
# [--results-dir DIR] [--quick] [--no-concurrency] [--dry-run] # [--env-file FILE] [--pcie GenN xW] [--special-notes TEXT]
# [--results-dir DIR] [--full] [--no-concurrency] [--dry-run]
# #
# Default is a quick smoke run (BetterBench --quick); --full is the run that
# counts for submission.
# Mandatory values may also come from the environment: BENCH_TP, BENCH_PP, # Mandatory values may also come from the environment: BENCH_TP, BENCH_PP,
# BENCH_QUANT, BENCH_KV, BENCH_SPEC, BENCH_THINKING, BENCH_POWER_LIMIT, # BENCH_QUANT, BENCH_KV, BENCH_SPEC, BENCH_THINKING, BENCH_SUBMITTER.
# BENCH_SUBMITTER. API key: --api-key or $BETTERBENCH_API_KEY. # --power-limit (or BENCH_POWER_LIMIT): read from the GPU when omitted; required
# only where it can't be detected. API key: --api-key or $BETTERBENCH_API_KEY.
# --pcie (or BENCH_PCIE): declare the slot link where it can't be read (VMs).
# --special-notes (or BENCH_SPECIAL_NOTES): free text for anything unusual
# about this run, e.g. "custom k8v4 kernels" or "undervolted".
# --env-file: output of collect-env.sh run on the server, when BetterBench # --env-file: output of collect-env.sh run on the server, when BetterBench
# runs on another machine (default: run collect-env.sh here). # runs on another machine (default: run collect-env.sh here).
@@ -21,12 +28,12 @@ here=$(cd "$(dirname "$0")" && pwd)
[ -f "$here/bench.local.env" ] && . "$here/bench.local.env" [ -f "$here/bench.local.env" ] && . "$here/bench.local.env"
die() { echo "bench.sh: $*" >&2; exit 1; } die() { echo "bench.sh: $*" >&2; exit 1; }
usage() { sed -n '2,15p' "$0"; exit "${1:-0}"; } usage() { sed -n '2,22p' "$0"; exit "${1:-0}"; }
endpoint="" model="" server_cmd_file="" env_file="" quick=0 no_conc=0 dry=0 endpoint="" model="" server_cmd_file="" env_file="" quick=1 no_conc=0 dry=0
tp=${BENCH_TP:-} pp=${BENCH_PP:-} quant=${BENCH_QUANT:-} kv=${BENCH_KV:-} tp=${BENCH_TP:-} pp=${BENCH_PP:-} quant=${BENCH_QUANT:-} kv=${BENCH_KV:-}
spec=${BENCH_SPEC:-} thinking=${BENCH_THINKING:-} power_limit=${BENCH_POWER_LIMIT:-} spec=${BENCH_SPEC:-} thinking=${BENCH_THINKING:-} power_limit=${BENCH_POWER_LIMIT:-}
submitter=${BENCH_SUBMITTER:-} submitter=${BENCH_SUBMITTER:-} pcie=${BENCH_PCIE:-} special=${BENCH_SPECIAL_NOTES:-}
results_dir=${BENCH_RESULTS_DIR:-$here/results} results_dir=${BENCH_RESULTS_DIR:-$here/results}
need() { [ "$1" -ge 2 ] || die "$2 needs a value"; } need() { [ "$1" -ge 2 ] || die "$2 needs a value"; }
@@ -46,7 +53,10 @@ while [ $# -gt 0 ]; do
--thinking) need $# "$1"; thinking=$2; shift 2 ;; --thinking) need $# "$1"; thinking=$2; shift 2 ;;
--power-limit) need $# "$1"; power_limit=$2; shift 2 ;; --power-limit) need $# "$1"; power_limit=$2; shift 2 ;;
--submitter) need $# "$1"; submitter=$2; shift 2 ;; --submitter) need $# "$1"; submitter=$2; shift 2 ;;
--pcie) need $# "$1"; pcie=$2; shift 2 ;;
--special-notes) need $# "$1"; special=$2; shift 2 ;;
--quick) quick=1; shift ;; --quick) quick=1; shift ;;
--full) quick=0; shift ;;
--no-concurrency) no_conc=1; shift ;; --no-concurrency) no_conc=1; shift ;;
--dry-run) dry=1; shift ;; --dry-run) dry=1; shift ;;
-h|--help) usage 0 ;; -h|--help) usage 0 ;;
@@ -65,7 +75,7 @@ command -v python3 >/dev/null || die "python3 not found"
command -v curl >/dev/null || die "curl not found" command -v curl >/dev/null || die "curl not found"
missing="" missing=""
for f in endpoint model tp pp quant kv spec thinking power_limit submitter; do for f in endpoint model tp pp quant kv spec thinking submitter; do
eval "v=\${$f}" eval "v=\${$f}"
[ -n "$v" ] || missing="$missing --$(printf '%s' "$f" | tr _ -)" [ -n "$v" ] || missing="$missing --$(printf '%s' "$f" | tr _ -)"
done done
@@ -77,7 +87,11 @@ matches "$spec" 'none|(mtp|eagle|eagle3|ngram|draft):[1-9][0-9]*' ||
die "--spec must be none or METHOD:N (mtp|eagle|eagle3|ngram|draft), e.g. mtp:5" die "--spec must be none or METHOD:N (mtp|eagle|eagle3|ngram|draft), e.g. mtp:5"
matches "$thinking" 'off|on|low|medium|high|default' || matches "$thinking" 'off|on|low|medium|high|default' ||
die "--thinking must be off|on|low|medium|high|default (the server-side mode)" die "--thinking must be off|on|low|medium|high|default (the server-side mode)"
matches "$power_limit" 'stock|[0-9]+(\.[0-9]+)?' || die "--power-limit must be watts or 'stock'" [ -z "$power_limit" ] || matches "$power_limit" 'stock|[0-9]+(\.[0-9]+)?' ||
die "--power-limit must be watts or 'stock'"
[ -z "$pcie" ] || matches "$pcie" 'Gen[1-6] x(1|2|4|8|16|32)' || die "--pcie must look like 'Gen4 x16'"
case "$special" in *"
"*) die "--special-notes must be a single line" ;; esac
for f in quant kv submitter; do for f in quant kv submitter; do
eval "v=\${$f}" eval "v=\${$f}"
matches "$v" '[^[:space:]=]+' || die "--$f must be one word without '='" matches "$v" '[^[:space:]=]+' || die "--$f must be one word without '='"
@@ -110,10 +124,22 @@ else
--server-cmd-out "$tmp/cmd.auto" > "$tmp/env" --server-cmd-out "$tmp/cmd.auto" > "$tmp/env"
fi fi
# Mandatory fields first, collected ones after; one key=value per line. get() { sed -n "s/^$1=//p" "$tmp/env" | head -n1; }
pl=$(get gpu_power_limit_w)
power_src=declared
if [ -z "$power_limit" ]; then
matches "$pl" '[0-9]+(\.[0-9]+)?' ||
die "GPU power limit not detected here; pass --power-limit W (or 'stock')"
power_limit=$pl power_src=detected
fi
# Raw declared values; meta.json keeps these and the collected ones as is.
{ {
printf 'submitter=%s\ntp=%s\npp=%s\nquant=%s\nkv=%s\nspec=%s\nthinking=%s\npower_limit=%s\n' \ printf 'submitter=%s\ntp=%s\npp=%s\nquant=%s\nkv=%s\nspec=%s\nthinking=%s\npower_limit=%s\n' \
"$submitter" "$tp" "$pp" "$quant" "$kv" "$spec" "$thinking" "$power_limit" "$submitter" "$tp" "$pp" "$quant" "$kv" "$spec" "$thinking" "$power_limit"
printf 'power_limit_source=%s\n' "$power_src"
[ -n "$pcie" ] && printf 'pcie=%s\n' "$pcie"
[ -n "$special" ] && printf 'special_notes=%s\n' "$special"
printf 'bench_standard=%s\nrun_mode=%s\nconcurrency=%s\n' "$STANDARD_VERSION" \ printf 'bench_standard=%s\nrun_mode=%s\nconcurrency=%s\n' "$STANDARD_VERSION" \
"$([ $quick = 1 ] && echo quick || echo full)" "$([ $no_conc = 1 ] && echo off || echo on)" "$([ $quick = 1 ] && echo quick || echo full)" "$([ $no_conc = 1 ] && echo off || echo on)"
} > "$tmp/mandatory" } > "$tmp/mandatory"
@@ -124,12 +150,76 @@ fi
for k in $(cut -d= -f1 "$tmp/mandatory"); do for k in $(cut -d= -f1 "$tmp/mandatory"); do
if grep -q "^$k=" "$tmp/collected"; then die "collected env must not set mandatory key '$k'"; fi if grep -q "^$k=" "$tmp/collected"; then die "collected env must not set mandatory key '$k'"; fi
done done
cat "$tmp/mandatory" "$tmp/collected" > "$tmp/notes" # The notes are grouped for reading: one chip per topic, nothing twice.
# The context size is left out - BetterBench shows it from --max-model-len.
python3 - "$tmp/mandatory" "$tmp/collected" > "$tmp/notes" <<'PY'
import sys
def kv(path):
with open(path, encoding="utf-8") as f:
return dict(l.rstrip("\n").split("=", 1) for l in f if "=" in l)
m, c = kv(sys.argv[1]), kv(sys.argv[2])
def g(k):
v = c.get(k, "")
return "" if v in ("", "unknown") else v
def join(*parts):
return " · ".join(p for p in parts if p) or "unknown"
get() { sed -n "s/^$1=//p" "$tmp/notes" | head -n1; } vendor = {"intel": "Intel", "nvidia": "NVIDIA", "amd": "AMD"}.get(g("gpu_vendor"), g("gpu_vendor"))
engine=$(get engine) gpu=$(get gpu_model) count=$(get gpu_count) ctx=$(get ctx) pl=$(get gpu_power_limit_w) count = g("gpu_count")
gpu = join(" ".join(p for p in (count and count + "x", vendor if vendor != "none" else "",
g("gpu_model")) if p),
g("gpu_vram_gb") and g("gpu_vram_gb") + " GB",
g("gpu_driver") and "driver " + g("gpu_driver"))
link, top = g("pcie_link"), g("pcie_max")
if m.get("pcie"):
pcie = m["pcie"] + " (declared)"
elif link and top and link != top:
pcie = f"{link} now, {top} max" # idle GPUs drop the link speed
else:
pcie = link or "unknown"
pl, det = m["power_limit"], g("gpu_power_limit_w")
if pl == "stock":
power = join("stock", det and det + " W")
else:
power = pl + " W"
if det and abs(float(det) - float(pl)) > 1:
power += f" (GPU reports {det} W)"
virt = g("virt")
host = join(g("cpu_model"), g("ram_gb") and g("ram_gb") + " GB RAM", g("os"),
g("kernel") and "kernel " + g("kernel"), virt != "none" and virt and "VM " + virt)
eng = g("engine")
engine = join(" ".join(p for p in (eng, g("engine_version")) if p),
g("engine_slots") and g("engine_slots") + " slots",
g("proxy") not in ("", "none") and "via " + g("proxy"))
notes = [
("submitter", m["submitter"]),
("gpu", gpu),
("pcie", pcie),
("power_limit", power),
("host", host),
("engine", engine),
("model_file", g("model_file") or "unknown"),
("parallel", f"tp {m['tp']} · pp {m['pp']}"),
("precision", f"weights {m['quant']} · kv {m['kv']}"),
("spec", m["spec"]),
("thinking", m["thinking"]),
("run", join(m["run_mode"], "concurrency " + m["concurrency"],
"bench-standard " + m["bench_standard"])),
]
if m.get("special_notes"):
notes.append(("special_notes", m["special_notes"]))
for k, v in notes:
print(f"{k}={v}")
PY
engine=$(get engine) gpu=$(get gpu_model) count=$(get gpu_count) ctx=$(get ctx)
[ "$engine" != unknown ] || echo "bench.sh: warning: engine not detected; result is hard to compare" >&2 [ "$engine" != unknown ] || echo "bench.sh: warning: engine not detected; result is hard to compare" >&2
if [ "$power_limit" != stock ] && matches "$pl" '[0-9.]+' && if [ "$power_src" = declared ] && [ "$power_limit" != stock ] && matches "$pl" '[0-9.]+' &&
[ "$(awk -v a="$pl" -v b="$power_limit" 'BEGIN{print (a-b>1||b-a>1)}')" = 1 ]; then [ "$(awk -v a="$pl" -v b="$power_limit" 'BEGIN{print (a-b>1||b-a>1)}')" = 1 ]; then
echo "bench.sh: warning: --power-limit $power_limit W but the GPU reports $pl W" >&2 echo "bench.sh: warning: --power-limit $power_limit W but the GPU reports $pl W" >&2
fi fi
@@ -173,7 +263,7 @@ open(sys.argv[2], "w", encoding="utf-8").write(s if s.endswith("\n") else s + "\
PY PY
fi fi
STANDARD_VERSION=$STANDARD_VERSION CMD_SRC=$cmd_src ENDPOINT=$endpoint MODEL=$model NAME=$name \ STANDARD_VERSION=$STANDARD_VERSION CMD_SRC=$cmd_src ENDPOINT=$endpoint MODEL=$model NAME=$name NOTES=$tmp/notes \
python3 - "$tmp/mandatory" "$tmp/collected" "$run_dir/meta.json" "$@" <<'PY' python3 - "$tmp/mandatory" "$tmp/collected" "$run_dir/meta.json" "$@" <<'PY'
import json, os, sys, time import json, os, sys, time
def kv(path): def kv(path):
@@ -186,6 +276,7 @@ meta = {
"endpoint": os.environ["ENDPOINT"], "endpoint": os.environ["ENDPOINT"],
"model": os.environ["MODEL"], "model": os.environ["MODEL"],
"name": os.environ["NAME"], "name": os.environ["NAME"],
"notes": kv(os.environ["NOTES"]),
"mandatory": kv(sys.argv[1]), "mandatory": kv(sys.argv[1]),
"collected": kv(sys.argv[2]), "collected": kv(sys.argv[2]),
"server_cmd_file": "server-cmd.txt" if src else None, "server_cmd_file": "server-cmd.txt" if src else None,
+48 -2
View File
@@ -72,9 +72,39 @@ norm_gpu() {
kv() { printf '%s=%s\n' "$1" "$(printf '%s' "${2:-unknown}" | tr '\n\r' ' ')"; } kv() { printf '%s=%s\n' "$1" "$(printf '%s' "${2:-unknown}" | tr '\n\r' ' ')"; }
# "16.0 GT/s PCIe" -> 4
pcie_gen() {
case "$1" in
2.5*) echo 1 ;; 5.0*|5\ *) echo 2 ;; 8.0*|8\ *) echo 3 ;; 16.0*|16\ *) echo 4 ;;
32.0*|32\ *) echo 5 ;; 64.0*|64\ *) echo 6 ;; *) echo "" ;;
esac
}
# pcie_of BDF - sets pcie_link (negotiated now) and pcie_max (what card and slot
# both support) for the link into the slot. Cards with their own PCIe switch
# (Intel Arc, some AMD) expose an internal link on the GPU function itself, so
# walk up through bridges of the GPU's vendor to the switch's upstream port.
pcie_of() {
d=$(readlink -f "/sys/bus/pci/devices/$1" 2>/dev/null) && [ -f "$d/vendor" ] || return 0
vendor=$(cat "$d/vendor")
while p=${d%/*}; [ -f "$p/class" ] && [ "$(cat "$p/vendor")" = "$vendor" ]; do
case $(cat "$p/class") in 0x0604*) d=$p ;; *) break ;; esac
done
p=${d%/*}
g=$(pcie_gen "$(cat "$d/current_link_speed" 2>/dev/null)") w=$(cat "$d/current_link_width" 2>/dev/null)
[ -n "$g" ] && [ -n "$w" ] && pcie_link="Gen$g x$w"
g=$(pcie_gen "$(cat "$d/max_link_speed" 2>/dev/null)") w=$(cat "$d/max_link_width" 2>/dev/null)
if [ -f "$p/max_link_speed" ]; then
pg=$(pcie_gen "$(cat "$p/max_link_speed")") pw=$(cat "$p/max_link_width" 2>/dev/null)
[ -n "$pg" ] && [ "$pg" -lt "${g:-99}" ] && g=$pg
[ -n "$pw" ] && [ "$pw" -lt "${w:-99}" ] && w=$pw
fi
[ -n "$g" ] && [ -n "$w" ] && pcie_max="Gen$g x$w"
return 0
}
# ---------------------------------------------------------------- GPU # ---------------------------------------------------------------- GPU
gpu_vendor=none gpu_model="" gpu_count=0 gpu_vram_gb="" gpu_driver="" gpu_power_limit_w="" gpu_vendor=none gpu_model="" gpu_count=0 gpu_vram_gb="" gpu_driver="" gpu_power_limit_w="" gpu_bdf=""
if have nvidia-smi && q=$(nvidia-smi --query-gpu=name,memory.total,driver_version,power.limit \ if have nvidia-smi && q=$(nvidia-smi --query-gpu=name,memory.total,driver_version,power.limit,pci.bus_id \
--format=csv,noheader,nounits 2>/dev/null) && [ -n "$q" ]; then --format=csv,noheader,nounits 2>/dev/null) && [ -n "$q" ]; then
gpu_vendor=nvidia gpu_vendor=nvidia
gpu_count=$(printf '%s\n' "$q" | grep -c .) gpu_count=$(printf '%s\n' "$q" | grep -c .)
@@ -83,11 +113,15 @@ if have nvidia-smi && q=$(nvidia-smi --query-gpu=name,memory.total,driver_versio
gpu_vram_gb=$(printf '%s' "$first" | cut -d, -f2 | awk '$1+0>0 {printf "%d", $1/1024+0.5}') gpu_vram_gb=$(printf '%s' "$first" | cut -d, -f2 | awk '$1+0>0 {printf "%d", $1/1024+0.5}')
gpu_driver=$(printf '%s' "$first" | cut -d, -f3 | tr -d ' ') gpu_driver=$(printf '%s' "$first" | cut -d, -f3 | tr -d ' ')
gpu_power_limit_w=$(printf '%s' "$first" | cut -d, -f4 | awk '$1+0>0 {printf "%g", $1}') gpu_power_limit_w=$(printf '%s' "$first" | cut -d, -f4 | awk '$1+0>0 {printf "%g", $1}')
# 00000000:01:00.0 -> 0000:01:00.0
gpu_bdf=$(printf '%s' "$first" | cut -d, -f5 | tr -d ' ' | tr 'A-F' 'a-f' | sed 's/^[0-9a-f]*\([0-9a-f]\{4\}:\)/\1/')
elif have rocm-smi && rocm-smi --showproductname --json > "$tmp/rp" 2>/dev/null; then elif have rocm-smi && rocm-smi --showproductname --json > "$tmp/rp" 2>/dev/null; then
gpu_vendor=amd gpu_vendor=amd
rocm-smi --showmeminfo vram --json > "$tmp/rm" 2>/dev/null rocm-smi --showmeminfo vram --json > "$tmp/rm" 2>/dev/null
rocm-smi --showdriverversion --json > "$tmp/rd" 2>/dev/null rocm-smi --showdriverversion --json > "$tmp/rd" 2>/dev/null
rocm-smi --showmaxpower --json > "$tmp/rw" 2>/dev/null rocm-smi --showmaxpower --json > "$tmp/rw" 2>/dev/null
rocm-smi --showbus --json > "$tmp/rb" 2>/dev/null
gpu_bdf=$(jget "$tmp/rb" 'next(v["PCI Bus"] for k, v in j.items() if k.startswith("card")).lower()')
gpu_count=$(jget "$tmp/rp" 'len([k for k in j if k.startswith("card")])') gpu_count=$(jget "$tmp/rp" 'len([k for k in j if k.startswith("card")])')
gpu_model=$(jget "$tmp/rp" '"+".join(sorted({v.get("Card Series") or v.get("Card series") or v.get("Card model", "") for k, v in j.items() if k.startswith("card")}))' | norm_gpu) gpu_model=$(jget "$tmp/rp" '"+".join(sorted({v.get("Card Series") or v.get("Card series") or v.get("Card model", "") for k, v in j.items() if k.startswith("card")}))' | norm_gpu)
gpu_vram_gb=$(jget "$tmp/rm" 'round(int(next(v["VRAM Total Memory (B)"] for k, v in j.items() if k.startswith("card"))) / 2**30)') gpu_vram_gb=$(jget "$tmp/rm" 'round(int(next(v["VRAM Total Memory (B)"] for k, v in j.items() if k.startswith("card"))) / 2**30)')
@@ -98,6 +132,7 @@ elif have xpu-smi && xpu-smi discovery -j > "$tmp/xl" 2>/dev/null; then
gpu_count=$(jget "$tmp/xl" 'len(j["device_list"])') gpu_count=$(jget "$tmp/xl" 'len(j["device_list"])')
gpu_model=$(jget "$tmp/xl" '"+".join(sorted({d["device_name"] for d in j["device_list"]}))' | norm_gpu) gpu_model=$(jget "$tmp/xl" '"+".join(sorted({d["device_name"] for d in j["device_list"]}))' | norm_gpu)
dev0=$(jget "$tmp/xl" 'j["device_list"][0]["device_id"]') dev0=$(jget "$tmp/xl" 'j["device_list"][0]["device_id"]')
gpu_bdf=$(jget "$tmp/xl" 'j["device_list"][0]["pci_bdf_address"].lower()')
if [ -n "$dev0" ]; then if [ -n "$dev0" ]; then
xpu-smi discovery -d "$dev0" -j > "$tmp/xd" 2>/dev/null xpu-smi discovery -d "$dev0" -j > "$tmp/xd" 2>/dev/null
gpu_vram_gb=$(jget "$tmp/xd" 'round(int(j["memory_physical_size_byte"]) / 2**30)') gpu_vram_gb=$(jget "$tmp/xd" 'round(int(j["memory_physical_size_byte"]) / 2**30)')
@@ -110,6 +145,13 @@ fi
[ -n "$gpu_count" ] || gpu_count=unknown [ -n "$gpu_count" ] || gpu_count=unknown
# ---------------------------------------------------------------- host # ---------------------------------------------------------------- host
# In a VM the GPU hangs off a virtual root port whose link figures are made
# up, so PCIe is only measured on bare metal.
virt=$(systemd-detect-virt --vm 2>/dev/null) || virt=none
pcie_link="" pcie_max=""
if [ "$virt" = none ] && [ -n "$gpu_bdf" ]; then pcie_of "$gpu_bdf"
elif [ "$virt" != none ]; then pcie_link="unknown (VM)" pcie_max="unknown (VM)"; fi
cpu_model=$(lscpu 2>/dev/null | sed -n 's/^Model name: *//p' | head -n1) cpu_model=$(lscpu 2>/dev/null | sed -n 's/^Model name: *//p' | head -n1)
[ -n "$cpu_model" ] || cpu_model=$(sed -n 's/^model name[[:space:]]*: *//p' /proc/cpuinfo 2>/dev/null | head -n1) [ -n "$cpu_model" ] || cpu_model=$(sed -n 's/^model name[[:space:]]*: *//p' /proc/cpuinfo 2>/dev/null | head -n1)
ram_gb=$(awk '/^MemTotal:/ {printf "%d", $2/1048576+0.5}' /proc/meminfo 2>/dev/null) ram_gb=$(awk '/^MemTotal:/ {printf "%d", $2/1048576+0.5}' /proc/meminfo 2>/dev/null)
@@ -185,10 +227,14 @@ kv gpu_count "$gpu_count"
kv gpu_vram_gb "$gpu_vram_gb" kv gpu_vram_gb "$gpu_vram_gb"
kv gpu_driver "$gpu_driver" kv gpu_driver "$gpu_driver"
kv gpu_power_limit_w "$gpu_power_limit_w" kv gpu_power_limit_w "$gpu_power_limit_w"
kv gpu_bdf "$gpu_bdf"
kv pcie_link "$pcie_link"
kv pcie_max "$pcie_max"
kv cpu_model "$cpu_model" kv cpu_model "$cpu_model"
kv ram_gb "$ram_gb" kv ram_gb "$ram_gb"
kv os "$os" kv os "$os"
kv kernel "$kernel" kv kernel "$kernel"
kv virt "$virt"
kv proxy "$proxy" kv proxy "$proxy"
kv engine "$engine" kv engine "$engine"
kv engine_version "$engine_version" kv engine_version "$engine_version"
+1 -1
View File
@@ -1,4 +1,4 @@
# Pins for this version of the group standard. Bump STANDARD_VERSION whenever # Pins for this version of the group standard. Bump STANDARD_VERSION whenever
# config.json, the pinned BetterBench or the mandatory fields change. # config.json, the pinned BetterBench or the mandatory fields change.
STANDARD_VERSION=0.1.0 STANDARD_VERSION=0.2.0
BETTERBENCH_VERSION=0.6.1 BETTERBENCH_VERSION=0.6.1