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

request for enhancements #503

Open mkbane opened 4 months ago

mkbane commented 4 months ago

My understanding is that CodeCarbon can (with some limitations) read real-time power consumption by CPUs and GPUs. From this, and integrating over time, the energy consumed is calculated (e.g. kWh). My understanding is that CC then uses a basic lookup to convert kWh to CO2_eq. It appears this is by using static data (https://github.com/mlco2/codecarbon/blob/master/codecarbon/data/private_infra/global_energy_mix.json).

It would be much better to use dynamic data e.g. from electricitymaps, WattTime etc. How would I go about doing this?

Secondly the data for UK in the above json file states a CI of "268.329" (is this g CO2_eq per kWh?) with a date of "2021". Where, UK Gov website (https://view.officeapps.live.com/op/view.aspx?src=https%3A%2F%2Fassets.publishing.service.gov.uk%2Fmedia%2F61ee7495e90e07037c8d6176%2Fconversion-factors-2021-condensed-set-most-users.xls&wdOrigin=BROWSELINK avail from https://www.gov.uk/government/publications/greenhouse-gas-reporting-conversion-factors-2021) for 2021 data has a figure of 212.33 gCO2_eq per kWh for UK electricity on average for 2021

More importantly there is now updated annual average for UK, see https://www.gov.uk/government/publications/greenhouse-gas-reporting-conversion-factors-2023

LuisBlanche commented 4 months ago

Hi thank you for your comments. There is actually a way to use dynamic data in CodeCarbon ! It is using the CO2Signal API (eletricitymaps), you can do so by setting an API key using parameter co2_signal_api_token as explained in this section of the documentation. I think we will improve the docs a little bit on this topic.

Regarding the source of the data used in the constant mode there is a section in the FAQ about it . We do need to update the file with the latest number, as I see we got numbers for year 2022 on this website. You are more than welcome to propose new sources of data ! It is part of our roadmap to automate most of the data refreshing as time goes by (we also have the CPU list that needs updating ).

benoit-cty commented 3 months ago

Updating the data used by CodeCarbon is made by running the notebook https://github.com/mlco2/codecarbon/blob/master/codecarbon/data/private_infra/our_world_in_data-2021_data.ipynb

mkbane commented 2 months ago

Thanks for the reply. I do not have a subscription to electricitymaps (previously know as co2signal.com I see). I do have a subscription with watttime – can I use that instead?

And do you know of any related work on scheduling (e.g. where & when to run based on CI, rather than on recording CO2 footprint of a running machine/process)? Happy to advance this.

Yours, Micahel

From: Luis Blanche @.> Sent: Wednesday, February 21, 2024 8:27 PM To: mlco2/codecarbon @.> Cc: Michael Bane @.>; Author @.> Subject: Re: [mlco2/codecarbon] request for enhancments (Issue #503)

This email originated from outside of Manchester Met. Do not click links or open attachments unless you recognise the sender and believe the content to be safe. Please contact the IT ServiceDesk if you have any concerns, https://www.mmu.ac.uk/about-us/professional-services/itd/about/contact


Hi thank you for your comments. There is actually a way to use dynamic data in CodeCarbon ! It is using the CO2Signal API (eletricitymaps), you can do so by setting an API key using parameter co2_signal_api_token as explained in this section of the documentationhttps://mlco2.github.io/codecarbon/parameters.html#id4. I think we will improve the docs a little bit on this topic.

Regarding the source of the data used in the constant mode there is a section in the FAQhttps://mlco2.github.io/codecarbon/faq.html about it . We do need to update the file with the latest number, as I see we got numbers for year 2022 on this website. It is part of our roadmap to automate most of the data refreshing as time goes by (we also have the CPU list that needs updating ).

— Reply to this email directly, view it on GitHubhttps://github.com/mlco2/codecarbon/issues/503#issuecomment-1957849500, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVRWBWKME67A3F6GL62CPOLYUZKB5AVCNFSM6AAAAABDTQNYUWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNJXHA2DSNJQGA. You are receiving this because you authored the thread.Message ID: @.**@.>>

"Before acting on this email or opening any attachments you should read the Manchester Metropolitan University email disclaimer available on its website http://www.mmu.ac.uk/emaildisclaimer "

benoit-cty commented 2 months ago

Hello, We do not support WattTime.

We do not do scheduling of process, I do meet some time ago a project that aim to do that but I can't find it... sorry.