MCPcopy Create free account
hub / github.com/deepspeedai/DeepSpeed / print_forward_breakdown

Method print_forward_breakdown

deepspeed/runtime/engine.py:3123–3141  ·  view source on GitHub ↗
(self, fwd_time)

Source from the content-addressed store, hash-verified

3121 return inputs
3122
3123 def print_forward_breakdown(self, fwd_time):
3124 gate_time = 0.0
3125 moe_time = 0.0
3126 falltoall = 0.0
3127 salltoall = 0.0
3128
3129 for gate in self.gate_modules:
3130 gate_time += gate.gate_time
3131
3132 for l in self.moe_layers:
3133 moe_time += l.time_moe
3134 falltoall += l.time_falltoall
3135 salltoall += l.time_salltoall
3136
3137 # TODO: Allreduce/average them across ranks for more accurate timing.
3138
3139 log_dist(
3140 f"time (ms) | fwd: {fwd_time:.2f} (fwd_moe: {moe_time:.2f}, 1st_a2a: {falltoall:.2f}, 2nd_a2a: {salltoall:.2f}, top_k: {gate_time:.2f})",
3141 ranks=[0])
3142
3143 @instrument_w_nvtx
3144 def allreduce_gradients(self, bucket_size=MEMORY_OPT_ALLREDUCE_SIZE):

Callers 1

stepMethod · 0.95

Calls 1

log_distFunction · 0.90

Tested by

no test coverage detected