Overview
PMT can be seen as a library which calls "lower level" libraries that allow reporting the energy consumption of various system-on-chip power domains. PMT supports the following Hardware/Libraries:
- RAPL (Running Average Power Limit)
- LIKWID (“Like I Knew What I’m Doing.”)
- NVML
- ROCm
- Xilinx
- Tegra (support for NVIDIA Jetson platforms)
In the Figure below you can see some of the monitoring capabilities (there are many more than what is shown in the plot) of PMT across a variety of algorithms and architectures.
Image Source: https://ieeexplore.ieee.org/document/10027520
RAPL (C++) example
Load the pmt module on Snellius first.
module load 2022 module load pmt/1.2.0-GCCcore-11.3.0
Then try this pseudo code out.
#include <pmt.h> // needed for PMT #include <iostream> // Initialize the Sensor auto sensor = pmt::rapl::Rapl::create(); // Read from the PMT Sensor auto start = sensor->read(); some_function_that_you_want_to_time(); // Read from the PMT Sensor auto end = sensor->read(); std::cout << "RESULTS-------" << std::endl; std::cout << "PMT Seconds: " << pmt::PMT::seconds(start, end) << " s"<< std::endl; std::cout << "PMT Joules: " << pmt::PMT::joules(start, end) << " J" << std::endl; std::cout << "PMT Watts: " << pmt::PMT::watts(start, end) << " W" << std::endl;
RAPL (Python) example
Load the pypmt module on Snellius first.
module load 2022 module load pypmt/1.2.0-foss-2022a
Then try this pseudo code out.
import pypmt from pypmt import joules, seconds, watts # Initialize the Sensor pmt = pypmt.Rapl.create() # Read from the Sensor start = pmt.read() some_function_that_you_want_to_time() # Read from the Sensor end = pmt.read() print("joules {}".format(pypmt.joules(start, end))) print("watts {}".format(pypmt.watts(start, end))) print("seconds {}".format(pypmt.seconds(start, end)))