/gpu-carbon-estimator

An Impact Framework plugin that estimates carbon emissions from GPU power usage.

Primary LanguageTypeScriptMIT LicenseMIT

gpu-carbon-estimator

gpu-carbon-estimator estimates the carbon emissions from the energy usage of a GPU, made as a plugin for IF.

Implementation

The plugin uses the Climatiq API to retrieve carbon emission estimations.

Climatiq API Key

gpu-carbon-estimator requires a Climatiq API key, which you can request here. Once you have a key, you must define an environment variable, $CLIMATIQ_API_KEY=<your-api-key-here> on your machine.

Inputs

  • gpu/power-usage: GPU power usage in watts.
  • region: Geographical region where the measurement was recorded. Should be a two-character string according to the UN/LOCODE code list, i.e., 'US' for the United States, 'GB' for Great Britain.

Returns

  • gpu/carbon: Estimated GPU carbon emissions in kgCO2.

Example manifest

First, ensure IF is installed:

npm i -g @grnsft/if

Then, clone and link this plugin's repository:

git clone git@github.com:dukeofjukes/gpu-carbon-estimator.git && cd gpu-carbon-estimator
npm update && npm install && npm link

The following manifest initializes and runs the locally-linked gpu-carbon-estimator plugin:

name: gpu-carbon-estimator-demo
description: estimates carbon emissions from gpu power usage
tags:
initialize:
  plugins:
    gpu-carbon-estimator:
      method: GpuCarbonEstimator
      path: gpu-carbon-estimator
tree:
  children:
    child:
      pipeline:
        - gpu-carbon-estimator
      defaults:
        region: "GB"
      inputs:
        - timestamp: '2024-01-01T00:00:00Z'
          duration: 60  # seconds
          gpu/power-usage: 50  # watts
        - timestamp: '2024-01-01T00:01:00Z'
          duration: 60  # seconds
          gpu/power-usage: 80  # watts

You can run this by passing it to ie:

ie --manifest ./path/to/input.yml --output ./path/to/output.yml