perf

Utility functions for performance measurement.

Classes

Timer

A Timer that can be used as a decorator as well.

Functions

clear_cuda_cache

Clear the CUDA cache.

get_cuda_memory_stats

Get memory usage of specified GPU in Bytes.

report_memory

Simple GPU memory report.

class Timer

Bases: ContextDecorator

A Timer that can be used as a decorator as well.

__init__(name='')

Initialize Timer.

start()

Start the timer.

stop()

End the timer.

Return type:

float

clear_cuda_cache()

Clear the CUDA cache.

get_cuda_memory_stats(device=None)

Get memory usage of specified GPU in Bytes.

report_memory(name='', rank=0, device=None)

Simple GPU memory report.