Skip to content

Commit

Permalink
Merge branch 'mlco2:master' into feature/custom-handler
Browse files Browse the repository at this point in the history
  • Loading branch information
eledhwen authored Oct 7, 2023
2 parents 56f569b + c210932 commit 601a95a
Show file tree
Hide file tree
Showing 30 changed files with 347 additions and 355 deletions.
2 changes: 1 addition & 1 deletion codecarbon/external/hardware.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def _get_power_from_cpus(self) -> Power:

power = 0
for metric, value in all_cpu_details.items():
# "^Processor Power_\d+\(Watt\)$" for Inter Power Gadget
# "^Processor Power_\d+\(Watt\)$" for Intel Power Gadget
if re.match(r"^Processor Power", metric):
power += value
logger.debug(f"_get_power_from_cpus - MATCH {metric} : {value}")
Expand Down
2 changes: 1 addition & 1 deletion docs/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: c3b8b30a290e8beba1f269fcdc97e097
config: bd7c175b3ee5838f9a80151ba7088fea
tags: 645f666f9bcd5a90fca523b33c5a78b7
4 changes: 2 additions & 2 deletions docs/_sources/faq.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Frequently Asked Questions
* **What are the sources of your energy carbon intensity data?**
We use the following sources:

For cloud computing :
For cloud computing:

- Google publish carbon intensity of electricity for `Google Cloud Plateform <https://cloud.google.com/sustainability/region-carbon?hl=fr>`_.

Expand All @@ -18,7 +18,7 @@ Frequently Asked Questions
- Microsoft has a Sustainability Calculator that helps enterprises analyze the carbon emissions of their IT infrastructure. But does not publish datacenter carbon intensity.


For private infra :
For private infra:

- When available we use data from `ourworld in data <https://ourworldindata.org/grapher/carbon-intensity-electricity?tab=table>`_

