mlco2 / codecarbon

Track emissions from Compute and recommend ways to reduce their impact on the environment.
https://mlco2.github.io/codecarbon
MIT License
1k stars 157 forks source link

Log steps to install needed codecarbon dependencies #585

Open inimaz opened 1 week ago

inimaz commented 1 week ago

Description

A new user comes and starts using codecarbon. It would be nice if we had a function that:

  1. returns/logs the CPU/GPU/RAM of the user
  2. if needed gives back the specific dependencies to be installed + the codecarbon limitations on the user's hardware.

Currently we log many things

2024-06-19 11:23:24.690 [info] [codecarbon INFO @ 11:23:24] Tracking Nvidia GPU via pynvml

2024-06-19 11:23:24.691 [info] [codecarbon DEBUG @ 11:23:24] GPU available. Starting setup

2024-06-19 11:23:24.728 [info] [codecarbon INFO @ 11:23:24] [setup] CPU Tracking...

2024-06-19 11:23:24.728 [info] [codecarbon DEBUG @ 11:23:24] Not using PowerGadget, an exception occurred while instantiating IntelPowerGadget : Platform not supported by Intel Power Gadget

2024-06-19 11:23:24.728 [info] [codecarbon DEBUG @ 11:23:24] Not using the RAPL interface, an exception occurred while instantiating IntelRAPL : Intel RAPL files not found at /sys/class/powercap/intel-rapl on linux

2024-06-19 11:23:24.728 [info] [codecarbon DEBUG @ 11:23:24] Not using PowerMetrics, an exception occurred while instantiating Powermetrics : Platform not supported by Powermetrics

2024-06-19 11:23:24.728 [info] [codecarbon WARNING @ 11:23:24] No CPU tracking mode found. Falling back on CPU constant mode.

2024-06-19 11:23:26.197 [info] [codecarbon DEBUG @ 11:23:26] CPU : We detect a 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz with a TDP of 45.0 W

2024-06-19 11:23:26.197 [info] [codecarbon INFO @ 11:23:26] CPU Model on constant consumption mode: 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz

2024-06-19 11:23:26.214 [info] [codecarbon INFO @ 11:23:26] >>> Tracker's metadata:

2024-06-19 11:23:26.214 [info] [codecarbon INFO @ 11:23:26]   Platform system: Linux-5.15.153.1-microsoft-standard-WSL2-x86_64-with-glibc2.31

2024-06-19 11:23:26.214 [info] [codecarbon INFO @ 11:23:26]   Python version: 3.12.0

2024-06-19 11:23:26.214 [info] [codecarbon INFO @ 11:23:26]   CodeCarbon version: 2.4.2

2024-06-19 11:23:26.214 [info] [codecarbon INFO @ 11:23:26]   Available RAM : 7.621 GB

2024-06-19 11:23:26.214 [info] [codecarbon INFO @ 11:23:26]   CPU count: 16

2024-06-19 11:23:26.214 [info] [codecarbon INFO @ 11:23:26]   CPU model: 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz

2024-06-19 11:23:26.214 [info] [codecarbon INFO @ 11:23:26]   GPU count: 1

2024-06-19 11:23:26.214 [info] [codecarbon INFO @ 11:23:26]   GPU model: 1 x NVIDIA GeForce RTX 3050 Ti Laptop GPU

2024-06-19 11:23:27.218 [info] [codecarbon DEBUG @ 11:23:27] Not running on AWS

2024-06-19 11:23:28.220 [info] [codecarbon DEBUG @ 11:23:28] Not running on Azure

2024-06-19 11:23:29.222 [info] [codecarbon DEBUG @ 11:23:29] Not running on GCP

But maybe it could be more explicit. Like please install X to measure your CPU.

inimaz commented 1 week ago

An example where this would have been helpful ==> #583