Skip to main content

qumat-qdp

GPU-accelerated quantum state encoding for Apache Mahout Qumat.

Installation

pip install qumat[qdp]

Requires one of:

  • NVIDIA GPU (CUDA path via QdpEngine)
  • AMD GPU with ROCm (AMD path via QdpEngine(backend="amd"))

Recommended environment setup:

python -m venv .venv
source .venv/bin/activate

# Install the GPU runtime for your platform first:
# - NVIDIA users: CUDA-compatible torch / triton
# - AMD users: ROCm-compatible torch / triton

uv sync --active --project qdp/qdp-python --group dev

Use --active so uv reuses the environment that already has the correct GPU runtime stack.

Usage

import qumat.qdp as qdp
import torch

# Initialize the unified QDP engine on GPU 0.
# Choose the backend explicitly.
engine = qdp.QdpEngine(device_id=0, backend="cuda")

# Encode data into quantum state
qtensor = engine.encode([1.0, 2.0, 3.0, 4.0], num_qubits=2, encoding_method="amplitude")

# Zero-copy transfer to PyTorch
tensor = torch.from_dlpack(qtensor)
print(tensor)  # Complex tensor on CUDA

AMD ROCm Usage

import qumat.qdp as qdp
import torch

# Unified AMD engine route
engine = qdp.QdpEngine(device_id=0, precision="float32", backend="amd")
qt = engine.encode(torch.randn(8, 4, device="cuda"), 2, "amplitude")
state = torch.from_dlpack(qt)
print(state.device, state.dtype)  # cuda:0, complex64

The public QdpEngine is a unified Python facade with explicit backend selection:

  • backend="cuda" routes to the Rust _qdp.QdpEngine
  • backend="amd" routes to the Triton AMD engine directly

See qdp/qdp-python/TRITON_AMD_BACKEND.md for Triton AMD setup and validation details.

Encoding Methods

Method Description
amplitude Normalize input as quantum amplitudes
angle Map values to rotation angles (one per qubit)
basis Encode integer as computational basis state
iqp IQP-style encoding with full ZZ entanglement
iqp-z IQP encoding with Z-only diagonal (no ZZ pairs)
phase Per-qubit phase product state via H⊗P(x_k)

Backend support boundary:

  • CUDA (QdpEngine): amplitude, angle, basis, iqp, iqp-z, phase
    • phase is currently only reachable on the CUDA path via host inputs (Python list / NumPy / file / CPU torch tensor). The Python extension's CUDA-tensor validation does not yet allowlist phase; cuda-resident torch tensors must use .cpu() first when targeting phase. Tracked as a follow-up.
  • AMD (QdpEngine(..., backend="amd")): amplitude, angle, basis, iqp, iqp-z, phase

Pipeline / loader dtype (Rust internals)

QuantumDataLoader and run_throughput_pipeline build a Rust PipelineConfig with an encoding plus a dtype (float32 vs float64). The prefetch thread can only keep an end-to-end float32 host batch for encodings whose GPU stack implements the batch f32 path (encode_batch_f32). Today that is amplitude only. Angle and basis still fall back to float64 for that loop until their batch f32 implementations exist. The eventual full matrix (e.g. angle/basis under supports_f32 once kernels are wired) is broader than what the pipeline uses today.

Input Sources

# Python list
qtensor = engine.encode([1.0, 2.0, 3.0, 4.0], 2, "amplitude")

# NumPy array
qtensor = engine.encode(np.array([[1, 2, 3, 4], [4, 3, 2, 1]]), 2, "amplitude")

# PyTorch tensor (CPU or CUDA)
qtensor = engine.encode(torch.tensor([1.0, 2.0, 3.0, 4.0]), 2, "amplitude")

# File formats
qtensor = engine.encode("data.parquet", 10, "amplitude")
qtensor = engine.encode("data.arrow", 10, "amplitude")
qtensor = engine.encode("data.npy", 10, "amplitude")
qtensor = engine.encode("data.pt", 10, "amplitude")

# Remote object storage URLs (requires building with remote-io feature)
qtensor = engine.encode("s3://my-bucket/data.parquet", 10, "amplitude")
qtensor = engine.encode("gs://my-bucket/data.parquet", 10, "amplitude")

Links

License

Apache License 2.0

Metadata

Release files for qumat-qdp 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for qumat-qdp 0.2.0
File Interpreter ABI Platform
qumat_qdp-0.2.0-cp312-cp312-manylinux_2_34_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.34+ x86-64 Details
qumat_qdp-0.2.0-cp311-cp311-manylinux_2_34_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.34+ x86-64 Details
qumat_qdp-0.2.0-cp310-cp310-manylinux_2_34_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.34+ x86-64 Details

Total release size: 14.4 MB

Release files / qumat_qdp-0.2.0-cp312-cp312-manylinux_2_34_x86_64.whl

Download URL qumat_qdp-0.2.0-cp312-cp312-manylinux_2_34_x86_64.whl
Size 4.8 MB
Tags CPython 3.12 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
5af45eb197a4105eabbaa5a3b20a757e64d5f1dcfaeb0f38592711700b773cec
BLAKE2b-256 checksum
How to use checksums
0f9106dbd19114bbbc06c41f382b8682710de2249be34fd404e27c3ca2104a64
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.11

Release files / qumat_qdp-0.2.0-cp311-cp311-manylinux_2_34_x86_64.whl

Download URL qumat_qdp-0.2.0-cp311-cp311-manylinux_2_34_x86_64.whl
Size 4.8 MB
Tags CPython 3.11 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
2bfaa8b93c3f8983384141baa15c0dea91041080ce4a27e8ec57c493370a2767
BLAKE2b-256 checksum
How to use checksums
1e0d44d72b171f70e4b96c91e8c0fb64d1114d610192796fd10aaa04b205c148
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.11

Release files / qumat_qdp-0.2.0-cp310-cp310-manylinux_2_34_x86_64.whl

Download URL qumat_qdp-0.2.0-cp310-cp310-manylinux_2_34_x86_64.whl
Size 4.8 MB
Tags CPython 3.10 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
601fa4634dc004b27b617eaac3e41562814c9bd61ece5ad33322f1f3e2c0ccf0
BLAKE2b-256 checksum
How to use checksums
f6b209511081a9c18eb846d9a53fef88f7514b37cc9307606137e8be29e00993
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.11

Security for qumat-qdp 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page