github-actions[bot] commited on
Commit ·
1ad4d7e
1
Parent(s): 96bb363
deploy: sync from GitHub 2026-04-18T00:53:24Z
Browse files
README.md
CHANGED
|
@@ -1,153 +1,10 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
<br>
|
| 13 |
-
|
| 14 |
-
A modular Python library for simulating datacenter-grid interaction, with a focus on LLM workloads.
|
| 15 |
-
|
| 16 |
-
OpenG2G provides the building blocks for studying how datacenter-level controls (e.g., LLM workload batch size) affect distribution-level voltages. It ships with an implementation of Online Feedback Optimization (OFO) for joint voltage regulation and latency management, alongside a trace-replay datacenter backend and an OpenDSS-based grid simulator.
|
| 17 |
-
|
| 18 |
-
## Key Features
|
| 19 |
-
|
| 20 |
-
- **Multi-rate simulation**: datacenter, grid, and controller components run at independent rates, coordinated by a shared clock.
|
| 21 |
-
- **Pluggable architecture**: swap datacenter backends (trace-based or live GPU) and controllers (OFO, tap scheduling, or your own) via simple abstract interfaces.
|
| 22 |
-
- **OpenDSS integration**: power flow analysis on standard IEEE test feeders with tap scheduling (`TapPosition`/`TapSchedule` API) and voltage monitoring.
|
| 23 |
-
- **Online Feedback Optimization**: primal-dual batch size control balancing voltage regulation, inference latency, and throughput.
|
| 24 |
-
- **Live GPU support**: `OnlineDatacenter` backend reads real-time GPU power via [Zeus](https://github.com/ml-energy/zeus) for hardware-in-the-loop experiments.
|
| 25 |
-
|
| 26 |
-
## Installation
|
| 27 |
-
|
| 28 |
-
Requires Python 3.10+.
|
| 29 |
-
|
| 30 |
-
```bash
|
| 31 |
-
pip install openg2g
|
| 32 |
-
```
|
| 33 |
-
|
| 34 |
-
For grid simulation with OpenDSS:
|
| 35 |
-
|
| 36 |
-
```bash
|
| 37 |
-
pip install "openg2g[opendss]"
|
| 38 |
-
```
|
| 39 |
-
|
| 40 |
-
### Development
|
| 41 |
-
|
| 42 |
-
```bash
|
| 43 |
-
git clone https://github.com/gpu2grid/openg2g.git
|
| 44 |
-
cd openg2g
|
| 45 |
-
uv sync # or: pip install -e . --group dev
|
| 46 |
-
```
|
| 47 |
-
|
| 48 |
-
## Quick Start
|
| 49 |
-
|
| 50 |
-
For a full walkthrough including data setup, see the [Getting Started guide](https://gpu2grid.io/openg2g/getting-started/quickstart/). The snippet below illustrates the core API:
|
| 51 |
-
|
| 52 |
-
```python
|
| 53 |
-
from fractions import Fraction
|
| 54 |
-
from pathlib import Path
|
| 55 |
-
|
| 56 |
-
from openg2g.coordinator import Coordinator
|
| 57 |
-
from openg2g.datacenter.config import DatacenterConfig, InferenceModelSpec
|
| 58 |
-
from openg2g.datacenter.offline import OfflineDatacenter, OfflineWorkload
|
| 59 |
-
from openg2g.datacenter.workloads.inference import InferenceData
|
| 60 |
-
from openg2g.grid.opendss import OpenDSSGrid
|
| 61 |
-
from openg2g.controller.noop import NoopController
|
| 62 |
-
from openg2g.grid.config import TapPosition
|
| 63 |
-
|
| 64 |
-
# 1. Set up a trace-based datacenter
|
| 65 |
-
models = (
|
| 66 |
-
InferenceModelSpec(
|
| 67 |
-
model_label="Llama-3.1-8B", num_replicas=720, gpus_per_replica=1,
|
| 68 |
-
initial_batch_size=128, itl_deadline_s=0.08,
|
| 69 |
-
),
|
| 70 |
-
InferenceModelSpec(
|
| 71 |
-
model_label="Llama-3.1-70B", num_replicas=180, gpus_per_replica=4,
|
| 72 |
-
initial_batch_size=128, itl_deadline_s=0.10,
|
| 73 |
-
),
|
| 74 |
-
)
|
| 75 |
-
data_dir = Path("data/offline")
|
| 76 |
-
inference_data = InferenceData.load(data_dir, models, duration_s=3600, dt_s=0.1)
|
| 77 |
-
dc_config = DatacenterConfig()
|
| 78 |
-
dc = OfflineDatacenter(
|
| 79 |
-
dc_config,
|
| 80 |
-
OfflineWorkload(inference_data=inference_data),
|
| 81 |
-
dt_s=Fraction(1, 10),
|
| 82 |
-
)
|
| 83 |
-
|
| 84 |
-
# 2. Set up the grid
|
| 85 |
-
TAP_STEP = 0.00625
|
| 86 |
-
grid = OpenDSSGrid(
|
| 87 |
-
dss_case_dir="examples/ieee13",
|
| 88 |
-
dss_master_file="IEEE13Nodeckt.dss",
|
| 89 |
-
dc_bus="671",
|
| 90 |
-
dc_bus_kv=4.16,
|
| 91 |
-
power_factor=dc_config.power_factor,
|
| 92 |
-
dt_s=Fraction(1, 10),
|
| 93 |
-
initial_tap_position=TapPosition(a=1.0 + 14 * TAP_STEP, b=1.0 + 6 * TAP_STEP, c=1.0 + 15 * TAP_STEP),
|
| 94 |
-
connection_type="wye",
|
| 95 |
-
)
|
| 96 |
-
|
| 97 |
-
# 3. Run the simulation
|
| 98 |
-
coord = Coordinator(
|
| 99 |
-
datacenter=dc,
|
| 100 |
-
grid=grid,
|
| 101 |
-
controllers=[NoopController()],
|
| 102 |
-
total_duration_s=3600,
|
| 103 |
-
dc_bus="671",
|
| 104 |
-
)
|
| 105 |
-
log = coord.run()
|
| 106 |
-
```
|
| 107 |
-
|
| 108 |
-
See [`examples/`](examples/) for complete simulation scripts (offline trace-replay and online hardware-in-the-loop variants).
|
| 109 |
-
|
| 110 |
-
## Running Example Simulations
|
| 111 |
-
|
| 112 |
-
A single `--config` flag drives both data generation and simulation. The first run downloads benchmark data from the [ML.ENERGY Benchmark v3 dataset](https://huggingface.co/datasets/ml-energy/benchmark-v3) (gated -- [request access](https://huggingface.co/datasets/ml-energy/benchmark-v3) first) and generates simulation artifacts. Subsequent runs load from cache.
|
| 113 |
-
|
| 114 |
-
```bash
|
| 115 |
-
export HF_TOKEN=hf_xxxxxxxxxxx # needed for first run only
|
| 116 |
-
|
| 117 |
-
# Baseline: fixed taps
|
| 118 |
-
python examples/offline/run_baseline.py --config examples/offline/config.json --mode no-tap
|
| 119 |
-
|
| 120 |
-
# Baseline: scheduled tap changes
|
| 121 |
-
python examples/offline/run_baseline.py --config examples/offline/config.json --mode tap-change
|
| 122 |
-
|
| 123 |
-
# OFO closed-loop control
|
| 124 |
-
python examples/offline/run_ofo.py --config examples/offline/config.json
|
| 125 |
-
```
|
| 126 |
-
|
| 127 |
-
`--config` is the only required argument. Model specs, data sources, and paths are all in the config file. Generated data is cached in `data/offline/{hash}/`.
|
| 128 |
-
|
| 129 |
-
## Documentation
|
| 130 |
-
|
| 131 |
-
Full documentation is available at [https://gpu2grid.io/openg2g](https://gpu2grid.io/openg2g), including:
|
| 132 |
-
|
| 133 |
-
- Installation and setup guide
|
| 134 |
-
- Running simulations
|
| 135 |
-
- Implementing custom components
|
| 136 |
-
- Architecture reference
|
| 137 |
-
|
| 138 |
-
## Contact
|
| 139 |
-
|
| 140 |
-
Jae-Won Chung <jwnchung@umich.edu>
|
| 141 |
-
|
| 142 |
-
## Citation
|
| 143 |
-
|
| 144 |
-
If you use OpenG2G in your research, please cite:
|
| 145 |
-
|
| 146 |
-
```bibtex
|
| 147 |
-
@article{gpu2grid-arxiv26,
|
| 148 |
-
title = {{GPU-to-Grid}: Voltage Regulation via {GPU} Utilization Control},
|
| 149 |
-
author = {Zhirui Liang and Jae-Won Chung and Mosharaf Chowdhury and Jiasi Chen and Vladimir Dvorkin},
|
| 150 |
-
year = {2026},
|
| 151 |
-
journal = {arXiv preprint arXiv:2602.05116},
|
| 152 |
-
}
|
| 153 |
-
```
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: gpu2grid-live
|
| 3 |
+
emoji: ⚡
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: green
|
| 6 |
+
sdk: docker
|
| 7 |
+
pinned: false
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
# gpu2grid live backend
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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