Skip to main content

GPU energy metering for AI training workloads

Project description

⚡ matcha

GPU energy metering for AI training workloads. Pure Python. No dashboards.

Polls GPU power at 100ms via NVML and reports energy consumption per training step.

Built by Keeya Labs.

Install

pip install matcha-gpu

Requires an NVIDIA GPU with drivers installed (nvidia-smi must work).

Quick Start

Option A: Wrap any training script (zero code changes)

matcha wrap python train_gpt.py

Matcha parses your script's stdout for step markers (step 10, iter 10, [10/1000], etc.) and reports energy between each step.

# also print the training script's output
matcha wrap -p python train_gpt.py

# custom gpu and sampling interval
matcha wrap --gpu 1 --interval 50 python train_gpt.py

Option B: SDK (3 lines added to your training loop)

import matcha

m = matcha.init()

for step in range(num_steps):
    m.step_start()

    # ... your training code, unchanged ...

    energy = m.step_end(step)
    # energy.energy_j   — joules
    # energy.avg_power_w — average watts during step
    # energy.peak_power_w

summary = m.finish()
# summary.total_energy_j
# summary.energy_kwh
# summary.j_per_step

Monitor GPU power (no training script)

matcha monitor
matcha monitor --gpu 0 --window 2.0

Output

  ⚡ matcha — gpu energy metering
  ────────────────────────────────────────────────────────
  gpu        NVIDIA H100 80GB HBM3
  tdp        700W
  sampling   every 100ms
  ────────────────────────────────────────────────────────

    step      energy      time    avg W   peak W  power
  ────────────────────────────────────────────────────────
       0     12.45 J    0.198s   62.8W    71.2W  ██████░░░░░░
       1     13.01 J    0.201s   64.7W    73.1W  ██████░░░░░░
       2     12.88 J    0.199s   64.7W    72.4W  ██████░░░░░░

  ────────────────────────────────────────────────────────
  ⚡ session summary
  ────────────────────────────────────────────────────────

  gpu            NVIDIA H100 80GB HBM3
  total energy   623.45 J
  total time     10.02s
  steps          50
  energy/step    12.47 J
  avg power      62.2W
  peak power     73.1W

  est. cost      $0.000021 @ $0.12/kWh

License

Apache 2.0 — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

matcha_gpu-0.2.0.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

matcha_gpu-0.2.0-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file matcha_gpu-0.2.0.tar.gz.

File metadata

  • Download URL: matcha_gpu-0.2.0.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for matcha_gpu-0.2.0.tar.gz
Algorithm Hash digest
SHA256 64bffde75b95be6156220261bbd410e91d74b6da8ba130ca917dfe07238b7641
MD5 d2f57a6d836a690277c09b8cafe49307
BLAKE2b-256 ba073c4c3af6d41e31b4956e36d1f7e1fe0301b929bb1da5d6d60e7608a90b00

See more details on using hashes here.

File details

Details for the file matcha_gpu-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: matcha_gpu-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for matcha_gpu-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bb865006586cf993d10da9337a85a82181d40e2d15a7b3ceb258af298a3b5dca
MD5 9e700a35e99fda27d628ee51b78f583a
BLAKE2b-256 a92a9ca564e8ff548c40b25f4501da0e1eec17fcf8e8110b12cd3a3b40637682

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page