okami.mom/strata

git clone https://git.nkp.pet/okami.mom/strata

xxDomanbench: community MI50 (gfx906) — Strata 0.1.38 speed and recall (#758)c97ad41eb

main
1.2 KiB33 linesraw
1"""Sample system RAM, swap and AMD GPU memory once per second during the trial.
2
3MI50 / ROCm adaptation: GPU memory via rocm-smi instead of nvidia-smi, and the
4GPU is the Vega 20 (MI50) at PCI 0000:07:00.0 — rocm-smi indexes it as GPU[0].
5Runs on the HOST (needs rocm-smi), writes telemetry.jsonl.
6"""
7import json
8import subprocess
9import sys
10import time
11from pathlib import Path
12
13
14def gpu_mem():
15    try:
16        out = subprocess.check_output(
17            ["rocm-smi", "--showmeminfo", "vram", "--showuse", "--showtemp", "--csv"],
18            text=True, stderr=subprocess.DEVNULL).strip()
19        return out
20    except Exception as error:  # noqa: BLE001
21        return f"rocm-smi error: {error}"
22
23
24with Path(sys.argv[1] if len(sys.argv) > 1 else "telemetry.jsonl").open("a") as output:
25    while True:
26        memory = {}
27        for line in Path("/proc/meminfo").read_text().splitlines():
28            key, value = line.split(":", 1)
29            if key in ("MemTotal", "MemAvailable", "SwapTotal", "SwapFree"):
30                memory[key + "_KiB"] = int(value.strip().split()[0])
31        output.write(json.dumps({"epoch_s": time.time(), "memory": memory, "gpu": gpu_mem()}) + "\n")
32        output.flush()
33        time.sleep(1)