sosy-lab / cpu-energy-meter

A tool for measuring energy consumption of Intel CPUs
BSD 3-Clause "New" or "Revised" License
321 stars 29 forks source link

How to run the tool without sudo access? #28

Closed avacoder42 closed 3 years ago

avacoder42 commented 3 years ago

Hi,

I'm trying to extract the energy and power measurements of applications running on a server for which I do not have any sudo access. I read the part about installing without root and installed using the .deb package. I get the following error when trying to execute. Is there any other changes I need to make? Kindly suggest.

20192535@co20:~/cpu/usr/bin$ ./cpu-energy-meter
cpu-energy-meter: Could not open /dev/cpu/0/msr: No such file or directory
Cannot access RAPL!
PhilippWendler commented 3 years ago

How did you install the .deb package without root access?

If that package is installed, the tool should be usable afterwards without sudo by default.

However, the error message you got indicates that the msr kernel module is not loaded. Can you please confirm this with lsmod|grep msr? Does this happen to be a machine without systemd? Our package ensures that msr gets loaded but relies on systemd for that. On other systems you have to manually load this module by adding it to the appropriate config file.

avacoder42 commented 3 years ago

I installed .deb package using dpkg -x cpu-energy-meter_1.2-1_amd64.deb <directory> lsmod|grep msr does not return anything, its not found. I checked systemd using this command, it is present

pidof systemd && echo "systemd" || echo "other"
32336 27724 26834 26549 15924 13505 11905 8271 4150 1
systemd
PhilippWendler commented 3 years ago

That cannot work. dpkg -x does not install the package, it just extracts it.

There is no way to use CPU Energy Meter without root access for the installation (because the msr kernel module needs to be loaded and permissions of CPU Energy Meter need to be configured accordingly).

I suggest to request your system administrator to install the package for you, but there is nothing we can do.