SPB Git

spb/modelmap Public License

Internal cartography of local LLMs on Apple Silicon — registered, gated, negative-first. Public atlas at modelmap.io.

Python 66.3% JavaScript 24.5% CSS 8.1% Shell 0.7%
2.4 KB · 72 lines python
Raw Blame History
1#!/usr/bin/env python32# =============================================================================3#  Project   : modelmap4#  File      : benchmarks/hardware_manifest.py5#  Purpose   : Record chip, cores, RAM, SSD, macOS + software versions per run6#  Author    : Simon-Pierre Boucher7#  Contact   : contact@spboucher.ai8#  Website   : https://modelmap.io9#  Created   : 2026-08-1210#  Modified  : 2026-08-1211#  Platform  : macOS / Apple Silicon (arm64)12#  License   : All rights reserved (research code)13# =============================================================================14"""Hardware manifest for reproducibility (charter §0.2).1516Every result file and every published map embeds this manifest so that any17number can be traced to the exact machine and software stack that produced it.18"""1920from __future__ import annotations2122import json23import platform24import subprocess25import sys26from importlib import metadata272829def _sysctl(key: str) -> str:30    try:31        return subprocess.run(32            ["sysctl", "-n", key], capture_output=True, text=True, check=True33        ).stdout.strip()34    except subprocess.CalledProcessError:35        return ""363738def _pkg_version(name: str) -> str | None:39    try:40        return metadata.version(name)41    except metadata.PackageNotFoundError:42        return None434445def manifest() -> dict:46    mem_bytes = int(_sysctl("hw.memsize") or 0)47    return {48        "author": "Simon-Pierre Boucher",49        "contact": "contact@spboucher.ai",50        "website": "https://modelmap.io",51        "chip": {52            "brand": _sysctl("machdep.cpu.brand_string"),53            "cores_total": int(_sysctl("hw.ncpu") or 0),54            "cores_performance": int(_sysctl("hw.perflevel0.physicalcpu") or 0),55            "cores_efficiency": int(_sysctl("hw.perflevel1.physicalcpu") or 0),56        },57        "memory": {"unified_gb": round(mem_bytes / 2**30, 1), "pagesize": int(_sysctl("hw.pagesize") or 0)},58        "os": {"system": platform.system(), "version": platform.mac_ver()[0], "arch": platform.machine()},59        "software": {60            "python": platform.python_version(),61            "numpy": _pkg_version("numpy"),62            "mlx": _pkg_version("mlx"),63            "torch": _pkg_version("torch"),64            "safetensors": _pkg_version("safetensors"),65        },66    }676869if __name__ == "__main__":70    json.dump(manifest(), sys.stdout, indent=2)71    print()72