pytorch_pfn_extras.profiler.TimeSummary#

class pytorch_pfn_extras.profiler.TimeSummary(*, max_queue_size=1000, auto_init=True)#

Bases: object

Online summarization of execution times.

TimeSummary computes the average and standard deviation of exeuction times in both cpu and gpu devices.

Parameters:
  • max_queue_size (int) – Length limit of the internal queues that keep reported time info until they are summarized.

  • auto_init (bool) – Whether to automatically call initialize() when the instance is created.

Methods

__init__(*[, max_queue_size, auto_init])

add(name, value)

complete_report(tag, use_cuda, begin_event, ...)

finalize()

initialize()

Initializes the worker threads for TimeSummary.

report(tag[, use_cuda])

Context manager to automatically report execution times.

summary([clear])

synchronize()

__init__(*, max_queue_size=1000, auto_init=True)#
Parameters:
  • max_queue_size (int) –

  • auto_init (bool) –

Return type:

None

add(name, value)#
Parameters:
  • name (str) –

  • value (float) –

Return type:

None

complete_report(tag, use_cuda, begin_event, begin)#
Parameters:
  • tag (str) –

  • use_cuda (bool) –

  • begin_event (Optional[Event]) –

  • begin (float) –

Return type:

None

finalize()#
Return type:

None

initialize()#

Initializes the worker threads for TimeSummary.

Usually you do not have to call it for yourself. However in case you directly use ppe.time_summary outside of pytorch_pfn_extras.training.extensions.ProfileReport, you have to explicitly call initialize() in advance.

Return type:

None

report(tag, use_cuda=False)#

Context manager to automatically report execution times.

The start and completion times are obtained automatically, the user only needs to provide a tag to identify the value in the summary values.

Parameters:
  • tag (str) – A name to identify the section of code being profiled.

  • use_cuda (bool) – Indicates if GPU time should also be profiled.

Return type:

Generator[_ReportNotification, None, None]

summary(clear=False)#
Parameters:

clear (bool) –

Return type:

Generator[Tuple[DictSummary, Dict[str, float]], None, None]

synchronize()#
Return type:

None