简体   繁体   中英

How to run pyRAPL on Linux

I'm working on a Linux machine. I need to use pyRAPL with python3.8. I have installed pyRAPL. The installation was successful. I went into interpreter ( Python3.8 ) and checked. It imports.

But when I do pyRAPL.setup() it throws a File Permission error. 在此处输入图像描述

So to get around this error I run the code as sudo python3.8 foo.py , but when I do that I get the module not found error for numpy.

Now it doesn't matter which module I import. When I run the code with sudo python3.8 foo.py command, whichever module is there on the first line of my python script, it takes that, and throws a "module not found" error with that. (yes, I tested this).

So this isn't a NumPy specific question.

Now I can run the code just as python3.8 foo.py but this will give me the pyRAPL File Permission error. I need to use the pyRAPL library for my project so I can't just comment that out and go ahead.

So I'm stuck in a loop.

No sudo = pyRAPL file permission error.

Yes sudo = module not found error.

Please help me.

You report two problems.

  1. The Permission error can be resolved with $ sudo chmod -R a+r /sys/class/powercap/intel-rapl or with the similar command $ sudo chown -R energy /sys/class/powercap/intel-rapl .
  2. The Not Found error can be fixed by ensuring root uses same $PATH as your energy user.

Rather than doing global installs for whole server, consider using conda . Then adjusting PATH would be a matter of $ conda activate my-rapl-env , whether you are root or an ordinary user.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM