性能

用于性能测量的实用函数。

Timer

一个可以用作装饰器的计时器。

函数

clear_cuda_cache

清除CUDA缓存。

get_cuda_memory_stats

获取指定GPU的内存使用量,单位为字节。

report_memory

简单的GPU内存报告。

class Timer

基础:ContextDecorator

一个可以用作装饰器的计时器。

__init__(name='')

初始化计时器。

start()

启动计时器。

stop()

结束计时器。

Return type:

浮点数

clear_cuda_cache()

清除CUDA缓存。

get_cuda_memory_stats(device=None)

获取指定GPU的内存使用量,单位为字节。

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

简单的GPU内存报告。