【问题标题】:Set core speed - linux设置核心速度 - linux
【发布时间】:2012-11-29 06:37:15
【问题描述】:
Architecture:
**AMD** Opteron quad-core using 2 CPUs --- Numa system

Processor : x86_64 Operating System: GNU/Linux

我正在尝试仅在芯片的一个核心上将核心频率设置为 2.2GHz(即最大值)。另一个模具完全关闭。

sudo sh -c "echo 0 > /sys/devices/system/cpu/cpu1/online"
sudo sh -c "echo 0 > /sys/devices/system/cpu/cpu3/online"
sudo sh -c "echo 0 > /sys/devices/system/cpu/cpu5/online"
sudo sh -c "echo 0 > /sys/devices/system/cpu/cpu7/online"

因此只有核心,0,2,4,6 are turned on

我尝试将governor 更改为performance,但是当任何其他线程在其上运行时,它会更改其他内核的频率。 例如:

if thread one runs on core 0: then its freq is 2.2GHz

when thread two starts to run on core 2: it gets it as 2.2GHz - Where as I am expecting it to work as 0.8GHz.

有没有一种特殊的方法可以永久设置一个核心的频率。

【问题讨论】:

    标签: linux cpu-speed


    【解决方案1】:

    按照@Lars 的回答。

    这里是完整的解决方案:

    echo userspace > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
    
    echo userspace > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor
    
    echo userspace > /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor
    
    echo userspace > /sys/devices/system/cpu/cpu6/cpufreq/scaling_governor
    

    yum install cpufrequtilssudo aptitude install cpufrequtils

    那么,

    sudo cpufreq-set -c 0 -f 2200Mhz
    
    sudo cpufreq-set -c 2 -f 800Mhz
    
    sudo cpufreq-set -c 4 -f 800Mhz
    
    sudo cpufreq-set -c 6 -f 800Mhz
    

    如果我能在这个问题上提供帮助,请告诉我。谢谢

    【讨论】:

      【解决方案2】:

      您可以尝试将调控器设置为userspace(如果不包含内核,您可能需要重新编译内核),然后使用scaling_setspeed 手动设置频率。

      【讨论】:

      • 幸运的是,州长userspace 由我的内核版本和发行版提供。你能在后面的部分展开吗?
      • 好的。非常简单。说 echo userspace > /sys/devices/system/cpu/cpuX/cpufreq/scaling_governor 其中 X 是核心 id cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor cat /proc/cpuinfo | egrep 'processor|MHz'
      • scaling_setspeed 文件在同一个目录中——你应该能够在其中回显你想要的频率(同样可能是你的内核不支持)。
      【解决方案3】:

      如果“cpufreq-set”缺失,此命令可能会起作用:

      cpupower -c 0 frequency-set -f 800
      

      【讨论】:

      • linux-tools-common 需要包。
      猜你喜欢
      • 2015-12-16
      • 2011-02-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-04-12
      • 2023-03-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多