Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set core speed - linux

Architecture:
**AMD** Opteron quad-core using 2 CPUs --- Numa system

Processor : x86_64 Operating System: GNU/Linux

I am trying to set the core freq to 2.2GHz(that being the max) on just one core of the die. The other die completely turned off.

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"

Therefore just the cores, 0,2,4,6 are turned on

I have tried changing the governor to performance but it changes the frequency of other cores' when any other thread runs on it. For example:

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.

is there a particular way to just set the frequency of just one core permanently.

like image 650
user1860977 Avatar asked Oct 06 '22 20:10

user1860977


2 Answers

Following @Lars answer.

Here is the complete solution:

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 cpufrequtils or sudo aptitude install cpufrequtils

Then,

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

Let me know if i can be anymore help in this issue. thanks

like image 163
user1860977 Avatar answered Oct 09 '22 01:10

user1860977


You could try setting the governor to userspace (you may need to recompile your kernel if it isn't included) and then manually setting the frequency using scaling_setspeed.

like image 29
Lars Kotthoff Avatar answered Oct 09 '22 02:10

Lars Kotthoff