cppuprofile
cppuprofile copied to clipboard
Adding multi-GPU support for Nvidia monitoring
This MR adds the ability to monitor multiple Nvidia GPUs through nvidia-smi calls. It also adds some refactoring for the NvidiaMonitor. In detail, the changes include
- Exposing the cmake variable
GPU_MONITOR_NVIDIAas a C++ macro to automatically enable GPU monitoring in the examplesample/main.cpp. - Simplifying the
lib/igpumonitor.habstract base class to the two basic functionsgetUsageandgetMemory. - The
NvidiaMonitorwas changed the most by- removing the threading via
watchGPUto read in thenvidia-smicalls and changing them to simplerpopen(...)calls with no need for forked processes. - The containers to hold GPU usage, used, and total memory were changed to
std::vectors to house monitored information for multiple GPUs. During construction of theNvidiaMonitorobject, the number of available GPUs in the system is collected fromnvidia-smiand the vectors are initialized. - The function
void update_gpu_data(const std::vector<uprofile::NvidiaMonitor::Data>& data)was added to update the usage and/or memory vectors, depending on the passed data argument.
- removing the threading via
- The watching checks for
UProfileImpl::dumpGpuUsage()andUProfileImpl::dumpGpuMemory()functions were removed since they are no longer needed - The
show-graphtool was updated to plot multiple GPU usage and memory.