MCPcopy Create free account
hub / github.com/AIS-SNU/Smart-Infinity / print_forward_breakdown

Method print_forward_breakdown

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

Source from the content-addressed store, hash-verified

1777 return inputs
1778
1779 def print_forward_breakdown(self, fwd_time):
1780 gate_time = 0.0
1781 moe_time = 0.0
1782 falltoall = 0.0
1783 salltoall = 0.0
1784
1785 for gate in self.gate_modules:
1786 #logger.info(f"Individual TopK gate time: {gate.gate_time:.2f} ms")
1787 gate_time += gate.gate_time
1788
1789 for l in self.moe_layers:
1790 #logger.info(f"MoE layer; total: {l.time_moe:.2f} ms, first alltoall: {l.time_falltoall:.2f}, second alltoall: {l.time_salltoall:.2f}")
1791 moe_time += l.time_moe
1792 falltoall += l.time_falltoall
1793 salltoall += l.time_salltoall
1794
1795 # TODO: Allreduce/average them across ranks for more accurate timing.
1796
1797 # if deepspeed.comm.get_rank() == 0:
1798 log_dist(
1799 f"rank={dist.get_rank()} time (ms) | forward: {fwd_time:.2f} (forward_moe: {moe_time:.2f}, 1st alltoall: {falltoall:.2f}, 2nd alltoall: {salltoall:.2f}, top-k: {gate_time:.2f})",
1800 ranks=[0])
1801
1802 @instrument_w_nvtx
1803 def allreduce_gradients(self, bucket_size=MEMORY_OPT_ALLREDUCE_SIZE):

Callers 1

stepMethod · 0.95

Calls 2

log_distFunction · 0.90
get_rankMethod · 0.45

Tested by

no test coverage detected