Skip to main content

Extension for pytket providing access to cuStateVec functionality.

Project description

pytket-custatevec logo

pytket-custatevec

GPU-accelerated statevector and shot-based simulation for pytket.

Build PyPI License Slack Stack Exchange

📚 Read the Full Documentation


🚀 Features   •   📊 Benchmarks   •   📦 Installation   •   ⚡ Quick Start   •   💻 Development   •   📄 Citing


pytket-custatevec is a high-performance extension for pytket that allows quantum circuits to be simulated on NVIDIA GPUs.

It acts as an open-source bridge to the NVIDIA cuQuantum SDK, utilizing cuStateVec to optimize memory usage and gate execution speed for large statevector simulations.

🚀 Features

  • High Performance: Designed for rapid simulation of quantum circuits using parallel GPU architecture.
  • Seamless Integration: Works as a standard pytket Backend.
  • Optimized Memory: Manages GPU VRAM efficiently for complex simulations.

📊 Benchmarks

These results are auto-generated by our CI pipeline. They compare pytket-custatevec (GPU) against standard CPU simulators (Aer, Qulacs) for a dense random circuit.

Statevector Simulation Performance Shot-based Simulation Performance

[!NOTE] The charts above are static snapshots. View the Interactive Benchmarks in our documentation to see hardware details and zoom into specific data points.

📦 Installation

Prerequisites

  • Python 3.10+
  • Linux machine with NVIDIA GPU (Compute Capability 7.0+)
  • NVIDIA Drivers installed

Option A: Conda (Recommended) We recommend Conda to reliably handle system-level CUDA libraries.

conda install -c conda-forge cuquantum-python
pip install pytket-custatevec

Option B: Pip You can install everything via pip, which pulls the necessary binary wheels automatically.

pip install pytket-custatevec

⚡ Quick Start

from pytket import Circuit
from pytket.extensions.custatevec import CuStateVecStateBackend

# 1. Define a circuit
circ = Circuit(2).H(0).CX(0, 1)

# 2. Initialize the GPU backend
backend = CuStateVecStateBackend()
compiled_circ = backend.get_compiled_circuit(circ)

# 3. Run on GPU
statevector = backend.run_circuit(compiled_circ).get_state()
print(statevector)

💻 Development

Setup

To install the extension in editable mode for development:

pip install -e ".[dev,docs,test]"

Code Style

We use pre-commit to maintain code quality. Before committing, run:

pre-commit run

This handles formatting (ruff), type checking (mypy), and linting.

Testing

To run the test suite (requires a GPU environment):

pytest tests/

📄 Citing

If you use pytket-custatevec in your research, please cite it as follows:

@software{pytket_custatevec,
  author = {{The pytket-custatevec Developers}},
  title = {pytket-custatevec: GPU-accelerated pytket simulation},
  url = {https://github.com/CQCL/pytket-custatevec},
  year = {2025}
}

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

pytket_custatevec-0.1.0.tar.gz (34.4 kB view details)

Uploaded Source

Built Distribution

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

pytket_custatevec-0.1.0-py3-none-any.whl (40.6 kB view details)

Uploaded Python 3

File details

Details for the file pytket_custatevec-0.1.0.tar.gz.

File metadata

  • Download URL: pytket_custatevec-0.1.0.tar.gz
  • Upload date:
  • Size: 34.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pytket_custatevec-0.1.0.tar.gz
Algorithm Hash digest
SHA256 baf1f4b5240cc836559125da1e3032941414469616277097b2a6e83ad9318a18
MD5 66347385fc08dc4d9f423f415f5e59eb
BLAKE2b-256 1de486fd1d466d478cf39c6ed0a0a76c272a8545da28de3d551445500dafb6a8

See more details on using hashes here.

File details

Details for the file pytket_custatevec-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pytket_custatevec-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1d66408e458738fe0de2f74fc07536bd5ace53b366656b4699b0abe0d3202ce0
MD5 fdcdbe55251781d2a05f4f4e8501d494
BLAKE2b-256 768e67b96cadff74306cd65c3c0b96e1a046b74792e94df993d0d5c11c16758d

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