Skip to content
This repository has been archived by the owner on May 11, 2023. It is now read-only.

Notebook and sources for calculating the Cloud Carbon Coefficients used in the Cloud Carbon Footprint project.

License

Notifications You must be signed in to change notification settings

cloud-carbon-footprint/cloud-carbon-coefficients

Repository files navigation

Archived - see ccf-coefficients

This repository is archived and the coefficient calculation was replaced with ccf-coefficients. We replicated the calculation in a command-line interface (CLI) with some added features for inspecting the coefficients and their calculation.

We will keep this repository available as a reference for the original work.

Cloud Carbon Coefficients

This notebook calculates the coefficients used in Cloud Carbon Footprint, an application that estimates the energy (kilowatt hours) and carbon emissions (metric tons CO2e) from public cloud provider utilization.

These values are based on the SPECpower_ssj2008 results. New data is released every quarter so the notebook helps calculate updated coefficients.

Outputs

The notebook outputs two sets of values:

  1. Use stage coefficients: Values are calculated within the notebook and output in-line for Azure (min watts, max watts, GB/chip), AWS (min watts, max watts, GB/chip) and GCP (min watts, max watts). The file to drop them into in CCF is indicated in the notebook. A CSV is created in output/ with the values for each CPU architecture, currently for reference only.

  2. Embodied emissions coefficients: Values are calculated within the notebook and output to CSV in output/ for each instance type for each cloud platform in kgCO2e.

Setup - Deepnote

  1. Click the button below to create a a copy of the project in Deepnote.
  2. Press the "Run notebook" button at the top (open coefficients.ipynb from the left menu if it does not open automatically).

Setup - VS Code

A .devcontainer is provided if you want to run this inside a container or using GitHub Codespaces. This will automatically set up the environment with Python 3.9. You can then open the coefficients.ipynb file in VS Code and press the Run all cells button.

Setup - Manual

The notebook requires Python 3.9+ and Jupyter (Lab or Notebook). Install both of these for your platform and then open coefficients.ipynb.

Updating the SPECpower results

  1. Copy the new lines from the full results table into data/SPECpower-full-results.csv
  2. Ensure the "CPU Description" column is clean by following the instructions in the notebook.
  3. Run the notebook to calculate the new values.
  4. See the output notes above for what to do with the values.

Tests

Basic tests exist in-line. They can also be executed from the terminal:

nbdev_test_nbs

Git hooks

Git hooks from nbdev are used to clean notebooks before they're committed. This avoids committing all the metadata that changes on each run. See the nbdev API docs for more details.

Cleaning the notebook before commit can be done with nbdev_clean. Installing the Git hooks using nbdev_install_hooks will do this automatically on commit.

About

Notebook and sources for calculating the Cloud Carbon Coefficients used in the Cloud Carbon Footprint project.

Resources

License

Stars

Watchers

Forks