Skip to content

PUE is applied to energy but not to reported power #1320

Closed

Description

@davidberenstein1957

When pue is set to anything other than the default 1.0, the PUE factor is applied to the accumulated energy but not to the power values reported in the same row. The result is a CSV (and API record) where energy_consumed cannot be derived from cpu_power + gpu_power + ram_power times the duration, with nothing in the row explaining the gap.

Reproduction

t = EmissionsTracker(pue=1.5, measure_power_secs=1)
t.start(); time.sleep(10); t.stop()

In emissions.csv with cpu_power=45.0, ram_power=10.0, duration=10.0, the reported energy_consumed is 0.000229 kWh, while (45 + 10) W x 10 s = 0.000153 kWh. The difference is exactly the 1.5 PUE factor.

Root cause

In codecarbon/emissions_tracker.py:1178 the PUE is applied to energy only:

energy *= self._pue

The power object returned by measure_power_and_energy is then stored unscaled for every hardware branch (emissions_tracker.py:1184, :1196, :1206, :1216, :1225), and _prepare_emissions_data reports those raw averages next to the scaled energy. Water consumption is already derived from the PUE-scaled energy (emissions_tracker.py:1179), so power is the only quantity left at device scope.

Expected vs actual

Expected: power and energy in the same record describe the same scope, so energy_consumed is reconstructible from the reported power and duration.

Actual: energy and water are facility-level (PUE applied), power is device-level (PUE not applied), and the two disagree by a factor of pue.

Users on the default pue=1.0 see no change either way; only pue != 1 deployments are affected.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions