Coder Social home page Coder Social logo

amkozlov / eco-freq Goto Github PK

View Code? Open in Web Editor NEW
13.0 6.0 0.0 562 KB

Dynamic CPU/GPU power scaling to maximize renewable energy usage and reduce emissions

License: Other

Python 97.73% Shell 1.31% templ 0.96%
energy-monitor sustainability co2-emissions cpu gpu rapl

eco-freq's Introduction

EcoFreq: compute with cleaner 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 a dynamic electricity tariff (example1, example2) or solar panels: (being an) EcoFreq can save you a few cents ;)

TL;DR Just look at those awesome plots from electricitymap.org and you'll get the idea:

Installation

Prerequisites:

Please run installer script which will register systemd service and create a basic config file for EcoFreq:

sudo ./install.sh

Alternatively, you can specify a custom config file (see examples):

sudo ./install.sh my.ecofreq.cfg

Usage

  • For a quick test of EcoFreq on your system without configuration overhead (using mock CO2 provider):
sudo ./ecofreq.py -c config/mock.cfg -l test.log
  • After installing EcoFreq as a service, you can use standard systemctl commands to control it.
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.py
  • Change power scaling policy:
./ecoctl.py policy co2:step:100=0.7:200=0.5

./ecoctl.py policy const:50%

./ecoctl.py policy maxperf
  • Report energy and CO2 for a program run (assuming it runs exclusively -> to be improved):
./ecorun.py 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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.