Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I’d like something that would actually disable CPU cores temporarily besides fiddling with governors and clock speeds. I currently do that with a cpufreq GUI wrapper, but it isn’t automatic.


I tried taking 7 of my AMD Ryzen 5800HS’s 8 cores offline with `echo 0 | sudo tee /sys/devices/system/cpu/cpu{2..15}/online >/dev/null` and found it made no measurable difference to battery drain (as in, approximately less than 0.01W and certainly well less than 0.1W). I don’t know if I missed a step for actually turning the cores off, or whether you can’t actually turn them off, or whether the CPU is actually using way less power than I thought when idle (seems rather unlikely given my error bars). But if anyone did know a way of actually turning them off, I’d be very interested to see if I could get the whole laptop stably under 5W.


AMD CPUs can powergate entire cores and do so automatically.


an easy way to test if your cores have gone offlane is to compile a big codebase or transcode a video file.

ffmpeg -i input.mp4 output.mp4

will use x264 which is well optimized to use your whole CPU (you can check htop).


Oh, they go offline alright so that I can’t use them, but since that didn’t reduce power consumption, I’m not sure if the cores are actually switched off. Or if that’s even an option.


If you're comparing idle CPU power consumption, the cores are likely effectively "turned off" while idle anyway.

Offlining CPUs manually is still useful to limit what random software on your computer can do. There should still be difference between loading 1 CPU core to 100% and loading all 8 cores.

Though savings may be cancelled out a bit by CPU using higher boost frequencies when only one core is loaded. So you may need to disable boost too, if you want to save power by disabling CPUs for non-idle use case.

It would be easiest if I could say to the CPU: limit power use to this maximum. It's still doing it anyway to stay within TDP. Maybe there's some manual setting somewhere for that?


I had just hoped that actually off would be better than idling-off, a bit like how idling RAM consumes more power than off RAM.

For AMD’s CPUs/APUs, ryzenadj is a tool that does what you want. I use it when I want to constrain my power usage, switching it to a 5W TDP does better than just choosing the powersave governor.

I found that `sudo ryzenadj --stapm-limit 100 --fast-limit 100 --slow-limit 100`, telling it to aim for the unrealistically low limit of 100mW, reduces the clock speed below the standard 1.2GHz to 400MHz. Idling at 400MHz uses the same power as idling at 1.2GHz, but thrashing all cores at 400MHz definitely uses less power than thrashing all at 1.2GHz, though I can’t remember actual numbers (I did this a few months ago). Turning the machine into a single-thread 400MHz machine definitely slows things down!


I'm not an expert on this, and I don't know how the power-saving states for AMD processors work, but my understanding is that at least for modern Intel CPUs the deepest power-saving states pretty much turn the core off. [1]

Also, I'm not actually sure minimizing the clock frequency is going to maximize power savings. The voltage required for stable operation increases with the clock frequency, but the relationship is not linear. The top frequencies require proportionally higher voltage for the performance gains, so they are less power efficient. However, since the relationship is not linear, there may be a sweet spot between the minimum and the maximum with the lowest energy consumption per operation. [2] The power consumption per second will be at its lowest on the lowest clock frequency, but the power consumption for an entire computation might not be.

[1] https://itigic.com/c-state-on-intel-processors-what-it-is-ho...

[2] Energy-Efficient Data Processing at Sweet Spot Frequencies; Götz et al., 2014; https://link.springer.com/chapter/10.1007/978-3-662-45550-0_..., https://jorge-cardoso.github.io/publications/Papers/CP-2014-...


Idling RAM has to be continually refreshed. In that sense RAM can't really ever be idle. A CPU can be literally off and turned on almost instantly.


Thanks for mentioning ryzenadj. I'll have to try it. :)


Unless you're using a GPU optimized build!


Iiuc AMD chips have more dependencies between chips, so maybe it's more difficult for them to turn one off? Or more likely wasn't worth implementing.


Disable hyperthreading, it saves about 10% energy




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: