Skip to content

CarbonTracker v1.2.0: Live Carbon Intensity from 160+ Regions, CLI Tool, and Apple Silicon Support

Compare
Choose a tag to compare
@PedramBakh PedramBakh released this 11 Sep 15:16
· 79 commits to master since this release

Highlights

🚀 Introducing the CarbonTracker CLI Tool

We are pleased to introduce the Command Line Interface (CLI) tool for CarbonTracker. This addition offers an efficient way to monitor and manage the carbon footprint of your Python scripts. Upon installing CarbonTracker via PyPi, the CLI tool is immediately available for use.

For straightforward usage without live carbon intensity API integration:

carbontracker --script train.py --log_dir ./logs

For users aiming to use live carbon intensity measurements (a feature also introduced in this release, detailed below), the API key can be integrated with the CarbonTracker CLI tool as follows:

carbontracker --script train.py --log_dir ./logs --api_keys '{"electricitymaps": "YOUR_KEY_HERE"}'

🔌 Transition from CO2Signal API

Issue: #1, #52
We have phased out support for the standalone CO2Signal API in favor of its integration into the ElectricityMaps API. This transition ensures greater consistency and addresses previous timeout issues experienced with consecutive requests.

🍏 OS X Support for Apple Silicon Chips

Issue: #24
We have rolled out support for OS X on M1/M2 Apple Silicon chips. This support encompasses all cores of the CPU and GPU, including the neural engine. Note: To initiate power measurements on these chips, users will be required to grant sudo access to the script.

📢 Enhanced Feedback with Verbose Setting

Issue: #35
An identified issue where setting verbose=0 rendered both stdout and the output log empty has been addressed. With the current update, the verbose setting will only affect stdout, leaving the output log intact.

📏 Decimal Precision Update

Issues: #25, #45
We've increased the default decimal precision to 12 to align with kWh and gCO2/kWh units, which are standards in the energy sector. This enhancement has been integrated without affecting existing functionality.

🚨 Enhanced Carbon Intensity Estimation Notifications

Issue: #43
A gap was identified where users were not alerted when default fallback values were used for carbon intensity estimations. This has been addressed to provide notifications in both the log file and stdout.

⚡ Performance Optimization

Issue: #41
Feedback regarding performance slowdowns attributed to busy-waiting in the CarbonTrackerThread() has been addressed. We have transitioned to an event-based approach, resulting in optimized performance.

🛠️ Additional Updates

  • An issue related to fetching NVML device names in carbontracker/components/gpu/nvidia.py for Python versions below 3.10 has been resolved. Issue: #53
  • We have extended our support for live carbon intensity measurements through integration with the ElectricityMaps API, enabling access to over 160 regions. Issue: #54

To leverage this feature, refer to the example below:

from carbontracker.tracker import CarbonTracker
from time import sleep

max_epochs = 10
api_keys = {
    'electricitymaps': "YOUR_API_KEY_HERE"
}

tracker = CarbonTracker(epochs=max_epochs, log_dir="./logs", api_keys=api_keys)

tracker.epoch_start()
# Training loop.
for epoch in range(10):
    
    # Your work here

tracker.epoch_end()
tracker.stop()

We are committed to providing valuable updates to enhance your experience with CarbonTracker.