Re:The Old Computer Challenge
by chrismorgan on Friday July 09, 2021 @04:03AM
(#27781456)
I have a new very powerful laptop: ASUS Zephyrus G15 (GA503QM), AMD Ryzen 5800HS, 16GB of 3200MHz DDR4 RAM, 500GiB NVMe, NVIDIA GeForce RTX 3060 that I’ll probably literally never use (seriously, I wish they’d make powerful laptops without dedicated GPUs, but they basically don’t exist as a class—I think a couple by Tuxedo are all I found of the 4000H-series). I’ve been playing with ways of reducing its power consumption. I use Arch Linux. I’ve got it down to about 6.2W at its best and can easily keep it under 9W on my typical workloads without getting too aggressive.
CPU: disabling cores is easy: `echo 0 | sudo tee /sys/devices/system/cpu/cpu{1..15}/online >/dev/null` leaves just the one thread, cpu0. (I don’t know if this approach will speed things up a bit again by disabling Spectre/whatever mitigations; maybe it does, or maybe you need to explicitly disable SMT via `echo off | sudo tee /sys/devices/system/cpu/smt/control` or similar, or maybe you still need to mess around with kernel parameters like mitigations=off.)
Keeping it to its minimum clock speed is easy: `echo powersave | sudo tee /sys/devices/system/cpu/cpufreq/policy*/scaling_governor >/dev/null 2>/dev/null` (2>/dev/null purely for convenience because the write will fail on offline cores and announce that to stderr). This is probably obviated by the next step, but I mention it anyway.
As for what the minimum clock speed is, normally it’s 1.2GHz, but I discovered that if you tell the CPU to use an absurdly (implausibly) low power limit, like `sudo ryzenadj --stapm-limit 100 --fast-limit 100 --slow-limit 100` (100 meaning 100mW), it drops its clock speed to 400MHz. That’s pretty good for old-computer simulation. (For my purposes of reducing power usage: it uses no less power at 400MHz than at 1.2GHz when idle, though under a heavy mixed load it’ll stay under 10W where 1.2GHz can get past 14W. Undervolting might have some effect, I’m not sure, but I haven’t played with that.)
I can report from personal experience that it’s definitely slower with one thread at 400MHz than sixteen threads roaring along at 4GHz (seriously, I’ve found compiling workloads like the Linux kernel and Rust can sustain 4GHz on all cores indefinitely in the current winter ambient temperature of 10–20°C), but still pretty usable.
But that’s only the CPU—it’ll be enormously faster than a genuine old computer with a 400MHz CPU for anything memory- or I/O-bound. I have no idea how to slow down other parts of the system. To be a realistic simulation of an old computer, you’d need to throttle the GPU (amdgpu, don’t even bother with nvidia), memory, storage, and perhaps network. I should try to find out about these at some point (or someone can tell me!) and see if I can reduce power consumption that way.
CPU: disabling cores is easy: `echo 0 | sudo tee /sys/devices/system/cpu/cpu{1..15}/online >/dev/null` leaves just the one thread, cpu0. (I don’t know if this approach will speed things up a bit again by disabling Spectre/whatever mitigations; maybe it does, or maybe you need to explicitly disable SMT via `echo off | sudo tee /sys/devices/system/cpu/smt/control` or similar, or maybe you still need to mess around with kernel parameters like mitigations=off.)
Keeping it to its minimum clock speed is easy: `echo powersave | sudo tee /sys/devices/system/cpu/cpufreq/policy*/scaling_governor >/dev/null 2>/dev/null` (2>/dev/null purely for convenience because the write will fail on offline cores and announce that to stderr). This is probably obviated by the next step, but I mention it anyway.
As for what the minimum clock speed is, normally it’s 1.2GHz, but I discovered that if you tell the CPU to use an absurdly (implausibly) low power limit, like `sudo ryzenadj --stapm-limit 100 --fast-limit 100 --slow-limit 100` (100 meaning 100mW), it drops its clock speed to 400MHz. That’s pretty good for old-computer simulation. (For my purposes of reducing power usage: it uses no less power at 400MHz than at 1.2GHz when idle, though under a heavy mixed load it’ll stay under 10W where 1.2GHz can get past 14W. Undervolting might have some effect, I’m not sure, but I haven’t played with that.)
I can report from personal experience that it’s definitely slower with one thread at 400MHz than sixteen threads roaring along at 4GHz (seriously, I’ve found compiling workloads like the Linux kernel and Rust can sustain 4GHz on all cores indefinitely in the current winter ambient temperature of 10–20°C), but still pretty usable.
But that’s only the CPU—it’ll be enormously faster than a genuine old computer with a 400MHz CPU for anything memory- or I/O-bound. I have no idea how to slow down other parts of the system. To be a realistic simulation of an old computer, you’d need to throttle the GPU (amdgpu, don’t even bother with nvidia), memory, storage, and perhaps network. I should try to find out about these at some point (or someone can tell me!) and see if I can reduce power consumption that way.