mirror of
https://github.com/harvard-edge/cs249r_book.git
synced 2026-03-09 07:15:51 -05:00
Complete MLSYSIM v0.1.0 implementation with: - Documentation website (Quarto): landing page with animated hero and capability carousel, 4 tutorials (hello world, LLM serving, distributed training, sustainability), hardware/model/fleet/infra catalogs, solver guide, whitepaper, math foundations, glossary, and full quartodoc API reference - Typed registry system: Hardware (18 devices across 5 tiers), Models (15 workloads), Systems (fleets, clusters, fabrics), Infrastructure (grid profiles, rack configs, datacenters) - Core types: Pint-backed Quantity, Metadata provenance tracking, custom exception hierarchy (OOMError, SLAViolation) - SimulationConfig with YAML/JSON loading and pre-validation - Scenario system tying workloads to systems with SLA constraints - Multi-level evaluation scorecard (feasibility, performance, macro) - Examples, tests, and Jetson Orin NX spec fix (100 → 25 TFLOP/s) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
51 lines
1.9 KiB
Python
51 lines
1.9 KiB
Python
# generate_appendix.py
|
|
"""
|
|
mlsysim Appendix Generator
|
|
==========================
|
|
Generates Quarto-compatible Markdown tables for the textbook's backmatter.
|
|
Extracts live data from the mlsysim Hardware and Model registries.
|
|
"""
|
|
|
|
import sys
|
|
import os
|
|
from .core.constants import ureg, Q_
|
|
from .hardware.registry import Hardware
|
|
from .models.registry import Models
|
|
from .infra.registry import Infra
|
|
|
|
def fmt_q(q: Q_, precision: int = 1) -> str:
|
|
"""Format a quantity for the table."""
|
|
if q is None: return "---"
|
|
return f"{q.magnitude:,.{precision}f} {q.units:~P}"
|
|
|
|
def generate_hardware_appendix():
|
|
"""Generates the Hardware Specifications table for the appendix."""
|
|
header = "| Accelerator | Year | Peak FP16 | Memory BW | Memory Capacity | TDP |\n"
|
|
divider = "|:---|:---:|:---:|:---:|:---:|:---:|\n"
|
|
|
|
rows = []
|
|
# Cloud Tiers
|
|
for h in [Hardware.A100, Hardware.H100, Hardware.H200, Hardware.MI300X]:
|
|
row = f"| {h.name} | {h.release_year} | {fmt_q(h.compute.peak_flops)} | {fmt_q(h.memory.bandwidth)} | {fmt_q(h.memory.capacity)} | {fmt_q(h.tdp, 0)} |"
|
|
rows.append(row)
|
|
|
|
return header + divider + "\n".join(rows)
|
|
|
|
def generate_model_appendix():
|
|
"""Generates the Model Workload table for the appendix."""
|
|
header = "| Model | Architecture | Parameters | Inference FLOPS | Layers |\n"
|
|
divider = "|:---|:---:|:---:|:---:|:---:|\n"
|
|
|
|
rows = []
|
|
for m in [Models.GPT2, Models.GPT3, Models.ResNet50, Models.MobileNetV2]:
|
|
row = f"| {m.name} | {m.architecture} | {fmt_q(m.parameters)} | {fmt_q(m.inference_flops)} | {m.layers or '---'} |"
|
|
rows.append(row)
|
|
|
|
return header + divider + "\n".join(rows)
|
|
|
|
if __name__ == "__main__":
|
|
print("## Hardware Specifications Appendix\n")
|
|
print(generate_hardware_appendix())
|
|
print("\n\n## Model Workload Appendix\n")
|
|
print(generate_model_appendix())
|