MCPcopy
hub / github.com/deepspeedai/DeepSpeedExamples / elapsed

Method elapsed

Megatron-LM/utils.py:98–112  ·  view source on GitHub ↗

Calculate the elapsed time.

(self, reset=True)

Source from the content-addressed store, hash-verified

96 self.started_ = False
97
98 def elapsed(self, reset=True):
99 """Calculate the elapsed time."""
100 started_ = self.started_
101 # If the timing in progress, end it first.
102 if self.started_:
103 self.stop()
104 # Get the elapsed time.
105 elapsed_ = self.elapsed_
106 # Reset the elapsed time
107 if reset:
108 self.reset()
109 # If timing was in progress, set it back.
110 if started_:
111 self.start()
112 return elapsed_
113
114 def __init__(self):
115 self.timers = {}

Callers 3

trainFunction · 0.45
logMethod · 0.45
trainFunction · 0.45

Calls 3

stopMethod · 0.95
resetMethod · 0.95
startMethod · 0.95

Tested by

no test coverage detected