Nanoseb / gqueue

CLI tool to compute CO2 emissions of HPC computations following green-algorithms.org methodology
https://www.green-algorithms.org
MIT License
5 stars 1 forks source link
carbon-emissions cluster hpc slurm

gqueue

gqueue is a CLI (command line interface) tool that computes carbon footprint of HPC computations on clusters running slurm. It follows the methodology used by http://green-algorithms.org and laid out in:

Here is an example output:

$ gqueue -a
Config filename: iridis5.json
Carbon intensity: 253.19 gCO2e/kWh (GB)

Partition  TDP per core  RAM per core  Footprint per CPU.h
──────────────────────────────────────────────────────────
batch*     6.25 W        4.8 GB        3.40 gCO2e/(CPU.h) 
largejobs  6.25 W        4.8 GB        3.40 gCO2e/(CPU.h) 
amd        4.84375 W     4.8 GB        2.80 gCO2e/(CPU.h) 

Directory  Job name  Job-ID  Partition  Cores  Status      CO2          Total CO2  
───────────────────────────────────────────────────────────────────────────────────
G3         TEST_400  761980  batch      400    ███████───  59.4 kgCO2e  81.6 kgCO2e
G1         TEST_400  725609  batch      400    PENDING     -            81.6 kgCO2e
G2         TEST_400  725610  batch      400    PENDING     -            81.6 kgCO2e

Carbon footprint over the last:
1 day: 1.4 kgCO2e
7 days: 108.3 kgCO2e
30 days: 641.2 kgCO2e
90 days: 2.7 TCO2e

Usage

usage: gqueue [-h] [-p] [-j] [-r] [-c CLUSTER] [-u USER]
              [--carbon-intensity CARBON_INTENSITY] [-a]

CLI tool to compute CO2 emissions of HPC computations following green-algorithms.org 
methodology on slurm systems.

optional arguments:
  -h, --help            show this help message and exit
  -p, --partition       Displays partitions information
  -j, --job             Displays footprint of jobs in queue
  -r, --history         Displays footprint of past jobs over the last 1, 7, 30 and 90 days
  -c CLUSTER, --cluster CLUSTER
                        Cluster .json file to use, if omited autodetection is used
  -u USER, --user USER  User to show analysis about, if omited the current user is used
  --carbon-intensity CARBON_INTENSITY
                        Overwrites carbon internsity information from cluster data, specify 
                        value in gCO2/kWh
  -a, --all             Displays everything, equivalent to -p -j -r

Add new cluster information

Each cluster information is stored in a .json file in the cluster_data folder. One file correspond to a single cluster and is defined as follow:

{
  "hostnames": [ "cyan51.cluster.local", "cyan52.cluster.local" ],
  "country": "GB",
  "carbon_intensity": 253.19,
  "default_partition": "batch",
  "partitions": [
    {
      "partition_names": ["batch", "largejobs"],
      "TDP_per_core": 6.25,
      "RAM_per_core": 4.8
    },
 {
      "partition_names": ["amd"],
      "TDP_per_core": 4.84375,
      "RAM_per_core": 4.8
    }
  ]
}