rps-cuda/scripts/benchmark.py
2026-11-26 09:07:21 +03:00

18 lines
782 B
Python

"""Measure all six configurations specified in §8.5 on the GPU host."""
import json
import subprocess
import sys
import tempfile
from pathlib import Path
root = Path(__file__).resolve().parent.parent
config = json.loads((root / "config.example.json").read_bytes())
binary = Path(sys.argv[1]).resolve() if len(sys.argv) > 1 else root / "build/rps-server"
for width, height in ((1024, 48), (4096, 3072), (8192, 6144)):
for n in (4, 8):
config["simulation"].update(width=width, height=height, neighbors=n)
config["view"]["roi"].update(width=width, height=height)
with tempfile.NamedTemporaryFile(mode="w", suffix=".json") as f:
json.dump(config, f)
f.flush()
subprocess.run([binary, "--benchmark", f.name], check=True)