Python package to monitor the power consumption of any algorithm

Related tags

Algorithms CarbonAI
Overview

CarbonAI

This project aims at creating a python package that allows you to monitor the power consumption of any python function.

Documentation

The complete documentation is available here.

Getting started

Install

First of all you need to install the intel utility allowing you to monitor power consumption (support):

To install this package :

pip install carbonai

Example

There are several ways to use this package depending on how you develop. You just have to import the PowerMeter object, initialize it and call the function you want to monitor. Please insert a description of the running function, the dataset, the model, any info would be useful.

Function decorator

To monitor the power consumption of a function, follow this example:

.shape, algorithm_params="n_estimators=300, max_depth=15", comments="Classifier trained on the MNIST dataset, 3rd test" ) def my_func(arg1, arg2, ...): # Do something ">
from carbonai import PowerMeter
power_meter = PowerMeter(project_name="MNIST classifier")

@power_meter.measure_power(
  package="sklearn",
  algorithm="RandomForestClassifier",
  data_type="tabular",
  data_shape=<your_data>.shape,
  algorithm_params="n_estimators=300, max_depth=15",
  comments="Classifier trained on the MNIST dataset, 3rd test"
)
def my_func(arg1, arg2, ...):
  # Do something

Using the with statement

To monitor the power consumption of some specific inline code, you can use with statements

.shape, algorithm_params="n_estimators=300, max_depth=15", comments="Classifier trained on the MNIST dataset, 3rd test" ): # Do something ">
from carbonai import PowerMeter
power_meter = PowerMeter(project_name="MNIST classifier")

with power_meter(
  package="sklearn",
  algorithm="RandomForestClassifier",
  data_type="tabular",
  data_shape=<your_data>.shape,
  algorithm_params="n_estimators=300, max_depth=15",
  comments="Classifier trained on the MNIST dataset, 3rd test"
):
  # Do something

Contribute

All contributions, bug reports, bug fixes, documentation improvements, enhancements, and ideas are welcome.

You can find details on how to contribute in our guide

