Hello everybody,
I want to be able to use the RAPL functionality along with PAPI's high level API. I want to include it in the environment variable PAPI_EVENTS simply, like
export PAPI_EVENTS="PAPI_TOT_CYC,PAPI_L1_DCA,PAPI_L2_ICH,PAPI_L2_ICR", which works for my computer.
I have tried the basic tests for RAPL from the PAPI Bitbucket Repository and they work out fine. I am able to see the PP0 energy from them.
I have attached some sections from outputs that might be helpful for finding a solution.
1) papi_component_avail
--------------------------------------------------------------------------------
PAPI version : 6.0.0.1
Operating system : Linux 5.11.0-44-generic
Vendor string and code : AuthenticAMD (2, 0x2)
Model string and code : AMD Ryzen 5 4600H with Radeon Graphics (96, 0x60)
CPU revision : 1.000000
CPUID : Family/Model/Stepping 23/96/1, 0x17/0x60/0x01
CPU Max MHz : 3000
CPU Min MHz : 1400
Total cores : 12
SMT threads per core : 2
Cores per socket : 6
Sockets : 1
Cores per NUMA region : 12
NUMA regions : 1
Running in a VM : no
Number Hardware Counters : 5
Max Multiplex Counters : 384
Fast counter read (rdpmc): yes
--------------------------------------------------------------------------------
Compiled-in components:
Name: perf_event Linux perf_event CPU counters
Name: perf_event_uncore Linux perf_event CPU uncore and northbridge
Active components:
Name: perf_event Linux perf_event CPU counters
Native: 141, Preset: 17, Counters: 5
PMUs supported: perf, perf_raw, amd64_fam17h_zen2
Name: perf_event_uncore Linux perf_event CPU uncore and northbridge
Native: 1, Preset: 0, Counters: 3
PMUs supported: amd64_rapl
--------------------------------------------------------------------------------
2) papi_native_avail
Native Events in Component: perf_event_uncore
===============================================================================
| amd64_rapl::RAPL_ENERGY_PKG |
| Number of Joules consumed by all cores and Last level cache on the|
| package. Unit is 2^-32 Joules |
| :u=0 |
| monitor at user level |
| :k=0 |
| monitor at kernel level |
| :period=0 |
| sampling period |
| :freq=0 |
| sampling frequency (Hz) |
| :excl=0 |
| exclusive access |
| :mg=0 |
| monitor guest execution |
| :mh=0 |
| monitor host execution |
| :cpu=0 |
| CPU to program |
| :pinned=0 |
| pin event to counters |
--------------------------------------------------------------------------------
3) Running rapl_basic
$ sudo chmod 666 /dev/cpu/*/msr
$ sudo setcap cap_sys_rawio=ep rapl_basic
$ ./rapl_basic
Trying all RAPL events
Found rapl component at cid 2
Starting measurements...
Sleeping 1 second...
Stopping measurements, took 1.000s, gathering results...
Scaled energy measurements:
rapl:::PACKAGE_ENERGY:PACKAGE0 3.902161 J (Average Power 3.9W)
rapl:::PP0_ENERGY:PACKAGE0 0.011475 J (Average Power 0.0W)
Energy measurement counts:
rapl:::PACKAGE_ENERGY_CNT:PACKAGE0 255732 0x03e6f4
rapl:::PP0_ENERGY_CNT:PACKAGE0 752 0x0002f0
Scaled Fixed values:
Fixed value counts:
PASSED
4) RAPL added in the event set of the high level API and not working
$ gcc helloworld2.c -lpapi -o helloworld2
$ sudo setcap cap_sys_rawio=ep helloworld2
$ export PAPI_EVENTS="amd64_rapl::RAPL_ENERGY_PKG"
$ ./helloworld2
PAPI-HL Info: PAPI has been initiated!
PAPI-HL Warning: "amd64_rapl::RAPL_ENERGY_PKG" does not exist or is not supported on this machine.
PAPI-HL Warning: All requested events do not work, using default.
PAPI-HL Info: Using the following events:
perf::TASK-CLOCK
PAPI_TOT_INS
PAPI_TOT_CYC
PAPI_FP_INS
PAPI_FP_OPS
Hello, World22222!PAPI-HL Info: Print results...
I have tried to use several different options for event name like "amd64_rapl::RAPL_ENERGY_PKG", "RAPL_ENERGY_PKG", "rapl::RAPL_ENERGY_PKG" for this, but I get the same output as above all the time.
I had doubts that RAPL is not compatible for my AMD laptop, however rapl_basic is working fine. So, I expected RAPL to work along with the High Level API as well. Does it not work with that?
Sincerely,
Akshat Ahuja
Department of Physics
IIT Kharagpur