From 5f49a5adca500ad7b0a466b40f8ce347016663d2 Mon Sep 17 00:00:00 2001 From: ZacharyZcR Date: Tue, 14 Jul 2026 01:47:34 +0800 Subject: [PATCH] coli: honor --gpu/--vram without --auto-tier, fail-fast on CPU-only binary (#125, fixes #121) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit env_for() mapped --gpu/--vram only inside the --auto-tier branch, so the standalone form started a CPU-only engine with no warning (#121 — nearly published as a GPU benchmark). Now: --gpu none disables CUDA; --gpu list/auto sets COLI_CUDA/COLI_GPUS; --vram sets CUDA_EXPERT_GB; and --gpu/--vram on a CPU-only binary exit with a clear 'make glm CUDA=1' message instead of falling back silently. Tested on a CPU-only build: fail-fast fires for --gpu/--vram, --gpu none and default still start the CPU engine (no regression). --- c/coli | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/c/coli b/c/coli index 05a14a7..8c8e557 100755 --- a/c/coli +++ b/c/coli @@ -156,6 +156,23 @@ def env_for(a): rt=plan["tiers"]["ram"]; vt=plan["tiers"]["vram"] gpu=f" · VRAM {format_bytes(vt['budget_bytes'])}" if has_cuda and vt["devices"] else " · CPU" print(f" {C.dim}[PLAN] RAM {format_bytes(rt['budget_bytes'])} · cap {rt['cache_slots_per_layer']}/layer{gpu}{C.r}",file=sys.stderr) + else: + # --gpu/--vram SENZA --auto-tier: prima venivano ignorati in silenzio e il run + # partiva CPU-only senza alcun avviso — benchmark "GPU" pubblicati per errore (#121). + if a.gpu is not None: + e.pop("COLI_GPU",None); e.pop("COLI_GPUS",None) + if a.gpu=="none": + e["COLI_CUDA"]="0"; e.pop("CUDA_EXPERT_GB",None); e.pop("CUDA_DENSE",None) + else: + if not cuda_binary(): + sys.exit(f"{C.yel}--gpu needs the CUDA build:{C.r} make glm CUDA=1 (this binary is CPU-only)") + e["COLI_CUDA"]="1" + if a.gpu!="auto": e["COLI_GPUS"]=a.gpu + e.setdefault("CUDA_DENSE","1") + if a.vram and a.gpu!="none": + if not cuda_binary(): + sys.exit(f"{C.yel}--vram needs the CUDA build:{C.r} make glm CUDA=1 (this binary is CPU-only)") + e["COLI_CUDA"]="1"; e["CUDA_EXPERT_GB"]=str(a.vram) return e # ---------- rendering markdown in STREAMING per il terminale ----------