Skip to content

Instantly share code, notes, and snippets.

@olzhas
Last active November 3, 2023 13:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save olzhas/51b2f6b30b34d9160a9bafcc6be94fca to your computer and use it in GitHub Desktop.
Save olzhas/51b2f6b30b34d9160a9bafcc6be94fca to your computer and use it in GitHub Desktop.
CPU Governor matters

CPU governer matters

If you need increase in computational power from your workstation this might be a right post for you. Power management, in this case CPU Governor, is a software that assures the "best" power consumption by a computer for a particular task. For some reason in Ubuntu 20.04 a default CPU governor (even on stationary PCs) is powersave. This comes in handy, if you are using it for some office applications (text processor, email, client, webbrowsing). However for a real-time control of the electromechanical systems such as robots where we have to be able to use computers performance at full, or for machine learning we desire to minimize time spent on training a model. A small amount of performance boost can be obtain choosing the right CPU governor in our case performance profile. You can enable performance CPU governor on your computer following the instructions below. Open your favorite shell and type following command.

$ sudo systemctl disable ondemand.service
$ echo performance | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor

Reboot your computer, and performance governer should be the default one.

To test if the default governor has changed to the desired performance enter the following and observe if the governor is set correctly

$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor 
performance
$

Done.

PS

In my case, I had extra 10% performance boost.

@olzhas
Copy link
Author

olzhas commented Mar 14, 2018

@fantastic2085
Copy link

$ sudo systemctl disable ondemand.service
$ echo performance | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor

If the command above is used, the restart is invalid

@olzhas
Copy link
Author

olzhas commented Nov 3, 2023

$ sudo systemctl disable ondemand.service $ echo performance | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor

If the command above is used, the restart is invalid

can you elaborate what you meant? your computer cannot reboot after those commands?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment