Skip to content

Sancaryasin/PowerDL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PowerDL – Unified In-Memory GPU Energy Profiling and Visualization Toolkit

PowerDL is a lightweight, framework-agnostic toolkit for GPU energy, power, and utilization profiling of deep learning workloads.
It supports PyTorch and TensorFlow, operates fully in-memory by default, and provides rich, publication-ready visual analytics with optional artifact export.

The toolkit is designed for:

  • Interactive experimentation (no mandatory file I/O)
  • Energy-aware deep learning research
  • Reproducible benchmarking
  • Software-oriented scientific contributions

Key Features

  • Unified high-level API: profile_torch, profile_tf
  • Fully in-memory profiling (no files required by default)
  • Optional export for reproducibility
  • High-resolution time-series sampling (NVML-based)
  • Phase-aware analysis (training / inference / warmup / session)
  • Batch-level and epoch-level energy breakdown
  • Optional visualization layer
  • Clean separation between measurement and plotting
  • Research-ready structured outputs (CSV + JSON)

Installation

Minimal Core Install (No Visualization)

pip install powerdl

With Visualization Support

pip install powerdl[viz]

With PyTorch Examples

pip install powerdl[examples-torch]

With TensorFlow Examples

pip install powerdl[examples-tf]


Installation from Source (for running examples)

git clone https://github.com/your-repo/powerdl.git cd powerdl pip install -e .[viz]


Requirements

The following dependencies are required for full functionality:

  • Python ≥ 3.9
  • NVIDIA GPU
  • NVIDIA driver with NVML support
  • pandas
  • matplotlib
  • SciencePlots
  • nvidia-ml-py

Optional (depending on framework):

  • torch
  • tensorflow

Running Example Scripts (IMPORTANT)

If you are using the repository version, install the package first:

pip install -e .

Then run examples from the project root:

python -m examples.run_torch_example

or

python -m examples.run_tf_example

Do NOT run scripts directly using:

python examples/run_torch_example.py

This may result in import errors because Python cannot locate the powerdl module.

Using the "-m" option ensures correct module resolution and avoids the need for manual sys.path modifications.


Quick Start – PyTorch

from powerdl.highlevel import profile_torch

with profile_torch( out_dir=None, interval_s=0.02, verbose=1 ) as prof:

prof.train(model, trainloader, optimizer, loss_fn, epochs=3)
prof.infer_tensor(model, batch_size=256, n_samples=20000)

rep = prof.report() rep.export("results/torch_run")


Quick Start – TensorFlow

from powerdl.highlevel import profile_tf

with profile_tf( out_dir=None, interval_s=0.02, verbose=1 ) as prof:

prof.fit(model, dataset, epochs=3)
prof.infer_keras(model, x_inf, batch_size=512)

rep = prof.report() rep.export("results/tf_run")


In-Memory First Design

PowerDL collects all measurements in memory first.

Collected signals:

  • GPU power (W)
  • GPU utilization (%)
  • Memory utilization (%)
  • Precise timestamps
  • Phase markers (training, inference, epochs, warmup)

No files are written unless explicitly requested.

Optional export: rep.export("runs/experiment_export")


Report Object

rep = prof.report()

The unified Report object contains:

  • samples_df – full time-series measurements
  • marks_df – event and phase markers
  • summary – structured scalar metrics

Visualization is lazy-loaded and requires matplotlib only when plotting is used.


Visualization System (Optional)

pip install powerdl[viz]

rep.list_figures()


Supported Figures

Time-Series:

  • power_time
  • gpu_util_time
  • mem_util_time
  • util_time_dual
  • energy_rate
  • power_derivative
  • cumulative_energy

Distribution-Based:

  • power_hist
  • util_hist
  • power_ecdf
  • util_ecdf

Phase-Aware Statistics:

  • power_boxplot_phase
  • util_boxplot_phase
  • phase_energy_bar
  • phase_time_bar

Correlation & Density:

  • power_util_scatter
  • power_util_hexbin

Plotting API

Plot all figures:

rep.plot( all=True, out_dir="results/figs", show=False, smooth=5, shade_phases=True )

Plot selected figures:

rep.plot( figs=[ "power_time", "cumulative_energy", "power_util_hexbin", "phase_energy_bar" ], out_dir="results/figs", show=True )

Plot single figure:

rep.plot_one("power_ecdf", show=True)


Exported Artifacts

rep.export("runs/experiment_01")

Produces:

  • summary.json
  • samples.csv
  • marks.csv
  • batches.csv
  • epochs.csv

Design Philosophy

PowerDL separates:

  • Measurement (NVML sampling)
  • Aggregation (energy integration and phase pairing)
  • Visualization (registry-based plotting)

Focus:

  • temporal analysis
  • phase-aware energy behavior
  • reproducible research

Typical Use Cases

  • Green AI benchmarking
  • Training vs inference energy comparison
  • GPU saturation analysis
  • Phase-wise energy profiling
  • Deep learning energy efficiency studies

License

MIT License


Author

Yasin SANCAR
Computer Engineer
Energy-Aware Deep Learning Research

About

In-memory GPU energy profiling and rich visualization toolkit for PyTorch and TensorFlow workloads.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages