Energy & Carbon Footprint Tracking in AI

Suggest an Edit

Reading time: 5 min

Why Measure Carbon Footprint in AI?

Carbon footprint refers to the total greenhouse gas (GHG) emissions caused by an activity. In machine learning, large-scale model training consumes significant energy, contributing to emissions.

Why Track Energy & Emissions?

  1. AI’s Environmental Impact – Large ML models require high computational power, leading to increased energy consumption.
  2. Optimization & Efficiency – Identifying high-energy-consuming functions helps optimize and reduce resource waste.
  3. Regulatory & Compliance Needs – Researchers, businesses, and policymakers aim to quantify AI’s carbon impact.
  4. Cost Reduction – Efficient energy usage leads to lower operational costs.

Measuring AI’s energy consumption allows better optimization, improved sustainability, and transparency in reporting emissions.

How is Carbon Footprint Measured?

Measuring the carbon footprint of AI involves two main steps:

  1. Energy Consumption Measurement Tools like CodeCarbon use hardware sensors—such as Intel RAPL for CPUs and NVIDIA NVML for GPUs—to track power usage. We integrate power over time (kWh) to determine the total energy consumed during model training or inference.

  2. Carbon Emissions Calculation The total energy (in kWh) is multiplied by the regional carbon intensity (gCO₂/kWh) to estimate emissions using the formula: Total CO₂ Emissions = Energy (kWh) × Carbon Intensity (gCO₂/kWh)

    Where:

    • Energy = Sum of hardware power usage over runtime
    • Carbon Intensity = Grid emission factor for the region

    For example, the Regional Carbon Intensity fetches location-based CO₂ per kWh data from public sources (e.g., Ember Climate). It can auto-detect cloud provider regions (AWS, Azure, GCP) or use user-provided location.

📌 Quick Reference to Energy/Carbon Tracking Tools

Below is a high-level comparison of popular open-source tools for measuring energy consumption and carbon footprint in machine learning workloads.

ToolMeasurement LevelCompatibilityEase of UseInstallationReal-Time Monitoring?LicenseDocs & SupportNotes
CentML DeepViewCode + model level, predicts usage on different GPUs/cloudsMost GPUs, cloud providersIntuitive UI, runs in IDE (VSCode)VSCode plugin✅ Inline monitoring, interactive UIApache 2.0 (Free)GitHub RepoBest for real-time analysis in VSCode
AIPowerMeterFunction-level CPU/GPU (Intel CPU only, GPU not always covered)Intel processors (no guarantee for GPUs)Requires experiment setupScript to install❌ No real-time (post-run results)FreeDocsBest for CPU-centric measurement
CarbonAIFunction-level monitoringMost platformsRequires code instrumentationPython package❌ No real-time (post-run results)FreeGitHub RepoSimple setup, minimal overhead
CarbonTrackerCode-level usage (Nvidia GPU, Intel CPU, Slurm, Colab, Jupyter)Nvidia GPU, Intel CPU, HPC platformsRequires code annotationsPython package❌ No real-time (post-run results)MIT License (Free)GitHub RepoGood for ML workflows in HPC
CodeCarbonHardware-level (GPU + CPU + RAM) + regional carbon intensityOnline/Offline tracking supportedRequires experiment setupPython package📊 Dashboard after executionFreeGitHub RepoSupports regional carbon intensity
Eco2AIFunction-level CPU/GPU + region-based emission coefficientMost platformsRequires experiment setupPython package❌ No real-time (post-run results)Apache 2.0 (Free)GitHub RepoSimilar to CodeCarbon, with function-level insights
experiment-impact-trackerFunction-level measurementLinux, MacOS (Nvidia GPU & Intel CPU)Requires code instrumentationPython package❌ No real-time (post-run results)FreeGitHub RepoBest for tracking on HPC clusters
PowermeterGPU-level (Nvidia-only)Nvidia GPUsRequires code instrumentationPython package❌ No real-time (post-run results)Free(GitHub repo not well maintained)Focused purely on Nvidia GPU tracking
PyJoulesMachine-level monitoringLinux-only (no MacOS support)Requires code instrumentationPython package❌ No real-time (post-run results)MIT License (Free)GitHub RepoGood for system-wide tracking
TracarbonDevice-level CPU/GPU + region-based emissionMac, Linux, AWSRequires code instrumentationPython package❌ No real-time (post-run results)Apache 2.0 (Free)(GitHub repo available, active dev.)Good for Mac & AWS
ZeusFunction-level measurement + optimizationNot specifiedRequires code instrumentationPython package❌ No real-time (post-run results)Apache 2.0 (Free)(GitHub repo available)Offers additional energy optimizations

🎯 Which Tool Should You Choose?

  • ✅ For real-time monitoring:
    • CentML DeepView (best for VSCode users, interactive UI)
  • 🖥️ If you need CPU energy tracking:
    • AIPowerMeter (Intel CPU), PyJoules
  • ⚡ If you want region-based emissions tracking:
    • CodeCarbon, Eco2AI, Tracarbon
  • 🖥️ If you're running on HPC / Nvidia GPUs:
    • CarbonTracker, experiment-impact-tracker, Powermeter
  • 🔍 For GPU-only tracking:
    • Powermeter (Nvidia-only), Zeus

🌱 Final Thoughts

Tracking energy consumption and carbon footprint in AI/ML workloads is becoming increasingly important for:

  • Sustainability & Green AI initiatives
  • Cost-effective resource management
  • Improved algorithmic efficiency & optimization
  • Transparency & compliance with sustainability goals

Researchers, engineers, and businesses can actively monitor and even reduce the carbon impact of AI using , while making their models more efficient and cost-effective.

  1. Intel RAPL Documentation
  2. NVIDIA NVML Library
  3. Ember Data on Grid Emissions
  4. CodeCarbon GitHub Repository

Contributors: