Throttle CPU based on Temperature? - Ubuntu
I was running some programs on my Ubuntu machine that use max CPU power for extended periods of time. This causes the computer to overheat.
Could someone suggest a good program that will throttle CPU power down to maintain a set temperature?
I tried Jupiter but it does not have that feature. I also tried some Linux scripts but I do not have the skills to modify them to work on Ubuntu.
Any help would be much appreciated.
Solution 1:
This is normally dealt with quite well by the CPU governor and the kernel itself. The CPU should be throttled automatically as soon as dangerous temperatures are reached. What makes you think it is a problem? What temperatures are you running at?
Anyway, here are a couple of things you might want to try.
-
Play with the different governors. Most modern systems scale the CPU frequency according to the current need. On Linux systems, this is controlled by the "cpu governor", if all you want is to run the job without heating up and don't care about speed, set the governor to "Powersave"
sudo -i echo powersave > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
You can check which governor is set with this command:
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
Available options are:
- performance
- powersave
- userspace
- ondemand
- conservative
-
Use
cpufreq
to manually set the speed of your processor:sudo apt-get install cpufrequtils
Find the available processor speeds (the examples are from my laptop):
LC_ALL=C cpufreq-info | grep "available frequency" available frequency steps: 2.67 GHz, 2.67 GHz, 2.53 GHz, 2.40 GHz, 2.27 GHz, 2.13 GHz, 2.00 GHz, 1.87 GHz, 1.73 GHz, 1.60 GHz, 1.47 GHz, 1.33 GHz, 1.20 GHz
Now set a low frequency (for example, 1.20 GHz):
sudo cpufreq-set -f 1.20
If you still think it is necessary, you can make a script that monitors the temperature and sets the frequency on demand. However, this is bound to be worse than letting the kernel handle it and depends on
sensors
oracpi
or similar being correctly configured and is really not worth it.