Disabling cores to scale back the Pi Zero 2 W’s energy consumption by half

By default, the brand new Pi Zero 2 W (see my Zero 2 W review here) runs a 4-core ARM Cortex A53 CPU at 1 GHz.

Disabling cores to scale back the Pi Zero 2 W’s energy consumption by half

If you have not seen my full weblog put up exploring the Zero 2 W from the within, full with X-ray imagery—go check it out now!

From my overview, I discovered that the Zero 2 makes use of 100 mA at idle (in comparison with 80 mA for the single-core Pi Zero W that preceded it), however will use as much as 500 mA full-tilt, when all 4 CPU cores are maxed out.

For a lot of customers of the Zero 2, that is no downside, as the additional multicore efficiency is value it. However just a few folks requested whether or not disabling cores might save power in conditions the place the software program working on the Zero 2 wasn't multithreaded or did not want a number of CPU cores to run successfully.

So I attempted it! Booting up a recent occasion of 32-bit Pi OS, I checked on the cores:

pi@zero:~ $ lscpu
Structure:        armv7l
Byte Order:          Little Endian
CPU(s):              4
On-line CPU(s) checklist: 0-3
Thread(s) per core:  1
Core(s) per socket:  4
Socket(s):           1
Vendor ID:           ARM
Mannequin:               4
Mannequin identify:          Cortex-A53
Stepping:            r0p4
CPU max MHz:         1000.0000
CPU min MHz:         600.0000
BogoMIPS:            38.40
Flags:               half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32

Working stress-ng -c 4 yielded wherever between 370-460 mA of energy consumption, measured by my PowerJive USB power meter—translating to about 2.3W of energy utilization.

I attempted disabling core 3, by working echo 0 > /sys/gadgets/system/cpu/cpu3/on-line as root, however acquired:

root@zero:/residence/pi# echo 0 > /sys/gadgets/system/cpu/cpu3/on-line
bash: /sys/gadgets/system/cpu/cpu3/on-line: Permission denied

So subsequent, I attempted utilizing the maxcpus option within the kernel command line. I edited the /boot/cmdline.txt file and added maxcpus=1 after console=tty1, then saved the file and rebooted.

Upon rebooting, I observed there was just one Raspberry Pi as a substitute of the customary 4 on the HDMI output—a very good signal if any!

Raspberry Pi boot logo showing one processor core

I logged in and checked:

pi@zero:~ $ lscpu
Structure:         armv7l
Byte Order:           Little Endian
CPU(s):               4
On-line CPU(s) checklist:  0
Off-line CPU(s) checklist: 1-3
Thread(s) per core:   1
Core(s) per socket:   1
Socket(s):            1
Vendor ID:            ARM
Mannequin:                4
Mannequin identify:           Cortex-A53
Stepping:             r0p4
CPU max MHz:          1000.0000
CPU min MHz:          600.0000
BogoMIPS:             64.00
Flags:                half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32

So it appears to be like like that labored! Now, I attempted working stress-ng once more, and positive sufficient, the facility consumption averaged 200 mA (lower than half of the 4-core studying), spiking solely as excessive as 260 mA, so lower than 1.3W.

200ma Raspberry Pi Zero 2 with disabled CPU cores power savings

I nonetheless could not manually carry a core on-line or offline as root, so it appears to be like like you may solely handle them by way of the kernel cmdline.txt choices at boot.

I ran the pts/encode-mp3 check that is a part of the Phoronix suite, to see if the efficiency would match my earlier run, and because it's principally a single-threaded check, it did:

MP3 encode benchmark with single-threaded Phoronix text on Pi Zero 2 W with cores disabled

So there you've got it—with the Pi Zero 2 W, you may cut back energy consumption should you do not want to make use of a number of cores in your undertaking, by disabling them.



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *