Green Ai Bench
Benchmarking of frameworks for tracking of energy consumption of running inference.
Developer:
- Freja Thoresen (freja.thoresen@alexandra.dk)
Overview
Green AI Bench is a benchmarking tool designed to measure and compare the energy consumption of various Python libraries, hardware platforms, and power measurement tools. It provides insights into the environmental impact of running inference of machine learning models.
Additional documentation is here: https://alexandrainst.github.io/green_ai_bench
Features
- Library Comparisons: Measure energy consumption using the Python libraries CodeCarbon, PyJoules, and Zeus.
- Hardware Benchmarks: Compare energy usage on different platforms, such as laptop CPUs & GPUs, Raspberry Pi CPUs and Hailo devices.
- Power Supply Integration: Measure actual energy consumption using a Siglent Power Supply.
Project Setup
The following steps will set up the project repository. Furthermore, to set up the Raspberry Pi and Siglent Power Supply, please follow these guides:
- Raspberry Pi Setup: Instructions for setting up Raspberry Pi for experiments.
- Power Supply Guide: Guide for using the Siglent Power Supply.
Installation
- Run
make install
, which sets up a virtual environment and all Python dependencies therein. - Run
source .venv/bin/activate
to activate the virtual environment. - (Optional) Run
make install-pre-commit
, which installs pre-commit hooks for linting, formatting and type checking.
Adding and Removing Packages
To install new PyPI packages, run:
uv add <package-name>
To remove them again, run:
uv remove <package-name>
To show all installed packages, run:
uv pip show
All Built-in Commands
The project includes the following convenience commands:
make install
: Install the project and its dependencies in a virtual environment.make install-pre-commit
: Install pre-commit hooks for linting, formatting and type checking.make lint
: Lint the code usingruff
.make format
: Format the code usingruff
.make type-check
: Type check the code usingmypy
.make test
: Run tests usingpytest
and update the coverage badge in the readme.make docker
: Build a Docker image and run the Docker container.make docs
: View documentation locally in a browser.make publish-docs
: Publish documentation to GitHub Pages.make tree
: Show the project structure as a tree.
Energy Consumption Experiments
These pages will help you get started on running experiments and benchmarking the energy consumption of machine learning models:
- Power Measurements: Details on power measurement experiments.
- Model Compilation: Instructions for compiling models for Hailo devices.