Code Monkey home page Code Monkey logo

energytracker's Introduction

Energy Tracking : Integrate an energy tracker :

Understand what needs to be tracked

For more information on Energy and carbon emissions / Where the energy comes from in ITU ?

I invite you to take a look at Energy Tracker Presentation

Installations setup

pip install codecarbon

pip install -r requirements.txt

The requirements.txt file contain : -arrow -pandas -pynvml -requests -psutil -py-cpuinfo -click -rapidfuzz -prometheus_client

Add to your code :

from codecarbon import EmissionsTracker
tracker = EmissionsTracker() # or EmissionsTracker(project_name="...")
tracker.start()
#
# Compute intensive code goes here
#
tracker.stop()

This will create a csv file (emissions.csv) with the following data :

Field Description
timestamp Time of the experiment in %Y-%m-%dT%H:%M:%S format
project_name Name of the project, defaults to codecarbon
run-id id of the run
duration Duration of the compute, in seconds
emissions Emissions as CO₂-equivalents [CO₂eq], in kg
emissions_rate Emissions divided per duration, in Kg/s
cpu_power CPU power (W)
gpu_power GPU power (W)
ram_power RAM power (W)
cpu_energy Energy used per CPU (kWh)
gpu_energy Energy used per GPU (kWh)
ram_energy Energy used per RAM (kWh)
energy_consumed Sum of cpu_energy, gpu_energy and ram_energy (kWh)
country_name Name of the country where the infrastructure is hosted
country_iso_code 3-letter alphabet ISO Code of the respective country
region Province/State/City where the compute infrastructure is hosted
on_cloud Y if the infrastructure is on cloud, N in case of private infrastructure
cloud_provider One of the 3 major cloud providers, aws/azure/gcp
cloud_region Geographical Region for respective cloud provider, examples us-east-2 for aws, brazilsouth for azure, asia-east1 for gcp
os OS on the device, example Windows-10-10.0.19044-SP0
python_version Example 3.8.10
cpu_count Number of CPU
cpu_model Example Intel(R) Core(TM) i7-1065G7 CPU @ 1.30GHz
gpu_count Number of GPU
gpu_model Example 1 x NVIDIA GeForce GTX 1080 Ti
longitude Longitude, with reduced precision to a range of 11.1 km / 123 km². This is done for privacy protection.
latitude Latitude, with reduced precision to a range of 11.1 km / 123 km². This is done for privacy protection.
ram_total_size Total RAM available (Go)
Tracking_mode machine or process (default to machine)

Obtain the total energy consumption of your project :

Run this line :

carbonboard --filepath="emissions.csv" --port=3333

You will then obtain :

Some solutions to optimize : Reduce emissions

Find the [codecarbon repository]'https://github.com/mlco2/codecarbon.git)

energytracker's People

Contributors

ambroise012 avatar

Watchers

 avatar

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.