From 1736b558bd042af8df4d1cc56f97fc9f83d74e84 Mon Sep 17 00:00:00 2001 From: Niko1221 Date: Sat, 24 Oct 2026 13:04:44 +0200 Subject: [PATCH] setup: a NVIDIA driver older than CUDA 13 needs (528 to 579) runs the CUDA 12 engine by itself and says so in one line instead of stopping and naming a flag strata launch does not have (#3843); tests --- setup.py | 11 ++++++----- tools/test_setup_older_gpus.py | 23 ++++++++++++++++++----- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/setup.py b/setup.py index 83a09dcf..47e3fa48 100644 --- a/setup.py +++ b/setup.py @@ -1580,7 +1580,7 @@ def named_gpus(gpu, gpus) -> list: return [] -def cuda_choice(archs, cuda=None): +def cuda_choice(archs, cuda=None, driver=None): """The CUDA toolkit of one model's engine: (12 or 13, why). 13 (the ready-made engine) unless a card is older than CUDA 13 supports (Pascal / Volta: CUDA 13 cannot compile for them) - one engine runs per model, so its oldest card decides. `cuda` (--cuda 12|13) overrides it; setup recommends, it does not refuse (the caller warns).""" @@ -1595,6 +1595,9 @@ def cuda_choice(archs, cuda=None): if old: return 12, (f"sm_{old[0]} is older than CUDA 13 supports (it dropped Pascal and Volta): this model runs the " "experimental CUDA 12 engine") + if driver and CUDA12_MIN_DRIVER <= int(driver) < MIN_DRIVER: # #3843: a driver too old for CUDA 13 still runs the CUDA 12 engine + return 12, (f"the NVIDIA driver {driver} is older than CUDA 13 needs ({MIN_DRIVER}): this model runs the CUDA 12 engine " + f"(it works with driver {CUDA12_MIN_DRIVER} or newer; a newer driver from https://www.nvidia.com/drivers gives the CUDA 13 engine)") return 13, None @@ -8801,15 +8804,13 @@ def main() -> int: if multi: ok("GPUs: " + " + ".join(gpu_name(x) for x in chosen) + " together (the model's layers are split across them)") ok(f"GPU: {gpu['name']}, {gpu['vram_gb']:.1f} GB VRAM, compute capability {cc(gpu)}, driver {gpu['driver']}") - cuda_tk, why = cuda_choice(gpu["archs"], a.cuda) # one engine per model: its oldest card decides + cuda_tk, why = cuda_choice(gpu["archs"], a.cuda, driver_major(gpu)) # one engine per model: its oldest card decides if why: (warn if cuda_tk == 13 or str(a.cuda) == "12" else ok)(f"CUDA {cuda_tk}: {why}") min_driver = CUDA12_MIN_DRIVER if cuda_tk == 12 else MIN_DRIVER if driver_major(gpu) < min_driver: fail(f"the NVIDIA driver is too old ({gpu['driver']}; {min_driver} or newer is needed)", - "update it with the NVIDIA App or from https://www.nvidia.com/drivers, restart, and run this again" + - ("" if cuda_tk == 12 else f" (or --cuda 12: the experimental CUDA 12 engine runs with driver " - f"{CUDA12_MIN_DRIVER} or newer, docs/OLDER_GPUS.md)")) + "update it with the NVIDIA App or from https://www.nvidia.com/drivers, restart, and run this again") if gpu["vram_gb"] < 11: warn("less than 12 GB of " + ("GPU memory (this APU's carve-out + shared memory)" if gpu.get("uma") else "VRAM") + ": Strata will run, but most experts stay on the CPU and it will be slow") diff --git a/tools/test_setup_older_gpus.py b/tools/test_setup_older_gpus.py index 72d9a97c..d11419e1 100644 --- a/tools/test_setup_older_gpus.py +++ b/tools/test_setup_older_gpus.py @@ -39,6 +39,14 @@ class Choice(unittest.TestCase): self.assertEqual(tk, 12, archs) self.assertIn(f"sm_{min(archs)} is older than CUDA 13 supports", why) + def test_a_driver_too_old_for_cuda13_gets_the_cuda12_engine(self): # #3843 + self.assertEqual(setup.cuda_choice([86], None, 576)[0], 12) + self.assertIn("older than CUDA 13 needs", setup.cuda_choice([86], None, 576)[1]) + self.assertEqual(setup.cuda_choice([86], None, 580), (13, None)) + self.assertEqual(setup.cuda_choice([86], None, 0), (13, None)) # driver unknown: as before + self.assertEqual(setup.cuda_choice([86], None, 500), (13, None)) # too old for both: setup stops with the driver message + self.assertEqual(setup.cuda_choice([86], "13", 576)[0], 13) # chosen by hand: kept + def test_the_override_is_honored_with_a_warning(self): tk, why = setup.cuda_choice([70], "13") self.assertEqual(tk, 13) # recommend, never force: kept, and said @@ -225,12 +233,17 @@ class Install(unittest.TestCase): self.assertEqual((calls, cfg["cuda"]), ([12], 12)) self.assertIn("--cuda 12 (as you chose", out) - def test_an_old_driver_is_told_about_cuda12(self): - code, out, _, _, _ = self.run_setup(127.8, [card(0, "NVIDIA GeForce RTX 4090", 24.0, "89", "550.54")], + def test_an_old_driver_gets_cuda12_by_itself(self): # #3843: said in one line, not a stop + code, out, cfg, calls, _ = self.run_setup(127.8, [card(0, "NVIDIA GeForce RTX 4090", 24.0, "89", "550.54")], + argv_for("qwen", "IQ3_XXS")) + self.assertEqual(code, 0, out[-3000:]) + self.assertEqual((calls, cfg["cuda"]), ([12], 12)) + self.assertIn("older than CUDA 13 needs (580): this model runs the CUDA 12 engine", out) + code, out, _, _, _ = self.run_setup(127.8, [card(0, "NVIDIA GeForce RTX 4090", 24.0, "89", "470.10")], argv_for("qwen", "IQ3_XXS")) - self.assertEqual(code, 1) - self.assertIn("580 or newer is needed", out) - self.assertIn("--cuda 12", out) + self.assertEqual(code, 1) # too old for both: the stop stays + self.assertIn("is too old", out) + self.assertNotIn("--cuda 12", out) code, out, cfg, calls, _ = self.run_setup(127.8, [card(0, "NVIDIA GeForce RTX 4090", 24.0, "89", "550.54")], argv_for("qwen", "IQ3_XXS") + ["--cuda", "12"]) self.assertEqual(code, 0, out[-3000:])