fix: count DRAM in RAPL energy total - #1344
davidberenstein1957 wants to merge 3 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1344 +/- ##
=======================================
Coverage 91.70% 91.70%
=======================================
Files 49 49
Lines 5157 5159 +2
=======================================
+ Hits 4729 4731 +2
Misses 428 428 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
ad8dc5d to
911929e
Compare
f5a7183 to
cb38949
Compare
Aggregate 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>
ad837f7 to
0a24bdb
Compare
Verdict: 🔧 Request changesThe bug is real. DRAM domains keep the raw name Must fix:
Worth documenting:
|
…_include_dram in fallback Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Made the changes in c2cc54b: merged master, DRAM mirror exclusion now uses a |
Description
On Linux, setting
rapl_include_dram=Trueselected DRAM RAPL domains and read their energy every cycle, but that energy never reached the reported total, so the result was identical torapl_include_dram=Falseeven though the log claimed DRAM was included._create_rapl_filesincodecarbon/core/cpu.pynow assigns DRAM domains the same Power-Gadget-compatible display name used for package/psys domains, so the aggregator incodecarbon/external/hardware.pypicks them up. A follow-up commit switches mirror-domain detection to an explicitRAPLFile.is_dramflag instead of the display name, and adjusts the no-package/no-psys fallback to include DRAM only when the flag is set.Related Issue
Fixes #1305
Motivation and Context
DRAM domains fell into an
elsebranch and kept their raw sysfs namedram, which the aggregator's^Processor Energy Delta_\dregex filters out, silently dropping DRAM energy from the reported total whenever a user opted in to measuring it. This also brings Linux RAPL in line with Windows EMI, which already names every selected channel this way.How Has This Been Tested?
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. It fails on master (package-only) and passes with this change.test_rapl_include_dram_true_explicitwas updated since it previously asserted a RAPL file was still nameddram, which is exactly the behavior being fixed. The suite is gated on Linux; locally (macOS) the tests were driven directly withsys.platformpatched, and all tests intests/test_rapl_parameters.pyandtests/test_rapl_mmio_scanning.pypass.Screenshots (if appropriate):
N/A
Types of changes
Note: this is a measurement change. Anyone already setting
rapl_include_dram=Truewill see reported CPU energy increase (correctly), since DRAM is typically 10-20% of package power on memory-heavy workloads.AI Usage Disclosure
Checklist: