Files
cs249r_book/mlsysim/core/deployment.py
Vijay Janapa Reddi c30f2a3bfd refactor: move mlsysim to repo root, extract fmt module from viz
Moves the mlsysim package from book/quarto/mlsysim/ to the repo root
so it is importable as a proper top-level package across the codebase.

Key changes:
- mlsysim/fmt.py: new top-level module for all formatting helpers (fmt,
  sci, check, md_math, fmt_full, fmt_split, etc.), moved out of viz/
- mlsysim/viz/__init__.py: now exports only plot utilities; dashboard.py
  (marimo-only) is no longer wildcard-exported and must be imported
  explicitly by marimo labs
- mlsysim/__init__.py: added `from . import fmt` and `from .core import
  constants`; removed broken `from .viz import plots as viz` alias
- execute-env.yml: fixed PYTHONPATH from "../../.." to "../.." so
  chapters resolve to repo root, not parent of repo
- 51 QMD files: updated `from mlsysim.viz import <fmt-fns>` to
  `from mlsysim.fmt import <fmt-fns>`
- book/quarto/mlsys/: legacy shadow package contents cleaned up;
  stub __init__.py remains for backward compat
- All Vol1 and Vol2 chapters verified to build with `binder build pdf`
2026-03-01 17:24:11 -05:00

43 lines
1012 B
Python

# book/quarto/mlsysim/deployment.py
# Hierarchical Deployment Tier Definitions for MLSys Textbook
from dataclasses import dataclass
from ..core.constants import (
ureg, Q_,
SMARTPHONE_RAM_GB, MCU_RAM_KIB, CLOUD_MEM_GIB,
TINY_MEM_KIB
)
@dataclass(frozen=True)
class DeploymentTier:
name: str
ram: Q_
storage: Q_
typical_latency_budget: Q_
class Tiers:
Cloud = DeploymentTier(
name="Cloud",
ram=512 * ureg.GB,
storage=10 * ureg.TB,
typical_latency_budget=200 * ureg.ms
)
Edge = DeploymentTier(
name="Edge",
ram=32 * ureg.GB,
storage=1 * ureg.TB,
typical_latency_budget=50 * ureg.ms
)
Mobile = DeploymentTier(
name="Mobile",
ram=SMARTPHONE_RAM_GB,
storage=256 * ureg.GB,
typical_latency_budget=30 * ureg.ms
)
Tiny = DeploymentTier(
name="TinyML",
ram=MCU_RAM_KIB,
storage=4 * ureg.MB,
typical_latency_budget=100 * ureg.ms
)