Linux

PAPI安装RAPL模块

2019-05-15  本文已影响0人  HaoMengHIT

Configuring PAPI to support RAPL

When configuring PAPI, you need to provide the --with-components=rapl option. Basically, you need to install PAPI like this:

$ tar xzvf papi-5.3.2.tar.gz
$ cd papi-5.3.2/src
$ ./configure --with-components=rapl &&make &&make install

Checking the PAPI installation

Once PAPI is installed, make sure it is capable of reading RAPL information. For instance, you can run this rapl-read program. You may need to modify the Makefile in order to specify the installation directory of PAPI. Once compiled, running the rapl-read program should result in the following output:

$ ./rapl_plot
Found rapl component at cid 2
Found: rapl:::THERMAL_SPEC_CNT:PACKAGE0
Found: rapl:::MINIMUM_POWER_CNT:PACKAGE0
Found: rapl:::MAXIMUM_POWER_CNT:PACKAGE0
Found: rapl:::MAXIMUM_TIME_WINDOW_CNT:PACKAGE0
Found: rapl:::PACKAGE_ENERGY_CNT:PACKAGE0
Found: rapl:::PP1_ENERGY_CNT:PACKAGE0
Found: rapl:::DRAM_ENERGY_CNT:PACKAGE0
Found: rapl:::PP0_ENERGY_CNT:PACKAGE0
Found: rapl:::THERMAL_SPEC:PACKAGE0
Found: rapl:::MINIMUM_POWER:PACKAGE0
Found: rapl:::MAXIMUM_POWER:PACKAGE0
Found: rapl:::MAXIMUM_TIME_WINDOW:PACKAGE0
Found: rapl:::PACKAGE_ENERGY:PACKAGE0
Found: rapl:::PP1_ENERGY:PACKAGE0
Found: rapl:::DRAM_ENERGY:PACKAGE0
Found: rapl:::PP0_ENERGY:PACKAGE0
[...]
4.7213 0.0 (* Average Power for rapl:::MAXIMUM_TIME_WINDOW:PACKAGE0 *)
4.7213 3.0 (* Average Power for rapl:::PACKAGE_ENERGY:PACKAGE0 *)
4.7213 0.2 (* Average Power for rapl:::PP1_ENERGY:PACKAGE0 *)
4.7213 0.8 (* Average Power for rapl:::DRAM_ENERGY:PACKAGE0 *)
4.7213 0.1 (* Average Power for rapl:::PP0_ENERGY:PACKAGE0 *)
4.8218 0.0 (* Average Power for rapl:::THERMAL_SPEC_CNT:PACKAGE0 *)
4.8218 0.0 (* Average Power for rapl:::MINIMUM_POWER_CNT:PACKAGE0 *)
4.8218 0.0 (* Average Power for rapl:::MAXIMUM_POWER_CNT:PACKAGE0 *)
4.8218 0.0 (* Average Power for rapl:::MAXIMUM_TIME_WINDOW_CNT:PACKAGE0 *)
4.8218 0.0 (* Average Power for rapl:::PACKAGE_ENERGY_CNT:PACKAGE0 *)
4.8218 0.0 (* Average Power for rapl:::PP1_ENERGY_CNT:PACKAGE0 *)
4.8218 0.0 (* Average Power for rapl:::DRAM_ENERGY_CNT:PACKAGE0 *)
4.8218 0.0 (* Average Power for rapl:::PP0_ENERGY_CNT:PACKAGE0 *)
4.8218 46156882941.9 (* Average Power for rapl:::THERMAL_SPEC:PACKAGE0 *)
4.8218 0.0 (* Average Power for rapl:::MINIMUM_POWER:PACKAGE0 *)
4.8218 0.0 (* Average Power for rapl:::MAXIMUM_POWER:PACKAGE0 *)
4.8218 0.0 (* Average Power for rapl:::MAXIMUM_TIME_WINDOW:PACKAGE0 *)
4.8218 2.9 (* Average Power for rapl:::PACKAGE_ENERGY:PACKAGE0 *)
4.8218 0.2 (* Average Power for rapl:::PP1_ENERGY:PACKAGE0 *)
4.8218 0.8 (* Average Power for rapl:::DRAM_ENERGY:PACKAGE0 *)

Can't open fd for cpu0: No such file or director

However, You may have the following error:

$ ./rapl_plot
Found rapl component at cid 2
No rapl events found: Can't open fd for cpu0: No such file or director

This usually means that the msr kernel module that permits to read the energy counters is not loaded. This should be fixed by running modprobe:

$ sudo modprobe msr

Can't open fd for cpu0: Operation not permitted

Another possible error is:

$  ./rapl_plot
Found rapl component at cid 2
No rapl events found: Can't open fd for cpu0: Operation not permitted

In that case, you may have to run the program as sudo:

$ sudo ./rapl_plot
[...]
上一篇下一篇

猜你喜欢

热点阅读