Skip to main content

HostInputPipelineScenario

Optimization scenarios · Implementation: mlsysim/engine/scenario_definitions/optimization.py.

Construct this scenario with keyword inputs. The fields below show the types and defaults declared by this class.

A data loader feeding one accelerator over its host link.

workers loader processes each prepare prefetch_factor batches of batch_size samples. A sample is raw_sample bytes as decoded pixels and model_sample bytes as the tensor copied to the device; the accelerator consumes consume_rate samples a second. Copy times are bandwidth-only lower bounds; step_times are compute times a serial copy is compared with.

Notes

Equation: Batch size times tensor bytes gives payload; payload divided by bandwidth gives copy time.

Assumptions: Constant consumption rate and ideal bandwidth for complete model-tensor copies.

Excludes: Worker scheduling, contention, and copy/compute overlap.

References

Derivation: Batch size times tensor bytes gives payload; payload divided by bandwidth gives copy time. Individual property contracts identify the exact accounting expression or reusable calculation. Registry entries supply the scenario inputs; this class does not turn them into measured outcomes.

Examples

Evaluate a named scenario using its declared inputs.

>>> from mlsysim import Scenarios
>>> scenario = Scenarios.ImageNetBatch64HostFeed
>>> round(float(scenario.batches_in_flight), 4)
8.0

Attributes

Name Description
batch_bytes Bytes copied per batch, using the model tensor size rather than decoded raw pixels.
batch_size
batches_in_flight Prefetched batch count, with an independent prefetch allowance for each worker.
consume_rate
copy_time Host-link transfer floor in milliseconds, from
device_copy_time Device-memory transfer floor in microseconds for the same batch payload.
device_memory
host_link
model_sample
prefetch_factor
raw_feed Decoded input bandwidth in decimal MB/s at the accelerator’s sample-consumption rate.
raw_sample
step_times
workers

Methods

Name Description
copy_share Dimensionless serial host-copy time divided by the named step compute time; it does

copy_share

engine.scenario_types.HostInputPipelineScenario.copy_share(step)

Dimensionless serial host-copy time divided by the named step compute time; it does not model overlap.

A serial copy as a share of one named step’s compute time.

Equation: (copy_time / step_times[step]).to('').magnitude.

batch_size

Type: int.

Declared default: required.

workers

Type: int.

Declared default: required.

prefetch_factor

Type: int.

Declared default: required.

raw_sample

Type: Quantity.

Declared default: required.

model_sample

Type: Quantity.

Declared default: required.

consume_rate

Type: Quantity.

Declared default: required.

device_memory

Type: Quantity.

Declared default: required.

step_times

Type: Dict[str, Quantity].

Declared default: {}.

batches_in_flight

engine.scenario_types.HostInputPipelineScenario.batches_in_flight

Prefetched batch count, with an independent prefetch allowance for each worker.

Equation: workers * prefetch_factor.

raw_feed

engine.scenario_types.HostInputPipelineScenario.raw_feed

Decoded input bandwidth in decimal MB/s at the accelerator’s sample-consumption rate.

Equation: (consume_rate * raw_sample).to('MB/second').

batch_bytes

engine.scenario_types.HostInputPipelineScenario.batch_bytes

Bytes copied per batch, using the model tensor size rather than decoded raw pixels.

Equation: (batch_size * model_sample).to('byte').

copy_time

engine.scenario_types.HostInputPipelineScenario.copy_time

Host-link transfer floor in milliseconds, from mlsysim.physics.quantities.transfer_time.

Equation: transfer_time(batch_bytes, host_link).to('ms').

device_copy_time

engine.scenario_types.HostInputPipelineScenario.device_copy_time

Device-memory transfer floor in microseconds for the same batch payload.

Equation: transfer_time(batch_bytes, device_memory).to('microsecond').

Back to top