engine.solvers.storage
engine.solvers.storage
Storage solvers: what a training fleet reads, saves, and pays to move.
Domain implementations behind mlsysim.solvers (the public import path, derived from engine.solvers.__init__); kept per-domain so the logic stays reviewable. Each model is a bandwidth or rate bound: it counts bytes and divides by a stated rate, and leaves queueing, contention, and protocol overheads out.
Classes
| Name | Description |
|---|---|
| CheckpointStormModel | Synchronized saves when every replica writes its own copy of the state. |
| DataStallModel | Input wait per step when delivery and compute run in sequence or overlap. |
| HostIoCpuModel | Host CPU time spent issuing and completing I/O requests. |
| InputDemandModel | The input bandwidth a fleet draws: consumers x busy fraction x batch bytes / compute time. |
| ObjectStorageBillModel | The object-storage bill beyond capacity: egress per read, GET requests, archive retrieval. |
| PrefetchDepthModel | Ready batches a prefetch queue needs to cover a tier’s tail read latency. |
| StorageFootprintModel | The bytes a training run reads once and the bytes it saves again and again. |
| StreamVsStageModel | Streaming every epoch from remote object storage against staging once per run. |
| SyntheticFootprintModel | Generated training data at rest and in motion. |
| TieredCacheModel | Mean service of a two-tier cache: E[T] = h T_hit + (1 - h) T_miss. |
| TieredCheckpointModel | A checkpoint staged on each node’s local storage, then drained to a durable tier. |
| UtilizationLossModel | Dollars of accelerator time idled when utilization falls from one level to another. |
CheckpointStormModel
engine.solvers.storage.CheckpointStormModel()Synchronized saves when every replica writes its own copy of the state.
replicas copies of the full resumable state cross one shared ingest bandwidth; writing one logical copy, split across the ranks that own it, moves the state once. The ratio is the replica count.
Methods
| Name | Description |
|---|---|
| solve | Compare replicated checkpoint traffic with one logical state copy. |
solve
engine.solvers.storage.CheckpointStormModel.solve(
state_bytes,
replicas,
ingest_bandwidth,
)Compare replicated checkpoint traffic with one logical state copy.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| state_bytes | Quantity | Positive size of one resumable state, in bytes. | required |
| replicas | int | Positive number of identical copies written concurrently. | required |
| ingest_bandwidth | Quantity | Positive shared aggregate ingest bandwidth, in bytes/s. | required |
Returns
| Name | Type | Description |
|---|---|---|
| CheckpointStormResult | Logical and replicated bytes, transfer times in seconds, and the dimensionless replicated/single-copy slowdown. |
Notes
Equation: Storm bytes = replicas * state_bytes; each transfer time is its bytes divided by the same ingest bandwidth.
Assumptions: Every replica writes a complete identical state to one shared bandwidth-limited sink.
Excludes: Deduplication, per-client bandwidth limits, queueing, and metadata operations.
References
Derivation: Identical complete state copies add their bytes at the shared sink. Dividing both byte totals by the same bandwidth makes the time ratio equal the copy count.
Examples
>>> from mlsysim.core.units import Q_
>>> from mlsysim.solvers import CheckpointStormModel
>>> r = CheckpointStormModel().solve(Q_(10, "GB"), 2, Q_(1, "GB/s"))
>>> assert r.storm_time == r.single_copy_time * 2DataStallModel
engine.solvers.storage.DataStallModel()Input wait per step when delivery and compute run in sequence or overlap.
In sequence a step costs delivery plus compute; overlapped, the loader fetches the next batch during compute, so a step costs the longer of the two. The stall is the share of the step not spent computing.
Methods
| Name | Description |
|---|---|
| solve | Compare sequential delivery with ideally overlapped input and compute. |
solve
engine.solvers.storage.DataStallModel.solve(compute_time, io_time)Compare sequential delivery with ideally overlapped input and compute.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| compute_time | Quantity | Positive time to compute one batch. | required |
| io_time | Quantity | Nonnegative time to deliver one batch; compatible with compute_time. | required |
Returns
| Name | Type | Description |
|---|---|---|
| DataStallResult | Sequential and overlapped step durations, with dimensionless fractions of each step spent waiting for input. |
Notes
Equation: Sequential step = compute + I/O; overlapped step = max(compute, I/O). Stall fraction = (step - compute)/step in each schedule.
Assumptions: The overlapped pipeline is in steady state and independent stages can run simultaneously.
Excludes: Pipeline startup, scheduling overhead, shared-resource contention, and variation across batches.
References
Derivation: Sequential stages add durations. Ideal overlap completes when the slower stage finishes. Subtracting useful compute from either step gives its input wait, which is normalized by that step duration.
Examples
>>> from mlsysim.core.units import Q_
>>> from mlsysim.solvers import DataStallModel
>>> r = DataStallModel().solve(Q_(2, "s"), Q_(1, "s"))
>>> assert r.overlapped_step <= r.sequential_stepHostIoCpuModel
engine.solvers.storage.HostIoCpuModel()Host CPU time spent issuing and completing I/O requests.
Each request costs a stated CPU service time on the host; at a request rate r the host spends r x service CPU-seconds per second, the number of cores kept busy by data movement alone.
Methods
| Name | Description |
|---|---|
| solve | Convert request rates and host service times into occupied CPU cores. |
solve
engine.solvers.storage.HostIoCpuModel.solve(request_rate, service_times)Convert request rates and host service times into occupied CPU cores.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| request_rate | float | Nonnegative requests per second, supplied as a scalar. | required |
| service_times | dict of str to Quantity | Named nonnegative CPU service times per request, convertible to seconds. | required |
Returns
| Name | Type | Description |
|---|---|---|
| HostIoCpuResult | Request rate and CPU-seconds per second for each service-time scenario; the latter equals fully occupied core equivalents. |
Notes
Equation: CPU-seconds per second = request_rate * service_time_in_seconds.
Assumptions: Each request consumes the stated CPU service independently; time is CPU time, not wall-clock I/O latency.
Excludes: CPU saturation, scheduling overhead, contention, and parallel execution within a request.
References
Derivation: Requests per second times CPU-seconds per request cancels the request unit and yields CPU-seconds per second. One such unit is one continuously occupied core.
Examples
>>> from mlsysim.core.units import Q_
>>> from mlsysim.solvers import HostIoCpuModel
>>> r = HostIoCpuModel().solve(100, {"path": Q_(1, "ms")})
>>> assert r.cpu_seconds_per_second["path"] > 0InputDemandModel
engine.solvers.storage.InputDemandModel()The input bandwidth a fleet draws: consumers x busy fraction x batch bytes / compute time.
Each consumer reads a distinct batch of samples_per_step samples of bytes_per_sample every step_time of compute; busy_fraction is the share of wall-clock time spent computing.
Methods
| Name | Description |
|---|---|
| solve | Compute aggregate input bandwidth demanded by active consumers. |
solve
engine.solvers.storage.InputDemandModel.solve(
consumers,
samples_per_step,
bytes_per_sample,
step_time,
busy_fraction=1.0,
)Compute aggregate input bandwidth demanded by active consumers.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| consumers | int | Nonnegative independent consumer count. | required |
| samples_per_step | int | Nonnegative samples in each consumer batch. | required |
| bytes_per_sample | Quantity | Nonnegative stored bytes per sample. | required |
| step_time | Quantity | Positive compute time per batch. | required |
| busy_fraction | float | Dimensionless active fraction in [0, 1]; default 1 uses continuous compute. | 1.0 |
Returns
| Name | Type | Description |
|---|---|---|
| InputDemandResult | Per-consumer batch bytes and aggregate average bandwidth with byte/time dimensions. |
Notes
Equation: Batch bytes = samples_per_step * bytes_per_sample; bandwidth = consumers * batch_bytes * busy_fraction / step_time.
Assumptions: Consumers read distinct batches at the same fixed rate; the busy fraction scales average demand rather than peak bursts.
Excludes: Caching, repeated samples, preprocessing expansion, and correlated arrival bursts.
References
Derivation: Samples per batch times bytes per sample gives one consumer’s transfer volume. Dividing by compute time gives its active rate; consumer count and busy fraction scale aggregate average demand.
Examples
>>> from mlsysim.core.units import Q_
>>> from mlsysim.solvers import InputDemandModel
>>> r = InputDemandModel().solve(2, 4, Q_(1, "MB"), Q_(1, "s"))
>>> assert r.bandwidth * Q_(1, "s") == r.batch_bytes * 2ObjectStorageBillModel
engine.solvers.storage.ObjectStorageBillModel()The object-storage bill beyond capacity: egress per read, GET requests, archive retrieval.
Capacity is billed per byte-month; every read that leaves the region or provider pays egress per byte; each file read pays a GET fee; an archive restore pays a retrieval fee and then egress for one read.
Methods
| Name | Description |
|---|---|
| solve | Price capacity, transfer, requests, and an archive restore separately. |
solve
engine.solvers.storage.ObjectStorageBillModel.solve(
dataset_bytes,
storage_rate,
billing_period,
egress_rate,
reads,
files,
request_fee,
requests_per_fee,
retrieval_rate,
)Price capacity, transfer, requests, and an archive restore separately.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| dataset_bytes | Quantity | Nonnegative stored dataset size, in bytes. | required |
| storage_rate | Quantity | Nonnegative capacity price in currency/(byte*time). | required |
| billing_period | Quantity | Nonnegative capacity billing duration. | required |
| egress_rate | Quantity | Nonnegative currency per byte transferred out. | required |
| reads | int | Nonnegative complete dataset reads charged egress. | required |
| files | int | Nonnegative total GET requests to bill; not multiplied by reads. | required |
| request_fee | Quantity | Nonnegative currency fee for requests_per_fee requests. | required |
| requests_per_fee | int | Positive request-count billing unit. | required |
| retrieval_rate | Quantity | Nonnegative archive retrieval charge in currency/byte. | required |
Returns
| Name | Type | Description |
|---|---|---|
| ObjectStorageBillResult | Separate costs as USD scalars: storage, egress, requests, archive retrieval, and archive restore including one egress read. |
Notes
Equation: Storage = bytes * rate * period; egress = bytes * reads * egress_rate; requests = files * fee/requests_per_fee; restore = retrieval + one egress.
Assumptions: Prices are linear and supplied by the caller. The files input already counts the requests that should be billed.
Excludes: Provider discounts, minimum storage periods, taxes, tiered pricing, and request retries.
References
Derivation: Capacity charges multiply stored bytes by residence time and unit price. Transfer and retrieval charges multiply moved bytes by their prices; request charges prorate the quoted fee by its request unit.
Examples
>>> from mlsysim.core.units import Q_
>>> from mlsysim.solvers import ObjectStorageBillModel
>>> r = ObjectStorageBillModel().solve(Q_(1, "GB"), Q_(1, "USD/GB/day"),
... Q_(1, "day"), Q_(1, "USD/GB"), 2, 10, Q_(1, "USD"),
... 10, Q_(1, "USD/GB"))
>>> assert r.egress_cost == r.egress_per_read * 2PrefetchDepthModel
engine.solvers.storage.PrefetchDepthModel()Ready batches a prefetch queue needs to cover a tier’s tail read latency.
One read at a tier’s tail latency spans latency / compute_time compute windows, so the queue needs the ceiling of that many ready batches. A deeper safety depth costs depth x batch of host memory per consumer.
Methods
| Name | Description |
|---|---|
| solve | Size ready-batch buffers from specified tail-latency scenarios. |
solve
engine.solvers.storage.PrefetchDepthModel.solve(
compute_time,
tail_latencies,
batch_bytes,
safety_depth,
consumers_per_node,
)Size ready-batch buffers from specified tail-latency scenarios.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| compute_time | Quantity | Positive time to consume one batch. | required |
| tail_latencies | dict of str to Quantity | Named nonnegative read-latency scenarios, with time units. | required |
| batch_bytes | Quantity | Nonnegative bytes retained per ready batch. | required |
| safety_depth | int | Nonnegative chosen allocation depth; independent of computed depths. | required |
| consumers_per_node | int | Nonnegative consumers sharing one host. | required |
Returns
| Name | Type | Description |
|---|---|---|
| PrefetchDepthResult | Latency spans and ceiling depths per scenario; allocated buffer bytes per consumer and node. |
Notes
Equation: Required depth for scenario k = ceil(latency[k]/compute_time). Allocated buffer = safety_depth * batch_bytes per consumer.
Assumptions: Ready batches cover deterministic compute windows; safety_depth is supplied, not automatically set to the largest required depth.
Excludes: Read throughput limits, batch-size variation, and correlated latency tails across consumers.
References
Derivation: A read spanning multiple compute windows needs one ready batch per window, rounded upward. Buffer capacity instead uses the separately chosen safety depth and sums identical consumer allocations.
Examples
>>> from mlsysim.core.units import Q_
>>> from mlsysim.solvers import PrefetchDepthModel
>>> r = PrefetchDepthModel().solve(Q_(1, "s"), {"tail": Q_(2, "s")},
... Q_(10, "MB"), 3, 2)
>>> assert r.buffer_per_node == r.buffer_per_consumer * 2StorageFootprintModel
engine.solvers.storage.StorageFootprintModel()The bytes a training run reads once and the bytes it saves again and again.
A resumable checkpoint holds bytes_per_param for every parameter and is written once per save interval, so a run of duration D saves D / interval times. Against a corpus read once, the written bytes can exceed the read bytes by orders of magnitude. The corpus is packaged into shards of shard_bytes; the archive keeps every archive_every-th checkpoint (and the final one when the count is not a multiple) plus the source and the tokenized corpus.
Methods
| Name | Description |
|---|---|
| solve | Account for checkpoint writes, corpus reads, and retained archive bytes. |
solve
engine.solvers.storage.StorageFootprintModel.solve(
parameters,
bytes_per_param,
corpus_bytes,
source_bytes,
run_duration,
save_interval,
shard_bytes,
archive_every,
)Account for checkpoint writes, corpus reads, and retained archive bytes.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| parameters | Quantity | Nonnegative parameter count, in param. | required |
| bytes_per_param | Quantity | Checkpoint bytes per parameter, including the desired optimizer state. | required |
| corpus_bytes | Quantity | Positive tokenized corpus size, in bytes; read once over the run. | required |
| source_bytes | Quantity | Nonnegative original source size, in bytes. | required |
| run_duration | Quantity | Positive elapsed run duration, convertible to seconds. | required |
| save_interval | Quantity | Positive time between saves. | required |
| shard_bytes | Quantity | Positive nominal corpus shard size, in bytes. | required |
| archive_every | int | Positive archive stride in checkpoints. | required |
Returns
| Name | Type | Description |
|---|---|---|
| StorageFootprintResult | Checkpoint and archive bytes, save and shard counts, write/read ratio, and average corpus read rate in MB/s. |
See Also
mlsysim.physics.quantities.memory_from_params : Convert a parameter count and byte width to a storage quantity.
Notes
Equation: Checkpoint C = parameters * bytes_per_param; saves N = floor(D/I); written bytes = N*C; retained checkpoints = ceil(N/archive_every). Archive bytes add retained checkpoints, source, and corpus.
Assumptions: The corpus is read once; every save has identical size. The shard count uses round(corpus_bytes/shard_bytes), not a capacity ceiling.
Excludes: Replication, compression, partial final checkpoints, rereads, and storage-service overhead.
References
Derivation: Multiply fixed checkpoint size by completed save intervals. Archive retention counts every requested stride and one final retained save; source and tokenized corpus occupy additional storage.
Examples
>>> from mlsysim.core.units import Q_
>>> from mlsysim.solvers import StorageFootprintModel
>>> r = StorageFootprintModel().solve(Q_(10, "param"), Q_(2, "byte/param"),
... Q_(100, "byte"), Q_(20, "byte"), Q_(4, "s"), Q_(1, "s"),
... Q_(10, "byte"), 2)
>>> assert r.checkpoint_bytes_written == r.checkpoint_bytes * r.savesStreamVsStageModel
engine.solvers.storage.StreamVsStageModel()Streaming every epoch from remote object storage against staging once per run.
Both options keep the dataset in object storage as the source of truth. Streaming pays egress for every epoch of every run; staging adds a year of local capacity and pays egress once per run. They break even where the streaming egress per run equals staging’s extra cost per run.
Methods
| Name | Description |
|---|---|
| solve | Compare repeated remote reads with one local staging transfer per run. |
solve
engine.solvers.storage.StreamVsStageModel.solve(
dataset_bytes,
epochs,
runs_per_year,
object_rate,
local_rate,
egress_rate,
year,
)Compare repeated remote reads with one local staging transfer per run.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| dataset_bytes | Quantity | Positive dataset size, in bytes. | required |
| epochs | int | Nonnegative complete dataset passes per run. | required |
| runs_per_year | int | Positive runs in the accounting period. | required |
| object_rate | Quantity | Nonnegative source storage price in currency/(byte*time). | required |
| local_rate | Quantity | Nonnegative local storage price in currency/(byte*time). | required |
| egress_rate | Quantity | Positive remote transfer price in currency/byte. | required |
| year | Quantity | Positive accounting period duration; normally one year. | required |
Returns
| Name | Type | Description |
|---|---|---|
| StreamVsStageResult | USD cost components, stream-minus-stage savings, and the dimensionless epoch count at equal modeled cost. |
Notes
Equation: Stream = source_storage + runs * epochs * bytes * egress_rate; stage = source_storage + local_storage + runs * bytes * egress_rate.
Assumptions: Both choices keep remote source storage. Local capacity is billed for the full period; each staged run transfers the dataset once.
Excludes: Local I/O costs, staging delay, cache persistence across runs, and bandwidth-dependent performance differences.
References
Derivation: Remote source capacity is common to both options and cancels at break-even. Staging adds local capacity and one transfer per run; streaming instead pays for a transfer on every epoch.
Examples
>>> from mlsysim.core.units import Q_
>>> from mlsysim.solvers import StreamVsStageModel
>>> r = StreamVsStageModel().solve(Q_(1, "GB"), 2, 1,
... Q_(1, "USD/GB/day"), Q_(1, "USD/GB/day"), Q_(1, "USD/GB"),
... Q_(1, "day"))
>>> assert r.savings == r.stream_cost - r.stage_costSyntheticFootprintModel
engine.solvers.storage.SyntheticFootprintModel()Generated training data at rest and in motion.
Each sample carries provenance metadata (a fraction of its payload) at rest; the pipeline writes payload and metadata once and reads the payload once per verification pass.
Methods
| Name | Description |
|---|---|
| solve | Count generated payload, provenance storage, and verification reads. |
solve
engine.solvers.storage.SyntheticFootprintModel.solve(
payload_bytes,
provenance_overhead,
verification_passes,
)Count generated payload, provenance storage, and verification reads.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| payload_bytes | Quantity | Positive total generated payload size, in bytes. | required |
| provenance_overhead | float | Nonnegative metadata bytes as a dimensionless fraction of payload. | required |
| verification_passes | int | Nonnegative full-payload verification read count. | required |
Returns
| Name | Type | Description |
|---|---|---|
| SyntheticFootprintResult | Stored bytes, verification-read bytes, total pipeline bytes, and dimensionless capacity and traffic amplification. |
Notes
Equation: Stored = payload*(1+overhead); verification = payload*passes; pipeline = stored + verification.
Assumptions: Payload and metadata are written once; each verification pass reads payload only.
Excludes: Intermediate generations, failed attempts, metadata rereads, compression, and replication.
References
Derivation: Stored volume is payload plus metadata. The pipeline writes that volume once and additionally reads the payload on each verification pass; those disjoint transfers add to total byte traffic.
Examples
>>> from mlsysim.core.units import Q_
>>> from mlsysim.solvers import SyntheticFootprintModel
>>> r = SyntheticFootprintModel().solve(Q_(1, "GB"), 0.1, 2)
>>> assert r.pipeline_bytes == r.stored_bytes + r.verification_bytesTieredCacheModel
engine.solvers.storage.TieredCacheModel()Mean service of a two-tier cache: E[T] = h T_hit + (1 - h) T_miss.
With service times in units of one hit, E[T] = h + (1 - h) x penalty, and the delivered rate is 1 / E[T] of the all-hit rate. Given tier bandwidths, the penalty is their ratio and the delivered rate is the hot bandwidth times that fraction (time per byte averaged over the mix).
Methods
| Name | Description |
|---|---|
| solve | Average hit and miss service time for a two-tier read mixture. |
solve
engine.solvers.storage.TieredCacheModel.solve(
hit_rate,
miss_penalty=None,
hot_bandwidth=None,
miss_bandwidth=None,
)Average hit and miss service time for a two-tier read mixture.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| hit_rate | float | Dimensionless byte-weighted hit fraction in [0, 1]. | required |
| miss_penalty | float | Positive miss/hit service-time ratio, required unless both bandwidths are supplied. | None |
| hot_bandwidth | Quantity | Positive hot-tier bandwidth in bytes/s; use together with miss_bandwidth. | None |
| miss_bandwidth | Quantity | Positive miss-tier bandwidth in bytes/s; overrides miss_penalty when both are supplied. | None |
Returns
| Name | Type | Description |
|---|---|---|
| TieredCacheResult | Mean service relative to a hit, delivered fraction of hot-tier rate, and delivered GB/s when bandwidths are supplied. |
Notes
Equation: Mean normalized service = h + (1-h)*miss_penalty; delivered fraction = 1/mean. With bandwidths, average seconds/byte then invert.
Assumptions: The same byte volume determines hit and miss shares. Each miss uses miss-tier service alone; the hot and miss costs are alternatives.
Excludes: Queueing, additional lookup costs, concurrent independent tier service, and eviction policy.
References
Derivation: Average time per byte over mutually exclusive hit and miss outcomes, then invert to obtain bytes per time. Averaging bandwidths directly would not conserve the service time of the byte mixture.
Examples
>>> from mlsysim.core.units import Q_
>>> from mlsysim.solvers import TieredCacheModel
>>> r = TieredCacheModel().solve(1.0, miss_penalty=4.0)
>>> assert r.delivered_fraction == 1.0TieredCheckpointModel
engine.solvers.storage.TieredCheckpointModel()A checkpoint staged on each node’s local storage, then drained to a durable tier.
Each node writes its shard (checkpoint / nodes) to local storage and training pauses only for that write. The durable copy proceeds in the background at the shared tier’s aggregate bandwidth, which is the same time as each node’s shard at its per-node share of that bandwidth.
Methods
| Name | Description |
|---|---|
| solve | Separate local checkpoint pause from background durable drain time. |
solve
engine.solvers.storage.TieredCheckpointModel.solve(
checkpoint_bytes,
nodes,
local_bandwidth,
durable_bandwidth,
save_interval,
)Separate local checkpoint pause from background durable drain time.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| checkpoint_bytes | Quantity | Positive full checkpoint size, in bytes. | required |
| nodes | int | Positive number of equally loaded writer nodes. | required |
| local_bandwidth | Quantity | Positive local write bandwidth per node, in bytes/s. | required |
| durable_bandwidth | Quantity | Positive aggregate durable-tier bandwidth, in bytes/s. | required |
| save_interval | Quantity | Positive time between checkpoints. | required |
Returns
| Name | Type | Description |
|---|---|---|
| TieredCheckpointResult | Shard size, local write and durable drain times in seconds, per-node durable bandwidth, and local pause fraction. |
Notes
Equation: Per-node shard = C/N; pause = C/(N*local_bandwidth); drain = C/durable_bandwidth; pause fraction = pause/save_interval.
Assumptions: All nodes write equal shards concurrently. Background drain does not reduce the stated local bandwidth.
Excludes: Backpressure when drain outlasts the save interval, replication, queueing, and durable-tier failure recovery.
References
Derivation: Equal sharding divides local write volume by node count. The durable tier still receives the entire checkpoint, so its drain uses aggregate bandwidth without another division by nodes.
Examples
>>> from mlsysim.core.units import Q_
>>> from mlsysim.solvers import TieredCheckpointModel
>>> r = TieredCheckpointModel().solve(Q_(100, "GB"), 2,
... Q_(10, "GB/s"), Q_(5, "GB/s"), Q_(1, "minute"))
>>> assert r.per_node_shard * 2 == r.checkpoint_bytesUtilizationLossModel
engine.solvers.storage.UtilizationLossModel()Dollars of accelerator time idled when utilization falls from one level to another.
A fleet of n_devices billed at device_hour_rate costs its full rate every day whether it computes or waits; a drop in the busy fraction wastes that share of the daily cost.
Methods
| Name | Description |
|---|---|
| solve | Price the billed accelerator time lost to a utilization decrease. |
solve
engine.solvers.storage.UtilizationLossModel.solve(
n_devices,
device_hour_rate,
healthy_utilization,
degraded_utilization,
duration,
)Price the billed accelerator time lost to a utilization decrease.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| n_devices | int | Nonnegative billed accelerator count. | required |
| device_hour_rate | Quantity | Nonnegative rental price per device, in currency/hour. | required |
| healthy_utilization | float | Dimensionless reference busy fraction in [0, 1]. | required |
| degraded_utilization | float | Dimensionless comparison busy fraction in [0, 1]; higher values yield negative loss. | required |
| duration | Quantity | Nonnegative accounting duration, convertible to days. | required |
Returns
| Name | Type | Description |
|---|---|---|
| UtilizationLossResult | Full fleet cost per day, lost cost per day, and total lost cost, all as USD scalars. |
Notes
Equation: Daily fleet cost = devices * hourly_rate * hours_per_day; loss = daily_cost * (healthy - degraded) * duration_in_days.
Assumptions: The fleet incurs its full rental bill whether busy or idle. Utilization differences are constant over the accounting period.
Excludes: Actual billing reductions, energy savings, and causal attribution of the utilization change.
References
Derivation: Multiply the full device rental rate by elapsed time to obtain billed cost. Multiplying by the lost busy fraction prices the corresponding unused capacity, without asserting that the invoice itself decreases.
Examples
>>> from mlsysim.core.units import Q_
>>> from mlsysim.solvers import UtilizationLossModel
>>> r = UtilizationLossModel().solve(2, Q_(1, "USD/hour"), 0.8, 0.8, Q_(1, "day"))
>>> assert r.loss_total == 0.0