LIKWID API Pinning and Energy Measurement

27 views
Skip to first unread message

Demirhan Sevim

unread,
Jun 7, 2023, 3:17:40 AM6/7/23
to likwid-users
Hello,

I am using the LIKWID API on a Intel(R) Xeon(R) Gold 5318Y CPU @ 2.10GHz to measure energy of an application by pinning it on certain cores. When I pin it from inside of the application by calling affinity_pinProcess() or pin the application from the terminal when I measure events like TEMP_CORE or CPU_CLK_UNHALTED_CORE I can read them from the pinned core. But when I read PWR_PKG_ENERGY it always only shows on Core 0 and Core 24 no matter where I pin it.  

Also when I use likwid-perfctr and pin it to measure energy it can read from the correctly pinned hardware thread. But the energy measured is half of the energy measured by the LIKWID API when pinning it. How can I do what likwid-perfctr does by using LIKWID API?

Thanks,
Demirhan

Thomas Gruber

unread,
Jun 7, 2023, 5:13:00 AM6/7/23
to likwid-users
Hi Demirhan,

The RAPL units of Intel processors count on a per-socket basis, so you get energy/power data only for the whole socket. The temperature or cycle count (with performance event) can be read per hardware thread. Counter documentation for Intel IcelakeSP: https://github.com/RRZE-HPC/likwid/wiki/IcelakeSP

When you do a perfmon_init(), LIKWID selects one hardware thread per socket from the list to measure the socket counters, in your case 0 and 24. If you run likwid-perfctr -C <hwt_list>, you limit the set of usable hw threads and the selector uses these hardware threads for the socket counters.

The reason for only half the energy consumption is unclear to me. There should be no difference as likwid-perfctr uses the LIKWID API under the hood. Of course you have to measure both CPU sockets with likwid-perfctr and sum the results of the LIKWID API to get comparable counts.

Best,
Thomas
Reply all
Reply to author
Forward
0 new messages