rapl_include_dram=True reads DRAM domains but never adds them to the energy total
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.9k
- Forks
- 323
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 12
Description
On Linux, rapl_include_dram=True selects the DRAM RAPL domains and reads them every cycle, but their energy never reaches the reported total. The measurement is silently identical to rapl_include_dram=False, while the log claims DRAM is included.
Reproduction
On a machine exposing a top-level dram domain alongside package-0:
a = EmissionsTracker(rapl_include_dram=False)
b = EmissionsTracker(rapl_include_dram=True)
Both report the same CPU energy, even though b logs RAPL - Including 1 DRAM domain(s) for complete hardware power measurement (CPU+DRAM).
Root cause
Two naming conventions that were never tied together.
codecarbon/core/cpu.py:708— domain selection correctly appends DRAM domains whenrapl_include_dramis set.codecarbon/core/cpu.py:772—_create_rapl_filesonly assigns the Power-Gadget-compatible display nameProcessor Energy Delta_N(kWh)to domains whose name containspackageorpsys. A DRAM domain falls into theelseand keeps its raw sysfs namedram.codecarbon/external/hardware.py:390—_get_energy_from_cpussums only keys matching^Processor Energy Delta_\d, so thedramentry is dropped. Same for power:codecarbon/core/cpu.py:849only derives aProcessor Powerkey from names containingEnergy.
Windows EMI does not have this bug: codecarbon/core/windows_emi.py:581 names every selected channel Processor Energy Delta_N(kWh), DRAM included. So emi_include_dram=True works and rapl_include_dram=True does not.
Expected vs actual
Expected: with rapl_include_dram=True, reported CPU energy is package + DRAM (DRAM is typically 10-20% of package power on memory-heavy workloads).
Actual: DRAM energy is read, converted, logged, and discarded. Reported energy equals the package-only value.
Note this is a measurement change for anyone already setting the flag — their reported figures will (correctly) increase.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the RAPL flow in codecarbon/core/cpu.py at lines 708, 772, and 849, then trace aggregation in codecarbon/external/hardware.py:390 and compare the working naming path in codecarbon/core/windows_emi.py:581. Reproduce the package-only versus DRAM-enabled measurements and verify that DRAM contributes to the reported energy and power totals when rapl_include_dram=True.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 74/100