Skip to content
DeepForgeby svx
All problems
MediumDeep Learningdl-299

Stream Overlap Ratio

Problem

Compute the speedup from overlapping communication with compute. Sequential time is compute + comm; pipelined time is max(compute, comm) + (1 - overlap_fraction) * min(compute, comm). Return 1 - pipelined / sequential.

The signature is stream_overlap_ratio(compute_ms, comm_ms, overlap_fraction).

Hint

Perfect overlap can hide at most the smaller of the two phases.

Test cases

case 1
in: [100,50,1]
expected: 0.3333333333
case 2
in: [100,50,0]
expected: 0
case 3
in: [60,60,0.5]
expected: 0.25
case 4
in: [100,100,1]
expected: 0.5
Starter codePython
def stream_overlap_ratio(compute_ms, comm_ms, overlap_fraction):
    # Your code here
    pass

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