Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.
C++
bench: report only the GPUs the engine uses (#1985)
Niko1221ccc4be916528
diff --git a/tools/strata_bench.py b/tools/strata_bench.pyindex c960276fa..557af920e 100644--- a/tools/strata_bench.py+++ b/tools/strata_bench.py@@ -563,7 +563,29 @@ def git_commit() -> str | None:return out or None-def collect_machine(base: str, key: str, cfg: dict | None) -> dict:+def gpu_selection(cfg: dict | None, gpu_arg: str | None = None) -> list[int]:+ """#1985: the GPU numbers (as nvidia-smi numbers them) the engine is told to use: the bench's --gpu when it starts+ the server, else the config's "gpu" (one card, a list or "0,2"), else a "--gpu" in the config's args. [] when+ nothing says."""+ def parse(v):+ if v is None or v == "":+ return []+ items = v if isinstance(v, (list, tuple)) else str(v).split(",")+ out = []+ for x in items:+ x = str(x).strip()+ if x.isdigit():+ out.append(int(x))+ return out+ sel = parse(gpu_arg) or parse((cfg or {}).get("gpu"))+ if not sel:+ args = [str(x) for x in ((cfg or {}).get("args") or [])]+ if "--gpu" in args and args.index("--gpu") + 1 < len(args):+ sel = parse(args[args.index("--gpu") + 1])+ return sel+++def collect_machine(base: str, key: str, cfg: dict | None, gpu_arg: str | None = None) -> dict:status = try_json(base, "/v1/status", key) or {}metrics = try_json(base, "/metrics", key, 30) or {}props = try_json(base, "/props", key) or {}@@ -572,17 +594,26 @@ def collect_machine(base: str, key: str, cfg: dict | None) -> dict:eng = metrics.get("engine") or {}local = gpu_info_local()view = config_view(cfg) if cfg else {}- gpu_names = [g["name"] for g in local["gpus"]] or ([static["gpu_name"]] if static.get("gpu_name") else [])+ # #1985: only the GPUs the engine uses - the config's / --gpu selection; with none given the engine runs on one card+ # (the one the server reports), not on every card the PC has+ used = local["gpus"]+ sel = gpu_selection(cfg, gpu_arg)+ if sel:+ used = [local["gpus"][i] for i in sel if 0 <= i < len(local["gpus"])] or used+ elif len(used) > 1 and static.get("gpu_name"):+ named = [g for g in used if g["name"] == static["gpu_name"]]+ used = named[:1] or used[:1]+ gpu_names = [g["name"] for g in used] or ([static["gpu_name"]] if static.get("gpu_name") else [])m = status.get("machine") or {}vram_mib = (m.get("gpu") or {}).get("total_mib") or None- if local["gpus"] and local["gpus"][0].get("vram_mib"):- vram_mib = sum(g.get("vram_mib") or 0 for g in local["gpus"])+ if used and used[0].get("vram_mib"):+ vram_mib = sum(g.get("vram_mib") or 0 for g in used)n_ctx = Nonefor d in models.get("data") or []:n_ctx = (d.get("meta") or {}).get("n_ctx") or n_ctxn_ctx = n_ctx or (props.get("default_generation_settings") or {}).get("n_ctx")return {- "gpu": gpu_names, "gpu_vram_mib": vram_mib, "gpu_driver": (local["gpus"][0].get("driver") if local["gpus"] else local.get("rocm_driver")),+ "gpu": gpu_names, "gpu_vram_mib": vram_mib, "gpu_driver": (used[0].get("driver") if used else local.get("rocm_driver")),"cuda": local.get("cuda"), "cpu": static.get("cpu_name") or cpu_name(), "cpu_cores": static.get("cores"),"cpu_threads": static.get("threads") or os.cpu_count(), "ram_gib": total_ram_gib(),"os": f"{platform.system()} {platform.release()} ({platform.version()})" if os.name == "nt" else f"{platform.system()} {platform.release()}",@@ -899,14 +930,14 @@ def main(argv=None) -> int:print("The server did not become ready. Last log lines:\n" + red("\n".join(tail)), file=sys.stderr)return 1t0 = time.time()- pre = collect_machine(base, key, cfg)+ pre = collect_machine(base, key, cfg, a.gpu)suite = Suite(base, key, pre.get("context"), max(1, a.runs), a.think, log=say, want_clients=a.clients, want_long=a.long)slots = pre.get("parallel_slots") or 1if a.clients and a.clients > slots:say(f"Note: the server runs {slots} request(s) at a time (--batch), so {a.clients} clients will partly wait their turn.")say("Running the suite (about 3-10 minutes) ...")out = suite.run()- machine = collect_machine(base, key, cfg) # again: VRAM and the cache after the work+ machine = collect_machine(base, key, cfg, a.gpu) # again: VRAM and the cache after the workif not machine.get("gpu"):machine["gpu"] = pre.get("gpu")res = {"schema": SCHEMA, "tool": "tools/strata_bench.py", "date": datetime.date.today().isoformat(),diff --git a/tools/test_strata_bench.py b/tools/test_strata_bench.pyindex 6d4c2e7fc..80fc2d70e 100644--- a/tools/test_strata_bench.py+++ b/tools/test_strata_bench.py@@ -255,6 +255,27 @@ class ReportTests(unittest.TestCase):self.assertIn("+100.0%", table)self.assertIn("engine: 1.0 -> 9.9.9", table)+ def test_only_the_gpus_the_engine_uses_are_listed(self):+ """#1985: a PC with two cards, the engine on one: the report names that one, with its VRAM."""+ srv = FakeStrata()+ self.addCleanup(srv.stop)+ two = {"gpus": [{"name": "NVIDIA GeForce RTX 3060", "vram_mib": 12288, "driver": "560.1"},+ {"name": "NVIDIA GeForce RTX 9999", "vram_mib": 16384, "driver": "560.1"}]}+ with mock.patch.object(B, "gpu_info_local", return_value=two):+ m = B.collect_machine(srv.base, "", {"gpu": 1})+ self.assertEqual((m["gpu"], m["gpu_vram_mib"]), (["NVIDIA GeForce RTX 9999"], 16384))+ m = B.collect_machine(srv.base, "", {"gpu": [0, 1]})+ self.assertEqual((m["gpu"], m["gpu_vram_mib"]), (["NVIDIA GeForce RTX 3060", "NVIDIA GeForce RTX 9999"], 28672))+ m = B.collect_machine(srv.base, "", {"gpu": "0"}, "1") # the bench's own --gpu wins+ self.assertEqual(m["gpu"], ["NVIDIA GeForce RTX 9999"])+ m = B.collect_machine(srv.base, "", {"args": ["--gpu", "0"]})+ self.assertEqual(m["gpu"], ["NVIDIA GeForce RTX 3060"])+ # nothing selected: one card, the one the server reports (not every card of the PC)+ m = B.collect_machine(srv.base, "", {})+ self.assertEqual((m["gpu"], m["gpu_vram_mib"]), (["NVIDIA GeForce RTX 9999"], 16384))+ self.assertEqual(B.gpu_selection({"gpu": "0,2"}), [0, 2])+ self.assertEqual(B.gpu_selection({}, None), [])+def test_names(self):m = {"gpu": ["NVIDIA GeForce RTX 3060"], "model": "Qwen3.8 Flash-Next", "quant": "IQ3_XXS"}self.assertEqual(B.results_dir_name(m, "2026-10-10"), "2026-10-10-community-rtx-3060-qwen3-8-flash-next-iq3-xxs")