mirror of
https://github.com/harvard-edge/cs249r_book.git
synced 2026-07-16 23:24:55 -05:00
No-backward-compat sweep, part 2. The module had been reduced to a
units-only re-export ('retired, do not add values'); per policy it is
now gone and every consumer reads the real home:
- 32 internal modules, the package __init__, and core/__init__ import
core.units (physics modules keep their own physics/constants)
- 43 book chapters' LEGO cells migrated (star imports, named imports,
and the appendix attribute style 'constants.VIDEO_*' -> units.*);
lego_focal_verify confirms identical pass/flag state to pre-sweep
(8 pre-existing structural flags, A/B-verified unchanged)
- tutorial/tools/test imports migrated (incl. binder test_units.py);
book tests' legacy-symbol scanner treats a missing constants.py as
'nothing defined'
- test_constants_allowlist.py rewritten as a deletion pin: the module
(and any shim for it) must never return; core.units must keep the
measurement surface (ureg, Q_, GB, BYTES_FP16, PRECISION_MAP, ...)
- test_mlsysim_registry_parity.py deleted: it compared registry values
against legacy constants 'before deletion' — that migration is
complete (registry gate list updated)
- Docs prose (DATA_MODEL, architecture, contributing) states the
deletion instead of describing a retired shim
749 passed; binder registry gate green; star import intact.
225 lines
4.9 KiB
Python
225 lines
4.9 KiB
Python
"""Shared fixtures for mlsysim test suite.
|
|
|
|
All hardware, model, fleet, and solver fixtures are defined here.
|
|
Pytest discovers this file automatically — no imports needed in test files.
|
|
"""
|
|
|
|
import pytest
|
|
|
|
from mlsysim.core.units import Q_
|
|
from mlsysim.engine.solvers import (
|
|
CheckpointModel,
|
|
ContinuousBatchingModel,
|
|
CompressionModel,
|
|
DataModel,
|
|
DistributedModel,
|
|
EconomicsModel,
|
|
EfficiencyModel,
|
|
InferenceScalingModel,
|
|
OrchestrationModel,
|
|
ReliabilityModel,
|
|
ResponsibleEngineeringModel,
|
|
ScalingModel,
|
|
SensitivitySolver,
|
|
ServingModel,
|
|
SingleNodeModel,
|
|
SustainabilityModel,
|
|
SynthesisSolver,
|
|
TailLatencyModel,
|
|
TopologyModel,
|
|
TransformationModel,
|
|
WeightStreamingModel,
|
|
)
|
|
from mlsysim.hardware.registry import Hardware
|
|
from mlsysim.infrastructure.registry import Grids, Infrastructure
|
|
from mlsysim.models.registry import Models
|
|
from mlsysim.models.types import TransformerWorkload
|
|
from mlsysim.systems.registry import Systems
|
|
from mlsysim.systems.types import NetworkFabric
|
|
|
|
|
|
# ── Hardware Fixtures ────────────────────────────────────────────
|
|
|
|
@pytest.fixture(scope="session")
|
|
def h100():
|
|
return Hardware.Cloud.H100
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def a100():
|
|
return Hardware.Cloud.A100
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def cerebras_cs3():
|
|
return Hardware.Cloud.Cerebras_CS3
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def jetson():
|
|
return Hardware.Edge.JetsonOrinNX
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def esp32():
|
|
return Hardware.Tiny.ESP32_S3
|
|
|
|
|
|
# ── Model / Workload Fixtures ───────────────────────────────────
|
|
|
|
@pytest.fixture(scope="session")
|
|
def resnet():
|
|
return Models.Vision.ResNet50
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def gpt3():
|
|
return Models.Language.GPT3
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def llama3_8b():
|
|
return Models.Language.Llama3_8B
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def llama3_70b():
|
|
return TransformerWorkload(
|
|
name="Llama-3-70B",
|
|
architecture="Transformer",
|
|
parameters=Q_("70e9 param"),
|
|
layers=80,
|
|
hidden_dim=8192,
|
|
heads=64,
|
|
)
|
|
|
|
|
|
# ── Fleet / System Fixtures ─────────────────────────────────────
|
|
|
|
@pytest.fixture(scope="session")
|
|
def research_cluster():
|
|
return Systems.Clusters.Research_256
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def frontier_cluster():
|
|
return Systems.Clusters.Frontier_8K
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def grid_quebec():
|
|
return Infrastructure.Grids.Quebec
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def grid_us_avg():
|
|
return Infrastructure.Grids.US_Avg
|
|
|
|
|
|
# ── Solver Fixtures ─────────────────────────────────────────────
|
|
# Each solver is stateless, so session scope is safe.
|
|
|
|
@pytest.fixture(scope="session")
|
|
def single_node_solver():
|
|
return SingleNodeModel()
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def serving_solver():
|
|
return ServingModel()
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def continuous_batching_solver():
|
|
return ContinuousBatchingModel()
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def weight_streaming_solver():
|
|
return WeightStreamingModel()
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def tail_latency_solver():
|
|
return TailLatencyModel()
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def checkpoint_solver():
|
|
return CheckpointModel()
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def distributed_solver():
|
|
return DistributedModel()
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def reliability_solver():
|
|
return ReliabilityModel()
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def economics_solver():
|
|
return EconomicsModel()
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def sustainability_solver():
|
|
return SustainabilityModel()
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def data_solver():
|
|
return DataModel()
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def scaling_solver():
|
|
return ScalingModel()
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def orchestration_solver():
|
|
return OrchestrationModel()
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def compression_solver():
|
|
return CompressionModel()
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def efficiency_solver():
|
|
return EfficiencyModel()
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def transformation_solver():
|
|
return TransformationModel()
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def topology_solver():
|
|
return TopologyModel()
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def inference_scaling_solver():
|
|
return InferenceScalingModel()
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def sensitivity_solver():
|
|
return SensitivitySolver()
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def synthesis_solver():
|
|
return SynthesisSolver()
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def responsible_engineering_solver():
|
|
return ResponsibleEngineeringModel()
|