avalanche.evaluation.metrics.MaxGPU
- class avalanche.evaluation.metrics.MaxGPU(gpu_id, every=0.5)[source]
The standalone GPU usage metric. Important: this metric approximates the real maximum GPU percentage usage since it sample at discrete amount of time the GPU values.
Instances of this metric keeps the maximum GPU usage percentage detected. The start_thread method starts the usage tracking. The stop_thread method stops the tracking.
The result, obtained using the result method, is the usage in mega-bytes.
The reset method will bring the metric to its initial state. By default this metric in its initial state will return an usage value of 0.
- __init__(gpu_id, every=0.5)[source]
Creates an instance of the GPU usage metric.
- Parameters
gpu_id – GPU device ID.
every – seconds after which update the maximum GPU usage
Methods
__init__
(gpu_id[, every])Creates an instance of the GPU usage metric.
reset
()Resets the metric.
result
()Returns the max GPU percentage value.
start_thread
()stop_thread
()update
()Attributes
thread
Thread executing GPU monitoring code
stop_f
Flag to stop the thread
max_usage
Main metric result.