Files
leleka/engine/strata/tools/test_setup_update_gpu.py
T
Pavlo RatushnyiandClaude Sonnet 5.5 87e2633afe engine/strata: bring the Strata subtree to upstream 41cf05a0 (engine 0.1.50) with the local patches re-applied
Documented tree replacement (the history has no git-subtree metadata): 3-way merge of the old subtree
(570201a:engine/strata) against upstream 41cf05a06a25dd29103b7b27a2279a3f60c21876 (2026-10-25), merge base =
the old pin d9ab8435 (tree-identical to upstream 5b734e42; d9ab8435 is not an ancestor of upstream main).

Local patches re-applied by hand where they conflicted (15 files): STRATA_CUDA_STATIC profile, experimental KAR
experts and KAR PLE arms, keyless V-only arm (now beside upstream's K8V4 hybrid KV and fused norm+rope). Details,
conflict table and left-out files are in docs/upstream.md.

Left out (weights, captures, logs, media): new bench/results (2022 files), binary media and app assets (61),
docs/work/evidence (24), *.bin / *.gguf data files, and the 7 files the first import already left out.

scripts/build-cpu.sh: build the 11 CPU tests upstream registered since the old pin (they ran as "Not Run").
Checked: build-cpu.sh 16/16 ctest in WSL; sm_86 CUDA objects of the patched files compile, also with the KAR
macros on. No GPU run, no quality gate.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-25 12:49:15 +01:00

54 lines
2.0 KiB
Python

"""#1485: the card an engine update compiles for is one the installed models use (and CUDA 13 can compile for), not
the card with the most VRAM - a Tesla V100 beside two RTX 4090s made ./update.sh build for sm_70 with CUDA 13.
python -m unittest tools.test_setup_update_gpu -v
"""
import json
import sys
import tempfile
import unittest
from pathlib import Path
from unittest import mock
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
import setup # noqa: E402
V100 = {"index": 1, "name": "Tesla V100-PCIE-32GB", "vram_gb": 32.0, "arch": "70", "driver": "580"}
R4090 = lambda i: {"index": i, "name": "RTX 4090", "vram_gb": 24.0, "arch": "89", "driver": "580"} # noqa: E731
class UpdateEngineGpu(unittest.TestCase):
def pick(self, found, configs, toolkit=13, pinned=None):
tmp = tempfile.TemporaryDirectory()
self.addCleanup(tmp.cleanup)
paths = []
for n, cfg in enumerate(configs):
p = Path(tmp.name) / f"strata-{n}.json"
p.write_text(json.dumps(cfg))
paths.append(p)
with mock.patch.object(setup, "gpus", return_value=found), \
mock.patch.object(setup, "installed_configs", return_value=paths), \
mock.patch.object(setup, "GPU_PICK", pinned):
return setup.update_engine_gpu(toolkit)
def test_the_models_cards_not_the_biggest_one(self):
g = self.pick([R4090(0), V100, R4090(2)], [{"exe": "x", "args": [], "gpu": [0, 2]}])
self.assertEqual(g["arch"], "89")
self.assertEqual(g["count"], 3)
def test_a_card_cuda_13_cannot_compile_for_is_left_out_without_a_config(self):
self.assertEqual(self.pick([R4090(0), V100], [])["index"], 0)
def test_the_cuda_12_engine_may_take_the_volta(self):
self.assertEqual(self.pick([R4090(0), V100], [], toolkit=12)["index"], 1)
def test_only_a_volta_is_still_taken(self):
self.assertEqual(self.pick([V100], [])["index"], 1)
def test_no_nvidia_card(self):
self.assertIsNone(self.pick([], []))
if __name__ == "__main__":
unittest.main()