Class CUDAStats

Class Documentation

class CUDAStats

A class used get get the GPU usage statistics.

This class uses the Nvidia Management libray (NVML) to get the usage statistics of a device.

Public Functions

CUDAStats(int device = -1)

constructor for class

Parameters

device – the GPU device to get stats from. If < 0 then no stats are reported

virtual ~CUDAStats()

deconstructor of class

This ensures that the NVML de-initialised correctly.

void initialise()

initialise being able to get the GPU statistics

This needs to be called after the class is constructed but before calling get_stats

cuda_stats_t get_stats()

get the current GPU usage statistics