Uh oh!
There was an error while loading. Please reload this page.
fix: count DRAM in RAPL energy total - #1344
Open
davidberenstein1957 wants to merge 1 commit into
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@## master #1344 +/- ##
=======================================
Coverage 91.43% 91.43% =======================================
Files 49 49 Lines 5057 5058 +1 =======================================
+ Hits 4624 4625 +1
Misses 433 433 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
davidberenstein1957
marked this pull request as ready for review
August 12, 2026 17:37
davidberenstein1957force-pushed
the
fix/rapl-include-dram
branch
from
August 19, 2026 09:18
ad8dc5d to
911929eComparedavidberenstein1957force-pushed
the
fix/rapl-include-dram
branch
2 times, most recently
from
August 19, 2026 14:29
f5a7183 to
cb38949CompareAggregate the dram domain into the reported processor energy alongside package/psys, with tests covering aggregation and the non-power-domain fallback. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
davidberenstein1957force-pushed
the
fix/rapl-include-dram
branch
from
August 19, 2026 15:19
ad837f7 to
0a24bdbCompare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On Linux,
rapl_include_dram=Trueselected DRAM domains and read them every cycle, but their energy never reached the reported total — the result was identical torapl_include_dram=Falsewhile the log claimed DRAM was included.What changed
codecarbon/core/cpu.py—_create_rapl_filesnow assigns the Power-Gadget-compatible display nameProcessor Energy Delta_N(kWh)to DRAM domains as well as package/psys. Previously DRAM fell into theelsebranch and kept its raw sysfs namedram, which the aggregator incodecarbon/external/hardware.py(^Processor Energy Delta_\d) filters out.DRAM domains only reach
_create_rapl_fileswhenrapl_include_dramis true — they are filtered out earlier otherwise — so the default path is unchanged. This also makes Linux match Windows EMI, which already names every selected channel this way (codecarbon/core/windows_emi.py:581) and so has never had the bug.How it was verified
Added
test_rapl_include_dram_energy_is_aggregatedintests/test_rapl_parameters.py, parametrized over both flag values. It builds a fake sysfs tree withpackage-0anddram, advances both counters, callsget_cpu_details(), and asserts the summedProcessor Energy Delta_*value. Withrapl_include_dram=Trueit expects package + DRAM; it fails on master (package-only) and passes with this change. TheFalsecase pins the default path.test_rapl_include_dram_true_explicitwas updated: it previously asserted a RAPL file was still nameddram, which is exactly the behaviour being fixed. It now asserts both domains carry aggregated names.The suite is gated on Linux and CI will exercise it; locally (macOS) the tests were driven directly with
sys.platformpatched, and all tests intest_rapl_parameters.pyandtest_rapl_mmio_scanning.pypass.Note for the changelog
This is a measurement change: anyone already setting
rapl_include_dram=Truewill see reported CPU energy increase (correctly). DRAM is typically 10-20% of package power on memory-heavy workloads.Closes#1305
🤖 Generated with Claude Code