Expand Down
23 changes: 12 additions & 11 deletions docs/_sources/methodology.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ Carbon dioxide (CO₂) emissions, expressed as kilograms of CO₂-equivalents [C
C = Carbon Intensity of the electricity consumed for computation: quantified as g of CO₂ emitted per kilowatt-hour of electricity.
P = Power Consumed by the computational infrastructure: quantified as kilowatt-hours.
E = Energy Consumed by the computational infrastructure: quantified as kilowatt-hours.
Carbon dioxide emissions (CO₂eq) can then be calculated as ``C * P``
Carbon dioxide emissions (CO₂eq) can then be calculated as ``C * E``


Carbon Intensity
Expand All @@ -26,7 +26,7 @@ energy sources that are used to generate electricity, including fossil fuels and

When available, CodeCarbon uses global carbon intensity of electricity per cloud provider ( `here <https://github.com/mlco2/codecarbon/blob/master/codecarbon/data/cloud/impact.csv>`_ ) or per country ( `here <https://github.com/mlco2/codecarbon/blob/master/codecarbon/data/private_infra/eu-carbon-intensity-electricity.csv>`_ ).

If we don't have the global carbon intensity or electricity of a country, but we have its electricity mix, we compute the carbon intensity of electricity using this table :
If we don't have the global carbon intensity or electricity of a country, but we have its electricity mix, we compute the carbon intensity of electricity using this table:

.. list-table:: Carbon Intensity Across Energy Sources
:widths: 50 50
Expand All @@ -53,7 +53,7 @@ If we don't have the global carbon intensity or electricity of a country, but we
- 26

Sources:
- `for fossil energies <https://github.com/responsibleproblemsolving/energy-usage#conversion-to-co2>`_
- `for fossil energies <https://github.com/responsibleproblemsolving/energy-usage#conversion-to-co2>`_
- `for renewables energies <http://www.world-nuclear.org/uploadedFiles/org/WNA/Publications/Working_Group_Reports/comparison_of_lifecycle.pdf>`_


Expand All @@ -78,7 +78,7 @@ Currently, the package supports the following hardware infrastructure.
GPU
~~~~

Tracks Nvidia GPUs power consumption using ``pynvml`` library (installed with the package).
Tracks Nvidia GPUs energy consumption using ``pynvml`` library (installed with the package).

RAM
~~~~
Expand All @@ -91,23 +91,24 @@ CPU

- **On Windows or Mac**

Tracks Intel processors power consumption using the ``Inter Power Gadget``. You need to install it yourself from this `source <https://www.intel.com/content/www/us/en/developer/articles/tool/power-gadget.html>`_ .
Tracks Intel processors energy consumption using the ``Intel Power Gadget``. You need to install it yourself from this `source <https://www.intel.com/content/www/us/en/developer/articles/tool/power-gadget.html>`_ .

- **On Linux**

Tracks Intel Processor power consumption from Inter RAPL files at ``\sys\class\powercap\intel-rapl`` ( `reference <https://web.eece.maine.edu/~vweaver/projects/rapl/>`_ ).
Tracks Intel and AMD processor energy consumption from Intel RAPL files at ``\sys\class\powercap\intel-rapl`` ( `reference <https://web.eece.maine.edu/~vweaver/projects/rapl/>`_ ).
All CPUs listed in this directory will be tracked. `Help us improve this and make it configurable <https://github.com/mlco2/codecarbon/issues/156>`_.

*Note*: The Power Consumption will be tracked only if the RAPL files exist at the above mentioned path


If none of the tracking tools are available on a computing resource, CodeCarbon will be switched to a fall back mode:
It will first detect which CPU hardware is currently in use, and then map it to a data source listing 2000+ Intel and AMD CPUs and their corresponding thermal design powers (TDPs).
If the CPU is not found in the data source, a global constant will be applied. CodeCarbon assumes that 50% of the TDP will be the average power consumption to make this approximation.
We could not find any good resource showing statistical relationships between TDP and average power so we empirically tested that 50% is a decent approximation.
- It will first detect which CPU hardware is currently in use, and then map it to a data source listing 2000+ Intel and AMD CPUs and their corresponding thermal design powers (TDPs).
- If the CPU is not found in the data source, a global constant will be applied. CodeCarbon assumes that 50% of the TDP will be the average power consumption to make this approximation.
- We could not find any good resource showing statistical relationships between TDP and average power so we empirically tested that 50% is a decent approximation.

The net Power Used is the net power supply consumed during the compute time, measured as ``kWh``.
The net Energy Used is the net power supply consumed during the compute time, measured as ``kWh``.

``Energy = Power * Time``

References
----------
Expand Down
17 changes: 3 additions & 14 deletions docs/_static/_sphinx_javascript_frameworks_compat.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,9 @@
/*
* _sphinx_javascript_frameworks_compat.js
* ~~~~~~~~~~
*
* Compatability shim for jQuery and underscores.js.
*
* WILL BE REMOVED IN Sphinx 6.0
* xref RemovedInSphinx60Warning
/* Compatability shim for jQuery and underscores.js.
*
* Copyright Sphinx contributors
* Released under the two clause BSD licence
*/

/**
* select a different prefix for underscore
*/
$u = _.noConflict();


/**
* small helper function to urldecode strings
*
Expand Down
52 changes: 28 additions & 24 deletions docs/_static/basic.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* Sphinx stylesheet -- basic theme.
*
* :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS.
* :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
Expand Down Expand Up @@ -236,16 +236,6 @@ div.body p, div.body dd, div.body li, div.body blockquote {
a.headerlink {
visibility: hidden;
}
a.brackets:before,
span.brackets > a:before{
content: "[";
}

a.brackets:after,
span.brackets > a:after {
content: "]";
}


h1:hover > a.headerlink,
h2:hover > a.headerlink,
Expand Down Expand Up @@ -334,11 +324,17 @@ aside.sidebar {
p.sidebar-title {
font-weight: bold;
}

nav.contents,
aside.topic,
div.admonition, div.topic, blockquote {
clear: left;
}

/* -- topics ---------------------------------------------------------------- */

nav.contents,
aside.topic,
div.topic {
border: 1px solid #ccc;
padding: 7px;
Expand Down Expand Up @@ -377,13 +373,17 @@ div.body p.centered {

div.sidebar > :last-child,
aside.sidebar > :last-child,
nav.contents > :last-child,
aside.topic > :last-child,
div.topic > :last-child,
div.admonition > :last-child {
margin-bottom: 0;
}

div.sidebar::after,
aside.sidebar::after,
nav.contents::after,
aside.topic::after,
div.topic::after,
div.admonition::after,
blockquote::after {
Expand Down Expand Up @@ -608,19 +608,27 @@ ol.simple p,
ul.simple p {
margin-bottom: 0;
}
dl.footnote > dt,
dl.citation > dt {

aside.footnote > span,
div.citation > span {
float: left;
margin-right: 0.5em;
}

dl.footnote > dd,
dl.citation > dd {
aside.footnote > span:last-of-type,
div.citation > span:last-of-type {
padding-right: 0.5em;
}
aside.footnote > p {
margin-left: 2em;
}
div.citation > p {
margin-left: 4em;
}
aside.footnote > p:last-of-type,
div.citation > p:last-of-type {
margin-bottom: 0em;
}

dl.footnote > dd:after,
dl.citation > dd:after {
aside.footnote > p:last-of-type:after,
div.citation > p:last-of-type:after {
content: "";
clear: both;
}
Expand All @@ -636,10 +644,6 @@ dl.field-list > dt {
padding-left: 0.5em;
padding-right: 5px;
}
dl.field-list > dt:after {
content: ":";
}


dl.field-list > dd {
padding-left: 0.5em;
Expand Down
2 changes: 1 addition & 1 deletion docs/_static/css/badge_only.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 601a95a

Please sign in to comment.