solvers.SingleNodeModel
solvers.SingleNodeModel()Resolves single-node hardware Roofline bounds and feasibility.
This model handles the ‘Iron Law’ of machine learning systems, calculating whether a model fits in memory and predicting its throughput based on arithmetic intensity.
Literature Source: Williams et al. (2009), “Roofline: An Insightful Visual Performance Model for Floating-Point Programs and Multicore Architectures.”
Methods
| Name | Description |
|---|---|
| solve | Calculate the Roofline performance profile for a single hardware node. |
solve
solvers.SingleNodeModel.solve(
model,
hardware,
batch_size=1,
precision='fp16',
efficiency=0.5,
raise_errors=False,
**kwargs,
)Calculate the Roofline performance profile for a single hardware node.
Thin wrapper that delegates to Engine.solve (the core Roofline implementation in engine/engine.py), exposing it through the resolver interface so it can participate in pipelines.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| model | Workload | The workload to profile. | required |
| hardware | HardwareNode | The accelerator node (compute, memory, interconnect specs). | required |
| batch_size | int | Samples per forward pass (>= 1). | 1 |
| precision | str | Numerical precision (‘fp32’, ‘fp16’, ‘int8’, …); sets bytes per parameter and selects the hardware’s precision FLOPS entry. | 'fp16' |
| efficiency | float | Software efficiency factor in (0, 1] applied to peak FLOPS. | 0.5 |
| raise_errors | bool | If True, raise OOMError on memory infeasibility instead of returning a profile with feasible=False. |
False |
| **kwargs | dict | Additional Engine.solve options such as training mode or sequence length. | {} |
Returns
| Name | Type | Description |
|---|---|---|
| PerformanceProfile | Latency breakdown, throughput, bottleneck, MFU, and memory footprint. |
See Also
mlsysim.engine.engine.Engine.solve : Generic node calculation.
Notes
Equation: T = max(F / (eta * peak), traffic / bandwidth) + overhead. This wrapper delegates the workload lowering, memory accounting, and constraint traces to Engine.solve.
Assumptions: architecture-derived activation traffic from Workload.activation_traffic_bytes and one forward step unless additional engine options select training. Efficiency scales compute capacity, not peak memory bandwidth. Excludes: explicit KV-aware serving and distributed collectives.
References
Williams, Waterman, and Patterson (2009), “Roofline.” https://doi.org/10.1145/1498765.1498785 (bibliography key: williams2009). Activation traffic and runtime taxes are separate modeling conventions.
Examples
>>> from mlsysim import Hardware, Models
>>> from mlsysim.solvers import SingleNodeModel
>>> r = SingleNodeModel().solve(Models.Language.Llama3_8B, Hardware.Cloud.H100)
>>> bool(r.feasible and r.latency.m_as("ms") > 0)
True