MCPcopy Index your code
hub / github.com/pytorch/pytorch / _timed_task

Method _timed_task

caffe2/python/checkpoint.py:234–253  ·  view source on GitHub ↗

Build a Task that will measure the time span of checkpoint operations, once operation is done, time can be read from _current_checkpoint_duration. Args: cp_op_name: A string name of the checkpoint operation. add_op: A functor to add the checkpoint op

(self, cp_op_name, add_op)

Source from the content-addressed store, hash-verified

232 return self._names_output.fetch().tolist()
233
234 def _timed_task(self, cp_op_name, add_op):
235 """
236 Build a Task that will measure the time span of checkpoint operations,
237 once operation is done, time can be read from _current_checkpoint_duration.
238
239 Args:
240 cp_op_name: A string name of the checkpoint operation.
241 add_op: A functor to add the checkpoint operation.
242
243 Returns:
244 A task with timer.
245 """
246 with Task(name=cp_op_name) as task:
247 with ops.task_init():
248 timer = ops.TimerBegin([], counter_name=self._node_name)
249 add_op()
250 with ops.task_exit():
251 time_span_blob = ops.TimerGetAndEnd(timer)
252 self._current_checkpoint_duration = final_output(time_span_blob)
253 return task
254
255 def collect_checkpoint_stats(self, stats):
256 """

Callers 3

loadMethod · 0.95
saveMethod · 0.95

Calls 4

TaskClass · 0.90
final_outputFunction · 0.90
task_initMethod · 0.80
task_exitMethod · 0.80

Tested by

no test coverage detected