How do I set the CPU frequency scaling governor for all cores at once?
I'd like to set the CPU frequency scaling governor for all cores at once instead of doing it individually for each core. Is there a way to do this?
(I know it would be easy to echo the governor to /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
, but I'm not looking for a custom solution.)
cpufreq
add a comment |
I'd like to set the CPU frequency scaling governor for all cores at once instead of doing it individually for each core. Is there a way to do this?
(I know it would be easy to echo the governor to /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
, but I'm not looking for a custom solution.)
cpufreq
2
With "custom solution" you mean that a shell script is unacceptable, it needs to be a built-in GUI button?
– j-g-faustus
Jan 6 '11 at 16:09
I'm just wondering if there already exists a solution in a standard installation (doesn't need to have a GUI).
– htorque
Jan 6 '11 at 16:20
Check this page: idebian.wordpress.com/2008/06/22/cpu-frequency-scaling-in-linux under "debian implementation": It is apparently possible to change the boot default, and there is a userspace tool called powernowd. (This is a comment rather than reply because the post is from 2008, and I haven't tested if it still works...)
– j-g-faustus
Jan 6 '11 at 22:47
add a comment |
I'd like to set the CPU frequency scaling governor for all cores at once instead of doing it individually for each core. Is there a way to do this?
(I know it would be easy to echo the governor to /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
, but I'm not looking for a custom solution.)
cpufreq
I'd like to set the CPU frequency scaling governor for all cores at once instead of doing it individually for each core. Is there a way to do this?
(I know it would be easy to echo the governor to /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
, but I'm not looking for a custom solution.)
cpufreq
cpufreq
edited Jan 6 '11 at 8:58
htorque
asked Jan 6 '11 at 8:53
htorquehtorque
46.9k32172212
46.9k32172212
2
With "custom solution" you mean that a shell script is unacceptable, it needs to be a built-in GUI button?
– j-g-faustus
Jan 6 '11 at 16:09
I'm just wondering if there already exists a solution in a standard installation (doesn't need to have a GUI).
– htorque
Jan 6 '11 at 16:20
Check this page: idebian.wordpress.com/2008/06/22/cpu-frequency-scaling-in-linux under "debian implementation": It is apparently possible to change the boot default, and there is a userspace tool called powernowd. (This is a comment rather than reply because the post is from 2008, and I haven't tested if it still works...)
– j-g-faustus
Jan 6 '11 at 22:47
add a comment |
2
With "custom solution" you mean that a shell script is unacceptable, it needs to be a built-in GUI button?
– j-g-faustus
Jan 6 '11 at 16:09
I'm just wondering if there already exists a solution in a standard installation (doesn't need to have a GUI).
– htorque
Jan 6 '11 at 16:20
Check this page: idebian.wordpress.com/2008/06/22/cpu-frequency-scaling-in-linux under "debian implementation": It is apparently possible to change the boot default, and there is a userspace tool called powernowd. (This is a comment rather than reply because the post is from 2008, and I haven't tested if it still works...)
– j-g-faustus
Jan 6 '11 at 22:47
2
2
With "custom solution" you mean that a shell script is unacceptable, it needs to be a built-in GUI button?
– j-g-faustus
Jan 6 '11 at 16:09
With "custom solution" you mean that a shell script is unacceptable, it needs to be a built-in GUI button?
– j-g-faustus
Jan 6 '11 at 16:09
I'm just wondering if there already exists a solution in a standard installation (doesn't need to have a GUI).
– htorque
Jan 6 '11 at 16:20
I'm just wondering if there already exists a solution in a standard installation (doesn't need to have a GUI).
– htorque
Jan 6 '11 at 16:20
Check this page: idebian.wordpress.com/2008/06/22/cpu-frequency-scaling-in-linux under "debian implementation": It is apparently possible to change the boot default, and there is a userspace tool called powernowd. (This is a comment rather than reply because the post is from 2008, and I haven't tested if it still works...)
– j-g-faustus
Jan 6 '11 at 22:47
Check this page: idebian.wordpress.com/2008/06/22/cpu-frequency-scaling-in-linux under "debian implementation": It is apparently possible to change the boot default, and there is a userspace tool called powernowd. (This is a comment rather than reply because the post is from 2008, and I haven't tested if it still works...)
– j-g-faustus
Jan 6 '11 at 22:47
add a comment |
7 Answers
7
active
oldest
votes
I'm still a linux noob but don't you think cpufrequtils lets u do it by using
(its not bundled in the Ubuntu OS but is there in the repository)
sudo apt-get install cpufrequtils
sudo cpufreq-set -r -g performance
- The
-r
flag is used to set the change for all ("all hardware related") cores
6
The -r related option doesn't do it for all the cores. We have to specify the cpu number with option -c <number> however this script will do it for all cpus in one go: for ((i=0;i<$(nproc);i++)); do cpufreq-set -c $i -r -g performance; done
– Sri
Sep 11 '14 at 9:50
6
Exactly, @Sri is right.cpufreq-set
in fact lacks of ultimately simple but needed functionality. Lots of people as this vote counters clearly shows are just not aware of it because its description is simply misleading to top it off.
– poige
Oct 27 '15 at 16:43
2
Who gives these +1's without testing???? This does not work at all. I posted the simplest working solution I could find.
– switch87
Dec 1 '16 at 12:51
add a comment |
I googled a lot and I think it's just not possible, so I added the following one-liner to my .bashrc
:
function setgov ()
{
echo "$1" | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
}
Now I can run something like setgov ondemand
and all cores will switch to the ondemand governor.
2
This doesn't work as the file scaling_governor is owned by root and has restricted permissions. Changing the permissions is not always recommended.
– Sri
Sep 11 '14 at 9:16
Please see alternative script in my comment to user49449's answer.
– Sri
Sep 11 '14 at 9:53
add a comment |
the shortest command to change governor of all cores is the following:
sudo bash -c 'for i in {0..7}; do cpufreq-set -c $i -g performance; done'
You could add it to .bashrc like htorque mentioned, you will have to run it as root sudo setgov performance
:
function setgov ()
{
for i in {0..7};
do
cpufreq-set -c $i -g $1;
done
}
add a comment |
Might as well add bash code completion, while we're at it:
function setgovernor () {
echo "$1" | sudo tee
/sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
}
complete -W "$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors)" setgovernor
add a comment |
The way I set this to stick since the governor defaults back to powersave after about 30 seconds now as of Ubuntu 16.04 or sooner (I'm on Ubuntu Mate);
Put this (one line of) code (thank you, courtesy of switch87 in the previous answer)
sleep 60 && bash -c 'for i in {0..7}; do cpufreq-set -c $i -g performance; done'
into the file in the directory
/etc/rc.local
Mine is a line above "exit 0" and uncommented, under the commented ones.
"rc.local" for those who do not know, it runs the command as sudo. Any command it seems, to change the governor, needs to be run as sudo.
It lets the governor reset back to powersave and runs the code as sudo after 60 seconds to change it back to performance.
Change the "60" (in the code you copy) to whatever time (in seconds. 60 = 60 seconds= 1 minute) you need to delay the command and "performance" (in the command part) to what governor you want it to change to.
Out of my hours and hours of searching I have not found a more permanent fix for this than this.
I figure what's a couple of minutes that it's on powersave if this is the best fix I've found, right? Right.
Not the best fix, but it makes it somewhat permanent after it does it's little switch to powersave thing. If you want to boot right up and jump into a game or something you're going to have to wait a minute for the code you just put in to switch it back from powersave or lower the timing on it (depending on how long it takes everything to start up so it'll switch back to performance correctly).
And, as always, to revert back to default (I've seen some issues with people's PCs overheating which is why they might have defaulted it to powersave in the first place) just remove the code from rc.local and reboot or switch it back manually with your cpu icon indicator switcher or run;
sudo /etc/init.d/cpufrequtils restart
in the terminal and or reboot.
add a comment |
Basing on switch87's answer, I made a simple script cpufreq-set-all
, which will allow to do other cpufreq-set
things with all CPUs:
#!/bin/bash
MAX_CPU=$((`nproc --all` - 1))
for i in $(seq 0 $MAX_CPU); do
echo "Changing CPU " $i " with parameter "$@;
cpufreq-set -c $i $@ ;
done
Now it can be invoked(after chmod +x
, of course) like this:
cpufreq-set-all -g powersave
or
cpufreq-set-all -f 800Mhz
add a comment |
You can do this for all cores at once by running
sudo cpupower frequency-set --governor performance
New contributor
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f20271%2fhow-do-i-set-the-cpu-frequency-scaling-governor-for-all-cores-at-once%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
7 Answers
7
active
oldest
votes
7 Answers
7
active
oldest
votes
active
oldest
votes
active
oldest
votes
I'm still a linux noob but don't you think cpufrequtils lets u do it by using
(its not bundled in the Ubuntu OS but is there in the repository)
sudo apt-get install cpufrequtils
sudo cpufreq-set -r -g performance
- The
-r
flag is used to set the change for all ("all hardware related") cores
6
The -r related option doesn't do it for all the cores. We have to specify the cpu number with option -c <number> however this script will do it for all cpus in one go: for ((i=0;i<$(nproc);i++)); do cpufreq-set -c $i -r -g performance; done
– Sri
Sep 11 '14 at 9:50
6
Exactly, @Sri is right.cpufreq-set
in fact lacks of ultimately simple but needed functionality. Lots of people as this vote counters clearly shows are just not aware of it because its description is simply misleading to top it off.
– poige
Oct 27 '15 at 16:43
2
Who gives these +1's without testing???? This does not work at all. I posted the simplest working solution I could find.
– switch87
Dec 1 '16 at 12:51
add a comment |
I'm still a linux noob but don't you think cpufrequtils lets u do it by using
(its not bundled in the Ubuntu OS but is there in the repository)
sudo apt-get install cpufrequtils
sudo cpufreq-set -r -g performance
- The
-r
flag is used to set the change for all ("all hardware related") cores
6
The -r related option doesn't do it for all the cores. We have to specify the cpu number with option -c <number> however this script will do it for all cpus in one go: for ((i=0;i<$(nproc);i++)); do cpufreq-set -c $i -r -g performance; done
– Sri
Sep 11 '14 at 9:50
6
Exactly, @Sri is right.cpufreq-set
in fact lacks of ultimately simple but needed functionality. Lots of people as this vote counters clearly shows are just not aware of it because its description is simply misleading to top it off.
– poige
Oct 27 '15 at 16:43
2
Who gives these +1's without testing???? This does not work at all. I posted the simplest working solution I could find.
– switch87
Dec 1 '16 at 12:51
add a comment |
I'm still a linux noob but don't you think cpufrequtils lets u do it by using
(its not bundled in the Ubuntu OS but is there in the repository)
sudo apt-get install cpufrequtils
sudo cpufreq-set -r -g performance
- The
-r
flag is used to set the change for all ("all hardware related") cores
I'm still a linux noob but don't you think cpufrequtils lets u do it by using
(its not bundled in the Ubuntu OS but is there in the repository)
sudo apt-get install cpufrequtils
sudo cpufreq-set -r -g performance
- The
-r
flag is used to set the change for all ("all hardware related") cores
edited Jan 4 '17 at 18:49
Elder Geek
26.5k952126
26.5k952126
answered Mar 6 '12 at 15:13
user49449user49449
34124
34124
6
The -r related option doesn't do it for all the cores. We have to specify the cpu number with option -c <number> however this script will do it for all cpus in one go: for ((i=0;i<$(nproc);i++)); do cpufreq-set -c $i -r -g performance; done
– Sri
Sep 11 '14 at 9:50
6
Exactly, @Sri is right.cpufreq-set
in fact lacks of ultimately simple but needed functionality. Lots of people as this vote counters clearly shows are just not aware of it because its description is simply misleading to top it off.
– poige
Oct 27 '15 at 16:43
2
Who gives these +1's without testing???? This does not work at all. I posted the simplest working solution I could find.
– switch87
Dec 1 '16 at 12:51
add a comment |
6
The -r related option doesn't do it for all the cores. We have to specify the cpu number with option -c <number> however this script will do it for all cpus in one go: for ((i=0;i<$(nproc);i++)); do cpufreq-set -c $i -r -g performance; done
– Sri
Sep 11 '14 at 9:50
6
Exactly, @Sri is right.cpufreq-set
in fact lacks of ultimately simple but needed functionality. Lots of people as this vote counters clearly shows are just not aware of it because its description is simply misleading to top it off.
– poige
Oct 27 '15 at 16:43
2
Who gives these +1's without testing???? This does not work at all. I posted the simplest working solution I could find.
– switch87
Dec 1 '16 at 12:51
6
6
The -r related option doesn't do it for all the cores. We have to specify the cpu number with option -c <number> however this script will do it for all cpus in one go: for ((i=0;i<$(nproc);i++)); do cpufreq-set -c $i -r -g performance; done
– Sri
Sep 11 '14 at 9:50
The -r related option doesn't do it for all the cores. We have to specify the cpu number with option -c <number> however this script will do it for all cpus in one go: for ((i=0;i<$(nproc);i++)); do cpufreq-set -c $i -r -g performance; done
– Sri
Sep 11 '14 at 9:50
6
6
Exactly, @Sri is right.
cpufreq-set
in fact lacks of ultimately simple but needed functionality. Lots of people as this vote counters clearly shows are just not aware of it because its description is simply misleading to top it off.– poige
Oct 27 '15 at 16:43
Exactly, @Sri is right.
cpufreq-set
in fact lacks of ultimately simple but needed functionality. Lots of people as this vote counters clearly shows are just not aware of it because its description is simply misleading to top it off.– poige
Oct 27 '15 at 16:43
2
2
Who gives these +1's without testing???? This does not work at all. I posted the simplest working solution I could find.
– switch87
Dec 1 '16 at 12:51
Who gives these +1's without testing???? This does not work at all. I posted the simplest working solution I could find.
– switch87
Dec 1 '16 at 12:51
add a comment |
I googled a lot and I think it's just not possible, so I added the following one-liner to my .bashrc
:
function setgov ()
{
echo "$1" | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
}
Now I can run something like setgov ondemand
and all cores will switch to the ondemand governor.
2
This doesn't work as the file scaling_governor is owned by root and has restricted permissions. Changing the permissions is not always recommended.
– Sri
Sep 11 '14 at 9:16
Please see alternative script in my comment to user49449's answer.
– Sri
Sep 11 '14 at 9:53
add a comment |
I googled a lot and I think it's just not possible, so I added the following one-liner to my .bashrc
:
function setgov ()
{
echo "$1" | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
}
Now I can run something like setgov ondemand
and all cores will switch to the ondemand governor.
2
This doesn't work as the file scaling_governor is owned by root and has restricted permissions. Changing the permissions is not always recommended.
– Sri
Sep 11 '14 at 9:16
Please see alternative script in my comment to user49449's answer.
– Sri
Sep 11 '14 at 9:53
add a comment |
I googled a lot and I think it's just not possible, so I added the following one-liner to my .bashrc
:
function setgov ()
{
echo "$1" | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
}
Now I can run something like setgov ondemand
and all cores will switch to the ondemand governor.
I googled a lot and I think it's just not possible, so I added the following one-liner to my .bashrc
:
function setgov ()
{
echo "$1" | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
}
Now I can run something like setgov ondemand
and all cores will switch to the ondemand governor.
edited Apr 18 '11 at 18:06
ΤΖΩΤΖΙΟΥ
74531126
74531126
answered Jan 23 '11 at 22:17
htorquehtorque
46.9k32172212
46.9k32172212
2
This doesn't work as the file scaling_governor is owned by root and has restricted permissions. Changing the permissions is not always recommended.
– Sri
Sep 11 '14 at 9:16
Please see alternative script in my comment to user49449's answer.
– Sri
Sep 11 '14 at 9:53
add a comment |
2
This doesn't work as the file scaling_governor is owned by root and has restricted permissions. Changing the permissions is not always recommended.
– Sri
Sep 11 '14 at 9:16
Please see alternative script in my comment to user49449's answer.
– Sri
Sep 11 '14 at 9:53
2
2
This doesn't work as the file scaling_governor is owned by root and has restricted permissions. Changing the permissions is not always recommended.
– Sri
Sep 11 '14 at 9:16
This doesn't work as the file scaling_governor is owned by root and has restricted permissions. Changing the permissions is not always recommended.
– Sri
Sep 11 '14 at 9:16
Please see alternative script in my comment to user49449's answer.
– Sri
Sep 11 '14 at 9:53
Please see alternative script in my comment to user49449's answer.
– Sri
Sep 11 '14 at 9:53
add a comment |
the shortest command to change governor of all cores is the following:
sudo bash -c 'for i in {0..7}; do cpufreq-set -c $i -g performance; done'
You could add it to .bashrc like htorque mentioned, you will have to run it as root sudo setgov performance
:
function setgov ()
{
for i in {0..7};
do
cpufreq-set -c $i -g $1;
done
}
add a comment |
the shortest command to change governor of all cores is the following:
sudo bash -c 'for i in {0..7}; do cpufreq-set -c $i -g performance; done'
You could add it to .bashrc like htorque mentioned, you will have to run it as root sudo setgov performance
:
function setgov ()
{
for i in {0..7};
do
cpufreq-set -c $i -g $1;
done
}
add a comment |
the shortest command to change governor of all cores is the following:
sudo bash -c 'for i in {0..7}; do cpufreq-set -c $i -g performance; done'
You could add it to .bashrc like htorque mentioned, you will have to run it as root sudo setgov performance
:
function setgov ()
{
for i in {0..7};
do
cpufreq-set -c $i -g $1;
done
}
the shortest command to change governor of all cores is the following:
sudo bash -c 'for i in {0..7}; do cpufreq-set -c $i -g performance; done'
You could add it to .bashrc like htorque mentioned, you will have to run it as root sudo setgov performance
:
function setgov ()
{
for i in {0..7};
do
cpufreq-set -c $i -g $1;
done
}
edited Dec 1 '16 at 12:53
answered Dec 1 '16 at 12:48
switch87switch87
15114
15114
add a comment |
add a comment |
Might as well add bash code completion, while we're at it:
function setgovernor () {
echo "$1" | sudo tee
/sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
}
complete -W "$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors)" setgovernor
add a comment |
Might as well add bash code completion, while we're at it:
function setgovernor () {
echo "$1" | sudo tee
/sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
}
complete -W "$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors)" setgovernor
add a comment |
Might as well add bash code completion, while we're at it:
function setgovernor () {
echo "$1" | sudo tee
/sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
}
complete -W "$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors)" setgovernor
Might as well add bash code completion, while we're at it:
function setgovernor () {
echo "$1" | sudo tee
/sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
}
complete -W "$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors)" setgovernor
answered Jun 5 '18 at 22:03
Ray MalangaRay Malanga
211
211
add a comment |
add a comment |
The way I set this to stick since the governor defaults back to powersave after about 30 seconds now as of Ubuntu 16.04 or sooner (I'm on Ubuntu Mate);
Put this (one line of) code (thank you, courtesy of switch87 in the previous answer)
sleep 60 && bash -c 'for i in {0..7}; do cpufreq-set -c $i -g performance; done'
into the file in the directory
/etc/rc.local
Mine is a line above "exit 0" and uncommented, under the commented ones.
"rc.local" for those who do not know, it runs the command as sudo. Any command it seems, to change the governor, needs to be run as sudo.
It lets the governor reset back to powersave and runs the code as sudo after 60 seconds to change it back to performance.
Change the "60" (in the code you copy) to whatever time (in seconds. 60 = 60 seconds= 1 minute) you need to delay the command and "performance" (in the command part) to what governor you want it to change to.
Out of my hours and hours of searching I have not found a more permanent fix for this than this.
I figure what's a couple of minutes that it's on powersave if this is the best fix I've found, right? Right.
Not the best fix, but it makes it somewhat permanent after it does it's little switch to powersave thing. If you want to boot right up and jump into a game or something you're going to have to wait a minute for the code you just put in to switch it back from powersave or lower the timing on it (depending on how long it takes everything to start up so it'll switch back to performance correctly).
And, as always, to revert back to default (I've seen some issues with people's PCs overheating which is why they might have defaulted it to powersave in the first place) just remove the code from rc.local and reboot or switch it back manually with your cpu icon indicator switcher or run;
sudo /etc/init.d/cpufrequtils restart
in the terminal and or reboot.
add a comment |
The way I set this to stick since the governor defaults back to powersave after about 30 seconds now as of Ubuntu 16.04 or sooner (I'm on Ubuntu Mate);
Put this (one line of) code (thank you, courtesy of switch87 in the previous answer)
sleep 60 && bash -c 'for i in {0..7}; do cpufreq-set -c $i -g performance; done'
into the file in the directory
/etc/rc.local
Mine is a line above "exit 0" and uncommented, under the commented ones.
"rc.local" for those who do not know, it runs the command as sudo. Any command it seems, to change the governor, needs to be run as sudo.
It lets the governor reset back to powersave and runs the code as sudo after 60 seconds to change it back to performance.
Change the "60" (in the code you copy) to whatever time (in seconds. 60 = 60 seconds= 1 minute) you need to delay the command and "performance" (in the command part) to what governor you want it to change to.
Out of my hours and hours of searching I have not found a more permanent fix for this than this.
I figure what's a couple of minutes that it's on powersave if this is the best fix I've found, right? Right.
Not the best fix, but it makes it somewhat permanent after it does it's little switch to powersave thing. If you want to boot right up and jump into a game or something you're going to have to wait a minute for the code you just put in to switch it back from powersave or lower the timing on it (depending on how long it takes everything to start up so it'll switch back to performance correctly).
And, as always, to revert back to default (I've seen some issues with people's PCs overheating which is why they might have defaulted it to powersave in the first place) just remove the code from rc.local and reboot or switch it back manually with your cpu icon indicator switcher or run;
sudo /etc/init.d/cpufrequtils restart
in the terminal and or reboot.
add a comment |
The way I set this to stick since the governor defaults back to powersave after about 30 seconds now as of Ubuntu 16.04 or sooner (I'm on Ubuntu Mate);
Put this (one line of) code (thank you, courtesy of switch87 in the previous answer)
sleep 60 && bash -c 'for i in {0..7}; do cpufreq-set -c $i -g performance; done'
into the file in the directory
/etc/rc.local
Mine is a line above "exit 0" and uncommented, under the commented ones.
"rc.local" for those who do not know, it runs the command as sudo. Any command it seems, to change the governor, needs to be run as sudo.
It lets the governor reset back to powersave and runs the code as sudo after 60 seconds to change it back to performance.
Change the "60" (in the code you copy) to whatever time (in seconds. 60 = 60 seconds= 1 minute) you need to delay the command and "performance" (in the command part) to what governor you want it to change to.
Out of my hours and hours of searching I have not found a more permanent fix for this than this.
I figure what's a couple of minutes that it's on powersave if this is the best fix I've found, right? Right.
Not the best fix, but it makes it somewhat permanent after it does it's little switch to powersave thing. If you want to boot right up and jump into a game or something you're going to have to wait a minute for the code you just put in to switch it back from powersave or lower the timing on it (depending on how long it takes everything to start up so it'll switch back to performance correctly).
And, as always, to revert back to default (I've seen some issues with people's PCs overheating which is why they might have defaulted it to powersave in the first place) just remove the code from rc.local and reboot or switch it back manually with your cpu icon indicator switcher or run;
sudo /etc/init.d/cpufrequtils restart
in the terminal and or reboot.
The way I set this to stick since the governor defaults back to powersave after about 30 seconds now as of Ubuntu 16.04 or sooner (I'm on Ubuntu Mate);
Put this (one line of) code (thank you, courtesy of switch87 in the previous answer)
sleep 60 && bash -c 'for i in {0..7}; do cpufreq-set -c $i -g performance; done'
into the file in the directory
/etc/rc.local
Mine is a line above "exit 0" and uncommented, under the commented ones.
"rc.local" for those who do not know, it runs the command as sudo. Any command it seems, to change the governor, needs to be run as sudo.
It lets the governor reset back to powersave and runs the code as sudo after 60 seconds to change it back to performance.
Change the "60" (in the code you copy) to whatever time (in seconds. 60 = 60 seconds= 1 minute) you need to delay the command and "performance" (in the command part) to what governor you want it to change to.
Out of my hours and hours of searching I have not found a more permanent fix for this than this.
I figure what's a couple of minutes that it's on powersave if this is the best fix I've found, right? Right.
Not the best fix, but it makes it somewhat permanent after it does it's little switch to powersave thing. If you want to boot right up and jump into a game or something you're going to have to wait a minute for the code you just put in to switch it back from powersave or lower the timing on it (depending on how long it takes everything to start up so it'll switch back to performance correctly).
And, as always, to revert back to default (I've seen some issues with people's PCs overheating which is why they might have defaulted it to powersave in the first place) just remove the code from rc.local and reboot or switch it back manually with your cpu icon indicator switcher or run;
sudo /etc/init.d/cpufrequtils restart
in the terminal and or reboot.
answered Apr 13 '18 at 4:35
RoiikkaRoiikka
262
262
add a comment |
add a comment |
Basing on switch87's answer, I made a simple script cpufreq-set-all
, which will allow to do other cpufreq-set
things with all CPUs:
#!/bin/bash
MAX_CPU=$((`nproc --all` - 1))
for i in $(seq 0 $MAX_CPU); do
echo "Changing CPU " $i " with parameter "$@;
cpufreq-set -c $i $@ ;
done
Now it can be invoked(after chmod +x
, of course) like this:
cpufreq-set-all -g powersave
or
cpufreq-set-all -f 800Mhz
add a comment |
Basing on switch87's answer, I made a simple script cpufreq-set-all
, which will allow to do other cpufreq-set
things with all CPUs:
#!/bin/bash
MAX_CPU=$((`nproc --all` - 1))
for i in $(seq 0 $MAX_CPU); do
echo "Changing CPU " $i " with parameter "$@;
cpufreq-set -c $i $@ ;
done
Now it can be invoked(after chmod +x
, of course) like this:
cpufreq-set-all -g powersave
or
cpufreq-set-all -f 800Mhz
add a comment |
Basing on switch87's answer, I made a simple script cpufreq-set-all
, which will allow to do other cpufreq-set
things with all CPUs:
#!/bin/bash
MAX_CPU=$((`nproc --all` - 1))
for i in $(seq 0 $MAX_CPU); do
echo "Changing CPU " $i " with parameter "$@;
cpufreq-set -c $i $@ ;
done
Now it can be invoked(after chmod +x
, of course) like this:
cpufreq-set-all -g powersave
or
cpufreq-set-all -f 800Mhz
Basing on switch87's answer, I made a simple script cpufreq-set-all
, which will allow to do other cpufreq-set
things with all CPUs:
#!/bin/bash
MAX_CPU=$((`nproc --all` - 1))
for i in $(seq 0 $MAX_CPU); do
echo "Changing CPU " $i " with parameter "$@;
cpufreq-set -c $i $@ ;
done
Now it can be invoked(after chmod +x
, of course) like this:
cpufreq-set-all -g powersave
or
cpufreq-set-all -f 800Mhz
edited Apr 7 '18 at 23:58
Joel Caez
33
33
answered Dec 8 '16 at 11:56
side2kside2k
1011
1011
add a comment |
add a comment |
You can do this for all cores at once by running
sudo cpupower frequency-set --governor performance
New contributor
add a comment |
You can do this for all cores at once by running
sudo cpupower frequency-set --governor performance
New contributor
add a comment |
You can do this for all cores at once by running
sudo cpupower frequency-set --governor performance
New contributor
You can do this for all cores at once by running
sudo cpupower frequency-set --governor performance
New contributor
New contributor
answered Jan 10 at 17:34
Martin AnderssonMartin Andersson
1012
1012
New contributor
New contributor
add a comment |
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f20271%2fhow-do-i-set-the-cpu-frequency-scaling-governor-for-all-cores-at-once%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
With "custom solution" you mean that a shell script is unacceptable, it needs to be a built-in GUI button?
– j-g-faustus
Jan 6 '11 at 16:09
I'm just wondering if there already exists a solution in a standard installation (doesn't need to have a GUI).
– htorque
Jan 6 '11 at 16:20
Check this page: idebian.wordpress.com/2008/06/22/cpu-frequency-scaling-in-linux under "debian implementation": It is apparently possible to change the boot default, and there is a userspace tool called powernowd. (This is a comment rather than reply because the post is from 2008, and I haven't tested if it still works...)
– j-g-faustus
Jan 6 '11 at 22:47