Skip to content

New Learning Path: Measure llama.cpp energy per token on a Raspberry Pi 5 with the PMIC ADC - #3908

Merged
jasonrandrews merged 3 commits into
ArmDeveloperEcosystem:mainfrom
manunicholasjacob:rpi5-pmic-energy-per-token
Oct 27, 2026
Merged

jasonrandrews merged 3 commits into
ArmDeveloperEcosystem:mainfrom
manunicholasjacob:rpi5-pmic-energy-per-token

Conversation

@manunicholasjacob

Copy link
Copy Markdown
Contributor

New Learning Path: Measure llama.cpp energy per token on a Raspberry Pi 5 with the PMIC ADC (content/learning-paths/embedded-and-microcontrollers/rpi5-energy-per-token/).

The Raspberry Pi 5 has no hwmon power or current sensors, so the existing performance-per-watt path cannot be followed on it. This path reads the Pi 5 PMIC with vcgencmd pmic_read_adc, logs rail power with a time stamp on every sample, lines the samples up with llama-bench token generation only (model load and warmup excluded, using the --progress lines and samples_ns), and reports joules per token with and without the idle power. It then compares clock caps and thread counts and measures how much the sampler itself slows llama.cpp down.

What is in the PR

  • _index.md, _next-steps.md and 4 pages: read the PMIC, log power, measure joules per token, compare clock caps and threads.
  • Two short Python scripts in the pages (a sampler and a joules-per-token runner, standard library only).
  • Category embedded-and-microcontrollers, subject Performance and Architecture, Advanced, 60 minutes.
  • 3 words in .wordlist.txt (PMIC, pmic, vcgencmd). The contributors.csv row already exists.

How it was tested

  • Raspberry Pi 5, 2 GB, active cooler, Raspberry Pi OS 64-bit, llama.cpp 836d571, official Qwen2.5 0.5B Instruct Q4_0 GGUF (sha256 checked against the pinned Hugging Face URL in the page).
  • Every code block in the pages was extracted from the Markdown and run unchanged on the Pi; the output blocks are pasted from that run.
  • Five extra passes of the 3 clock caps x 3 thread counts sweep, order reversed on alternate passes, 3 x 128-token windows per run, idle window per run. get_throttled was 0x0 before and after every run; SoC temperature 45 to 51 C.
  • Results (five-pass means): 4 threads is the slowest and most expensive setting at every cap (2.4 GHz: 24.0 tok/s and 0.213 J/token vs 31.9 tok/s and 0.132 J/token with 1 thread). With 1 thread the three caps are within 3% in total J/token, inside run-to-run spread; in net J/token 1.5 GHz is 30% below 2.4 GHz at 32% lower speed. Coefficient of variation across passes: tok/s 1.2% or less, J/token 3.8% or less, net J/token 6.7% or less.
  • Sampler overhead (five alternating passes): the full-rail sampler (about 40 Hz) costs 1.8% (1 thread) and 4.5% (4 threads) of tokens per second; the single-rail sampler (100 to 140 Hz) costs 8.0% and 14.0%. Both report the same VDD_CORE power within 0.5%.
  • The page states what the rail sum does not include (no input current, regulator losses, fan, USB) and that the DDR channels read 0 A at idle on this board.
  • Only measured on one Raspberry Pi 5 (2 GB).

Local checks (all pass): full hugo 0.130.0 extended site build (4762 pages, no errors or warnings); internal links on the 6 rendered pages of this path (145 links, 0 broken); external links in the pages resolve; pyspelling with the repo .spellcheck.yml and .wordlist.txt scoped to the path, aspell en_US (passes); tools/verify_index_fields.py (fields verified); tools/style_check.py (0 issues). The --progress stderr lines, -o json and samples_ns that the script reads are unchanged in current llama.cpp master (6868a52).

Disclosure: AI assistance (Claude) drafted the pages and scripts and ran the measurements and checks on my Raspberry Pi 5. Every code block was run unchanged on the Pi, and the output blocks are pasted from that run.

Before submitting a pull request for a new Learning Path, please review Create a Learning Path

  • I have reviewed Create a Learning Path

Please do not include any confidential information in your contribution. This includes confidential microarchitecture details and unannounced product information.

  • I have checked my contribution for confidential information

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the Creative Commons Attribution 4.0 International License.

Generated with Claude Code

manunicholasjacob and others added 2 commits October 14, 2026 00:06
…Pi 5 with the PMIC ADC

Reads the Raspberry Pi 5 PMIC with vcgencmd pmic_read_adc, logs rail
power with time stamps, aligns the samples with llama-bench token
generation only, and compares joules per token across clock caps and
thread counts. Includes the sampler overhead measurement.

Adds PMIC, pmic and vcgencmd to .wordlist.txt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resolve .wordlist.txt as a union of both sides' additions.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: manunicholasjacob <manunicholasjacob@gmail.com>
@jasonrandrews
jasonrandrews merged commit cc4b817 into ArmDeveloperEcosystem:main Oct 27, 2026
1 check passed
@jasonrandrews jasonrandrews removed their assignment Oct 27, 2026
@anupras-mohapatra-arm anupras-mohapatra-arm added ready_to_publish Ready for final review and publish and removed editorial_review labels Oct 28, 2026
@jasonrandrews jasonrandrews moved this from In Progress to Done in Arm Learning Paths Roadmap Nov 3, 2026
@jasonrandrews jasonrandrews added publish and removed ready_to_publish Ready for final review and publish labels Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants