mlco2/codecarbon

request for enhancements

mkbane opened this issue · 4 comments

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

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 ).

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.