Skip to content
DeepForgeby svx
All problems
EasyOptimizationop-166

Local SGD Communication Count

Problem

Count the communication rounds in local SGD.

Return ceil(total_steps / local_steps), or 0 when either argument is not positive. Workers synchronize only when the local steps complete.

Hint

Round up because a partial final round still communicates.

Test cases

case 1
in: [100,10]
expected: 10
case 2
in: [95,10]
expected: 10
case 3
in: [7,3]
expected: 3
case 4
in: [10,0]
expected: 0
Starter codePython
def local_sgd_communication_count(total_steps, local_steps):
    # Your code here
    pass

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