Skip to main content

EcoFreq: compute with cleaner & cheaper energy

CC BY-NC-SA 4.0

In many regions with a high share of renewables - such as Germany, Spain, UK or California - CO2 emissions per kWh of electricity may vary two-fold within a single day, and up to four-fold within a year. This is due to both, variable production from solar and wind, and variable demand (peak hours vs. night-time/weekends). Hence, reducing energy consumption during these periods of high carbon intesity leads to overproportionate CO2 savings. This is exactly the idea behind EcoFreq: it modulates CPU/GPU power consumption in realtime according to the current "greenness" of the grid energy mix. Importantly, this modulation is absolutely transparent to user applications: they will run as usual without interruption, "accelerating" in times when energy comes mostly from renewables, and being throttled when fossil generation increases.

And it gets even better if you have dynamic electricity pricing (e.g., Octopus, Tibber etc.) or on-site solar panels: (being an) EcoFreq can save you a few cents ;)

TL;DR Compute faster when electricity is abundant and green, throttle down when it is expensive and dirty:

Installation

Prerequisites:

First, install EcoFreq package using pip or pipx:

pipx install ecofreq

This will install EcoFreq locally under the current (non-privileged) user. Since power limiting typically requires root privileges, you will need sudo permissions to use all features of EcoFreq (see details).

Alternatively, you can install and run EcoFreq under root:

sudo pipx install ecofreq

This is less secure, but makes configuration simpler.

For production use, you will likely want to configure EcoFreq daemon to run in the background: (HOWTO)

Usage

  • Show information about your system and its power limiting capabilities:
ecofreq info
  • For a quick test of EcoFreq on your system without configuration overhead (using mock CO2 provider):
ecofreq -c mock -l test.log
sudo systemctl start ecofreq
sudo systemctl status ecofreq
sudo systemctl stop ecofreq

Command-line tool ecoctl allows to query and control the EcoFreq service. If you want to run ecoctl without sudo (recommended), either add your user to the ecofreq group, or configure socket permissions accordingly.

  • Show EcoFreq status:
ecoctl
  • Change power scaling policy:
ecoctl policy co2:step:100=0.7:200=0.5

ecoctl policy const:50%

ecoctl policy maxperf
  • Report energy and CO2 for a program run (assuming it runs exclusively -> to be improved):
ecorun sleep 10

time_s:     10.003
pwr_avg_w:  88.724
energy_j:   887.5
energy_kwh: 0.0
co2_g:      0.098
cost_ct:    0.001
  • Report energy and CO2 statistics for a local EcoFreq instance (default log file):
ecostat.py

EcoStat v0.0.1

Loading data from log file: /var/log/ecofreq.log

Time interval:               2022-01-01 00:03:30 - 2022-06-30 23:53:23
Monitoring active:           175 days, 20:24:55
Monitoring inactive:         0:16:44
CO2 intensity range [g/kWh]: 109 - 545
CO2 intensity mean [g/kWh]:  341
Energy consumed [J]:         4358414437.5
Energy consumed [kWh]:       1210.671
= electric car travel [km]:  6053
Total CO2 emitted [kg]:      409.507177

Idle time:                   41 days, 9:43:30
Idle energy [kWh]:           127.437
Idle = e-car travel [km]:    637
Idle CO2 [kg]:               44.531762

For more examples, see USAGE.md

Configuration

See CONFIG.md

Citation

Oleksiy Kozlov, Alexandros Stamatakis. EcoFreq: Compute with Cheaper, Cleaner Energy via Carbon-Aware Power Scaling, ISC-2024.

Open access: https://ieeexplore.ieee.org/document/10528928

Metadata

Release files for ecofreq 0.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ecofreq 0.0.7
File Size Uploaded
ecofreq-0.0.7.tar.gz 69.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ecofreq 0.0.7
File Interpreter ABI Platform
ecofreq-0.0.7-py3-none-any.whl Python 3 none any Details

Total release size: 155.2 kB

Release files / ecofreq-0.0.7.tar.gz

Download URL ecofreq-0.0.7.tar.gz
Size 69.4 kB
Tags Source
SHA-256 checksum
How to use checksums
83dc189b1537b73363e2c80521cf9ac00f923cdf17dc97bb86ec50f2f018ef56
BLAKE2b-256 checksum
How to use checksums
5773bebc2793689893ad5602cbf95abfc192e4de40c653833157463a5c4b45d9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release files / ecofreq-0.0.7-py3-none-any.whl

Download URL ecofreq-0.0.7-py3-none-any.whl
Size 85.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1031604b6699014ad5831bec93e00dfd4923c6beabf3d4644574ebb4c0faf503
BLAKE2b-256 checksum
How to use checksums
c7143ec920d119734fde855880d72f3804992fb502431bacde78eab0cdd84803
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.0.7 This release

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page