seal-cell / scripts /hardware_info.py
sroecker's picture
Deploy Seal Cell CPU demo on ZeroGPU
73bd12f verified
Raw History Blame Contribute Delete
1.03 kB
"""Record reproducible latency context without reading user/device identifiers."""
import json
import platform
import subprocess
from pathlib import Path
import torch
info = {
"platform": platform.platform(),
"python": platform.python_version(),
"machine": platform.machine(),
"torch_threads": 4,
"timing_context": "interactive workstation; not isolated; brief concurrent dashboard and MPS compatibility checks",
}
if platform.system() == "Darwin":
for key, sysctl_name in [
("cpu", "machdep.cpu.brand_string"),
("memory_bytes", "hw.memsize"),
("logical_cpus", "hw.ncpu"),
]:
value = subprocess.check_output(["sysctl", "-n", sysctl_name], text=True).strip()
info[key] = value if key == "cpu" else int(value)
if torch.backends.mps.is_available():
info["gpu_name"] = torch.backends.mps.get_name()
info["gpu_cores"] = torch.backends.mps.get_core_count()
Path("reports/hardware.json").write_text(json.dumps(info, indent=2) + "\n")
print(json.dumps(info))