MCPcopy
hub / github.com/hpcaitech/ColossalAI / stop

Method stop

colossalai/utils/timer.py:38–54  ·  view source on GitHub ↗

Stop the timer and record the start-stop time interval. Args: keep_in_history (bool, optional): Whether does it record into history each start-stop interval, defaults to False. Returns: int: Start-stop interval.

(self, keep_in_history: bool = False)

Source from the content-addressed store, hash-verified

36 return self.current_time - self._start_time
37
38 def stop(self, keep_in_history: bool = False):
39 """Stop the timer and record the start-stop time interval.
40
41 Args:
42 keep_in_history (bool, optional): Whether does it record into history
43 each start-stop interval, defaults to False.
44 Returns:
45 int: Start-stop interval.
46 """
47 get_accelerator().synchronize()
48 end_time = time.time()
49 elapsed = end_time - self._start_time
50 if keep_in_history:
51 self._history.append(elapsed)
52 self._elapsed = elapsed
53 self._started = False
54 return elapsed
55
56 def get_history_mean(self):
57 """Mean of all history start-stop time intervals.

Callers 2

stopMethod · 0.45

Calls 3

get_acceleratorFunction · 0.90
synchronizeMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected