简体   繁体   English

如何在 Linux 上运行 pyRAPL

[英]How to run pyRAPL on Linux

I'm working on a Linux machine.我正在使用 Linux 机器。 I need to use pyRAPL with python3.8.我需要在 python3.8 中使用 pyRAPL。 I have installed pyRAPL.我已经安装了 pyRAPL。 The installation was successful.安装成功。 I went into interpreter ( Python3.8 ) and checked.我进入解释器( Python3.8 )并检查。 It imports.它进口。

But when I do pyRAPL.setup() it throws a File Permission error.但是当我执行pyRAPL.setup()时,它会引发文件权限错误。 在此处输入图像描述

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.所以为了解决这个错误,我将代码运行为sudo python3.8 foo.py ,但是当我这样做时,我得到了 numpy 的module not found错误。

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.当我使用sudo python3.8 foo.py命令运行代码时,无论我的 python 脚本的第一行中的哪个模块,它都会接受它,并抛出“找不到模块”错误。 (yes, I tested this). (是的,我对此进行了测试)。

So this isn't a NumPy specific question.所以这不是 NumPy 特定问题。

Now I can run the code just as python3.8 foo.py but this will give me the pyRAPL File Permission error.现在我可以像python3.8 foo.py一样运行代码,但这会给我 pyRAPL 文件权限错误。 I need to use the pyRAPL library for my project so I can't just comment that out and go ahead.我需要为我的项目使用 pyRAPL 库,所以我不能只评论它和 go。

So I'm stuck in a loop.所以我陷入了一个循环。

No sudo = pyRAPL file permission error.没有 sudo = pyRAPL 文件权限错误。

Yes sudo = module not found error.是 sudo = 未找到模块错误。

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 .权限错误可以使用$ sudo chmod -R a+r /sys/class/powercap/intel-rapl或类似的命令$ 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.可以通过确保 root 使用与能源用户相同的 $PATH 来修复 Not Found 错误。

Rather than doing global installs for whole server, consider using conda .与其对整个服务器进行全局安装,不如考虑使用conda Then adjusting PATH would be a matter of $ conda activate my-rapl-env , whether you are root or an ordinary user.然后调整 PATH 将是$ conda activate my-rapl-env问题,无论您是 root 用户还是普通用户。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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