Comments
  • Why not CodeCarbon ?

    Why not CodeCarbon ?

    Hello, I'm a contributor of CodeCarbon and I'd like to know why you start this from scratch instead of using and contributing to CodeCarbon ? What do you thing is missing ? Or do you think we are going in the wrong direction ? Don't get me wrong, having challengers, like Scaphandre, is good but I really don't get what you do differently from CodeCarbon.

    opened by benoit-cty 4
  • 'log' is deprecated by the sklearn package in favour of 'log_loss'.

    'log' is deprecated by the sklearn package in favour of 'log_loss'.

    This results in numerous warnings "FutureWarning: The loss 'log' was deprecated in v1.1 and will be removed in version 1.3. Use `loss='log_loss'". The issue is applicable only to the 'usage_example.py' application.

    opened by pheest 1
  • Incorrect ISO country code for Great Britain

    Incorrect ISO country code for Great Britain

    The data/ademe_energy_mix_by_country.csv contains a lookup of country names. The United Kingdom is listed there as Royaume-Uni,0.457,UK.

    However, the ISO county code for Great Britain is actually GB (see https://en.wikipedia.org/wiki/ISO_3166-2:GB)

    This causes a NameError to be raised in __get_energy_mix().

    opened by pheest 1
  • Fix intel power gadget bug on windows

    Fix intel power gadget bug on windows

    • Fix a bug that did not start the program Intel Power Gadget on some windows environments.
    • Check if a powerlog file exists before opening it
    • Add an argument to set the output path from intel power gadget
    opened by Neyri 0
  • Intel Power Gadget doesn't work on new Apple's M1 Mac

    Intel Power Gadget doesn't work on new Apple's M1 Mac

    Intel Power Gadget is not available on the new Apple's Macbooks using M1 (and probably M2 in the future).

    We should probably add a handler leveraging macos powermetrics utility. We could also consider leverage this repo https://github.com/singhkays/apple-m1-power-consumption-powermetrics

    Note: powermetrics requires root privilegies...

    opened by Neyri 0
  • Dev intel scrap

    Dev intel scrap

    Development of a script to scrape the intel website and retrieve the technical characteristics of the processors put on the market. Then recovery of the technical characteristics of AMD processors. Finally pooling of the two extracted databases.

    opened by Thibault-venet 0
  • Raise meaningful error when IntelPowerGadget doesn't have sufficient privileges

    Raise meaningful error when IntelPowerGadget doesn't have sufficient privileges

    On MacOs, when the user didn't provide Intel Power Gadget with sufficient privileges and try to run carbonai, they get the following error KeyError: 'Cumulative process CPU Energy (mWh)' We should check if the user has provided those privileges when initializing the PowerGadget and raise a meaningful error if it's not the case

    opened by Neyri 0
  • Migrate documentation to readthedocs

    Migrate documentation to readthedocs

    Migrate the documentation from Github Pages to readthedocs.

    • Make sur to keep the pydata template.
    • See how we can keep several versions.
    • Write a github action to do so
    opened by Neyri 1
Owner
Capgemini Invent France
Capgemini Invent France
Using A * search algorithm and GBFS search algorithm to solve the Romanian problem

Romanian-problem-using-Astar-and-GBFS Using A * search algorithm and GBFS search algorithm to solve the Romanian problem Romanian problem: The agent i

Mahdi Hassanzadeh 6 Nov 22, 2022
A Python Package for Portfolio Optimization using the Critical Line Algorithm

A Python Package for Portfolio Optimization using the Critical Line Algorithm

null 19 Oct 11, 2022
Python Package for Reflection Ultrasound Computed Tomography (RUCT) Delay And Sum (DAS) Algorithm

pyruct Python Package for Reflection Ultrasound Computed Tomography (RUCT) Delay And Sum (DAS) Algorithm The imaging setup is explained in these paper

Berkan Lafci 21 Dec 12, 2022
Algorithms for calibrating power grid distribution system models

Distribution System Model Calibration Algorithms The code in this library was developed by Sandia National Laboratories under funding provided by the

Sandia National Laboratories 2 Oct 31, 2022
A fast python implementation of the SimHash algorithm.

This Python package provides hashing algorithms for computing cohort ids of users based on their browsing history. As such, it may be used to compute cohort ids of users following Google's Federated Learning of Cohorts (FLoC) proposal.

Hybrid Theory 19 Dec 15, 2022
A genetic algorithm written in Python for educational purposes.

Genea: A Genetic Algorithm in Python Genea is a Genetic Algorithm written in Python, for educational purposes. I started writing it for fun, while lea

Dom De Felice 20 Jul 6, 2022
An implementation of ordered dithering algorithm in python as multimedia course project

One way of minimizing the size of an image is to simply reduce the number of bits you use to represent each pixel.

null 7 Dec 2, 2022
A python implementation of the Basic Photometric Stereo Algorithm

Photometric-Stereo A python implementation of the Basic Photometric Stereo Algorithm Result Usage run Photometric_Stereo.py Code Tree |data #原始数据,tga格

null 20 Dec 19, 2022
marching rectangles algorithm in python with clean code.

Marching Rectangles marching rectangles algorithm in python with clean code. Tools Python 3 EasyDraw Creators Mohammad Dori Run the Code Installation

Mohammad Dori 3 Jul 15, 2022
marching Squares algorithm in python with clean code.

Marching Squares marching Squares algorithm in python with clean code. Tools Python 3 EasyDraw Creators Mohammad Dori Run the Code Installation Requir

Mohammad Dori 3 Jul 15, 2022
Path finding algorithm visualizer with python

path-finding-algorithm-visualizer ~ click on the grid to place the starting block and then click elsewhere to add the end block ~ click again to place

izumi 1 Oct 31, 2021
This python algorithm creates a simple house floor plan based on a user-provided CSV file.

This python algorithm creates a simple house floor plan based on a user-provided CSV file. The algorithm generates possible router placements and evaluates where a signal will be reached in every room of the floor plan.

Joshua Miller 1 Nov 12, 2021
This is a Python implementation of the HMRF algorithm on networks with categorial variables.

Salad Salad is an Open Source Python library to segment tissues into different biologically relevant regions based on Hidden Markov Random Fields. The

null 1 Nov 16, 2021
🌟 Python algorithm team note for programming competition or coding test

?? Python algorithm team note for programming competition or coding test

Seung Hoon Lee 3 Feb 25, 2022
Exact algorithm for computing two-sided statistical tolerance intervals under a normal distribution assumption using Python.

norm-tol-int Exact algorithm for computing two-sided statistical tolerance intervals under a normal distribution assumption using Python. Methods The

Jed Ludlow 1 Jan 6, 2022
A simple python implementation of A* and bfs algorithm solving Eight-Puzzle

A simple python implementation of A* and bfs algorithm solving Eight-Puzzle

null 2 May 22, 2022
A Python project for optimizing the 8 Queens Puzzle using the Genetic Algorithm implemented in PyGAD.

8QueensGenetic A Python project for optimizing the 8 Queens Puzzle using the Genetic Algorithm implemented in PyGAD. The project uses the Kivy cross-p

Ahmed Gad 16 Nov 13, 2022
A fast, pure python implementation of the MuyGPs Gaussian process realization and training algorithm.

Fast implementation of the MuyGPs Gaussian process hyperparameter estimation algorithm MuyGPs is a GP estimation method that affords fast hyperparamet

Lawrence Livermore National Laboratory 13 Dec 2, 2022
A Python program to easily solve the n-queens problem using min-conflicts algorithm

QueensProblem A program to easily solve the n-queens problem using min-conflicts algorithm Performances estimated with a sample of 1000 different rand

null 0 Oct 21, 2022