communityfix.org

Montreal, Quebec, Canada

#00157

OngoingGlobal

Case study of

#00165 Measure the emissions of compute you run yourself by sampling hardware power and applying local grid carbon intensity

Implementer

Mila, BCG GAMMA, Haverford College, Comet.ml, with Data For Good France volunteers (now stewarded by the CodeCarbon non-profit)

Timeline

Since Dec 1, 2020

Location

Montreal, Quebec, Canada45.5506, -73.6022

Description

CodeCarbon is an open-source Python package that estimates CO2 from code execution. An EmissionsTracker (used as a context manager or decorator) samples CPU energy via Intel RAPL, GPU energy via NVIDIA NVML, and RAM energy over a run, multiplies by region-specific grid carbon intensity, and logs the result locally or to a dashboard, optionally emitting a LaTeX snippet for papers. Released 2020-12-01 by Mila, BCG GAMMA, Haverford College, and Comet.ml, with Data For Good France volunteers. When RAPL is unavailable, it falls back to an estimation mode. It does not separately model disk I/O, network, cooling, or data-centre PUE.

Lessons learned

  • Measuring self-run compute is tractable because power can be sampled directly from hardware counters; the dominant uncertainty is the grid carbon-intensity factor, not the energy measurement itself.
  • Scoping to CPU, GPU and RAM keeps instrumentation overhead low and adoption easy, at the cost of omitting disk, network, cooling and embodied hardware impacts — a conscious trade-off to document when adopting this approach.

Documented Jul 13, 2026

Author AvatarArnaud Gissinger

communityfix.org