Skip to content

Add Likwid support based on performance groups

Markus Büttner requested to merge likwid into master

The Likwid implementation now uses the performance group provided by Likwid to be portable across CPUs. On AMD Rome, energy counters are called "RAPL_CORE_ENERGY" and "RAPL_PKG_ENERGY", on Intel "PWR_PKG_ENERGY", "PWR_PP0_ENERGY" for Icelake.

We filter from the performance group events that contain "ENERGY" in their name to get the energy, and accumulate them in the GetMeasurements() / GetState() functions.

Likwid may complain about register PMC0/PMC1 being in use. This can be ignored as it only affects the RETIRED_INSTRUCTIONS and CPU_CLOCKS_UNHALTED counters. This can be fixed by exporting LIKWID_FORCE=1 beforehand (should this be done in the implementation?).

$ ./Likwid-test 
ERROR: The selected register PMC0 is in use.
Please run likwid with force option (-f, --force) to overwrite settings
ERROR: The selected register PMC1 is in use.
Please run likwid with force option (-f, --force) to overwrite settings
0.100 s, 14.707 J, 146.713 W, 0.201 s (total), 29.418 J (total), 146.677 W (average)
0.100 s, 14.709 J, 146.714 W, 0.401 s (total), 58.831 J (total), 146.676 W (average)
0.100 s, 14.704 J, 146.706 W, 0.602 s (total), 88.247 J (total), 146.698 W (average)
0.100 s, 14.711 J, 146.766 W, 0.802 s (total), 117.669 J (total), 146.714 W (average)
0.100 s, 14.706 J, 146.720 W, 1.003 s (total), 147.078 J (total), 146.706 W (average)

The sockets are also filtered for active CPUs, so we can only measure on the socket we are running on:

$ LIKWID_FORCE=1 taskset --cpu-list 0 ./Likwid-test 
0.100 s, 7.357 J, 73.456 W, 0.200 s (total), 14.713 J (total), 73.448 W (average)
0.100 s, 7.358 J, 73.482 W, 0.401 s (total), 29.426 J (total), 73.455 W (average)
0.100 s, 7.282 J, 72.705 W, 0.601 s (total), 44.064 J (total), 73.330 W (average)
0.100 s, 7.356 J, 73.441 W, 0.801 s (total), 58.773 J (total), 73.357 W (average)

Merge request reports

Loading