Skip to content
DeepForgeby svx
All problems
MediumDeep Learningdl-122

Pipeline Bubble Fraction

Problem

Compute the pipeline bubble fraction for GPipe-style scheduling: (num_stages - 1) / (num_microbatches + num_stages - 1).

The signature is pipeline_bubble_fraction(num_stages, num_microbatches).

Hint

More micro-batches per step shrink the idle bubble at the pipeline start and end.

Test cases

case 1
in: [4,8]
expected: 0.2727272727
case 2
in: [4,1]
expected: 0.75
case 3
in: [1,10]
expected: 0
case 4
in: [8,32]
expected: 0.1794871795
Starter codePython
def pipeline_bubble_fraction(num_stages, num_microbatches):
    # Your code here
    pass

4 test cases · run your code against them in the editor