Pipeline bubble simulator
CPU · your Macscript90 minrequiredGoal · A pure-Python discrete-event simulator that schedules micro-batches across p stages and reports utilisation for GPipe and 1F1B forward-only schedules.
- 1Model each stage as a worker with a fixed per-micro-batch time t and an optional transfer time between stages.
- 2Implement a GPipe-style forward schedule and compute total time, per-stage busy time, and bubble fraction.
- 3Sweep p in {2, 4, 8} and m in {1, 2, 4, 8, 16, 32}; compare measured bubble fraction with (p-1)/(m+p-1).
- 4Add an unbalanced case where stage 0 is 1.5x slower and show how the pipeline throughput drops to the slowest stage.
- 5Render an ASCII or matplotlib Gantt chart of stage activity for p=4, m=4.
- Deliverable
- pp_sim.py, a CSV of (p, m, measured_bubble, formula_bubble), and one Gantt chart image.
- Check
- Measured bubble fraction equals the formula to within 1 percent for all balanced cases; with m=1 and p=4 utilisation is 25 percent.