All problems
MFU From Step Time
Problem
Compute model FLOPs utilization from a measured training step: achieved_flops_per_s = tokens_per_step * flops_per_token / step_time_s, and the hardware capacity is num_gpus * peak_flops_per_gpu.
The signature is mfu_from_step_time(tokens_per_step, step_time_s, num_gpus, peak_flops_per_gpu, flops_per_token). Return the fraction of peak FLOPs achieved.
Hint
Divide the measured token throughput times FLOPs per token by the total peak throughput of all GPUs.
Test cases
case 1
in: [200000,2,8,312000000000000,6000000000]
expected: 0.2403846154
case 2
in: [0,2,8,312000000000000,6000000000]
expected: 0
case 3
in: [1000000,1.5,4,1000000000000000,2000000000]
expected: 0.3333333333
case 4
in: [50000,10,1,50000000000000,2000000000]
expected: 0.2
Starter codePython
def mfu_from_step_time(tokens_per_step, step_time_s, num_gpus, peak_flops_per_gpu, flops_per_token):
# Your code here
pass4 test cases · run your code against them in the editor