Skip to main content

CUDA-accelerated AC power flow and ACOPF for large-scale transmission networks (20k+ buses)

Project description

cugrid

CUDA-accelerated AC power flow and ACOPF for large-scale transmission networks: batched Newton-Raphson PF, contingency screening (N-1 / N-1-1), hosting capacity, and curtailment optimization. See plans/cugrid-implementation-plan.md for the full phased plan.

Status: Phase 0 (scaffolding) — no solver logic yet.

Layout

include/cugrid/   public C++ headers (common/: DeviceVector, error checks, timers)
src/                 io, network, pf/{cpu,cuda}, opf/{cpu,cuda}, linalg — filled in from Phase 1 onward
python/cugrid/     pybind11 module + Python package
tests/unit/          GoogleTest (C++), CPU-only, runs in CI on every PR
tests/validation/    accuracy checks vs pandapower / PowerModels (from Phase 2 onward)
tests/cases/         vendored small .m cases + generated reference solutions
scripts/             case download, pandapower/Ipopt reference generation
docs/math/           derivations (Jacobian, KKT, per-asset models)
docs/benchmarks/     performance reports

Build

Requires CMake ≥ 3.24 and a C++20 compiler. CUDA (12.x) is auto-detected; the project builds CPU-only when no nvcc is on PATH (e.g. laptops, cloud CI) and CUDA-enabled targets simply aren't compiled.

Python tooling uses uv; the pinned interpreter version lives in .python-version (3.12).

Python extension

uv sync --extra dev
uv run python -c "import cugrid; print(cugrid.hello()); print(cugrid.cuda_available())"

uv sync creates .venv/, installs the pinned Python if needed, and builds the pybind11 extension in editable mode via scikit-build-core. Re-run uv sync after touching C++ sources under python/cugrid/ or include/; plain uv run does not rebuild automatically.

C++ unit tests (CPU-only, GoogleTest fetched via CMake)

cmake -S . -B build -DCUGRID_BUILD_PYTHON=OFF
cmake --build build
ctest --test-dir build --output-on-failure

Force CUDA on/off

cmake -S . -B build -DCUGRID_ENABLE_CUDA=ON   # requires nvcc + CUDA Toolkit on PATH
cmake -S . -B build -DCUGRID_ENABLE_CUDA=OFF  # CPU-only even if a CUDA compiler is present

Lint / pre-commit

Ruff (Python) and clang-format (C++) run via pre-commit:

uv sync --extra dev
uv run pre-commit install       # runs the hooks on `git commit`
uv run pre-commit run --all-files

Reference solutions

uv sync --extra reference
uv run python scripts/make_reference.py --cases case9 case118 --out tests/cases

Generates pandapower PF results (V, θ per bus; branch flows) that the CPU/GPU solvers are validated against (Phase 2+).

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

cugrid-0.0.1.dev1.tar.gz (57.5 kB view details)

Uploaded Source

Built Distribution

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

cugrid-0.0.1.dev1-cp312-cp312-macosx_26_0_arm64.whl (69.2 kB view details)

Uploaded CPython 3.12macOS 26.0+ ARM64

File details

Details for the file cugrid-0.0.1.dev1.tar.gz.

File metadata

  • Download URL: cugrid-0.0.1.dev1.tar.gz
  • Upload date:
  • Size: 57.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.8

File hashes

Hashes for cugrid-0.0.1.dev1.tar.gz
Algorithm Hash digest
SHA256 60c79ad5dee724052e80d3bfafe6e0b3e8fbae10fb6f9490f41744130d6fb744
MD5 6c0575800f5d9a37271446cd09caaa1a
BLAKE2b-256 fe91eb031d9519b91745099cde8344d528f97fa426b935de2cdbaf3bd8b014ce

See more details on using hashes here.

File details

Details for the file cugrid-0.0.1.dev1-cp312-cp312-macosx_26_0_arm64.whl.

File metadata

File hashes

Hashes for cugrid-0.0.1.dev1-cp312-cp312-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 2b7210da19247311ee130c9adc2e701b72a31f6d0f9537341be24551b5d0b6ec
MD5 8184aa47006a1a725691d0f2949b2dd4
BLAKE2b-256 3c14a4fce7823d3ad8d7b06a84edc3ccd83966794cbd1a1a3b10b5fc2e809274

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