cudaq-convert
Interoperability helpers for CUDA-Q: convert OpenQASM 2.0 / 3.0 and Qiskit circuits into CUDA-Q kernels.
This package is developed and released independently of the core CUDA-Q
repository. It takes a dependency on cudaq and installs on top of it.
Who is this for
Researchers and developers who already have quantum circuits expressed in OpenQASM 2.0/3.0 or built with Qiskit and want to run, simulate, or extend them on CUDA-Q — without hand-rewriting each circuit as a CUDA-Q kernel.
Platform: CUDA-Q ships Linux wheels only, so this package runs on Linux or WSL with Python 3.11–3.13. It is not importable on bare Windows.
Installation
pip install cudaq-convert
This installs everything both conversion paths need, so from_qasm,
from_qasm_str, and from_qiskit all work straight away.
Compatibility
| Supported | |
|---|---|
| CUDA-Q | cudaq >= 0.14.2 |
| Python | 3.11 – 3.13 |
| Qiskit | >= 1.0 |
| OpenQASM | 2.0, 3.0 |
Usage
import cudaq
from cudaq_convert import from_qasm, from_qasm_str, from_qiskit
# From a OpenQASM 2.0 / 3.0 string
kernel = from_qasm_str("""
OPENQASM 2.0;
include "qelib1.inc";
qreg q[2];
h q[0];
cx q[0], q[1];
""")
print(cudaq.sample(kernel))
# From a file
kernel = from_qasm("circuit.qasm")
# From a Qiskit QuantumCircuit
from qiskit import QuantumCircuit
qc = QuantumCircuit(2)
qc.h(0)
qc.cx(0, 1)
kernel = from_qiskit(qc)
Public API
| Function | Description |
|---|---|
from_qasm(path) |
Parse an OpenQASM 2.0/3.0 file into a CUDA-Q kernel. |
from_qasm_str(source) |
Parse OpenQASM 2.0/3.0 source text. Dispatches on the OPENQASM <version>; header. |
from_qiskit(circuit) |
Convert a Qiskit QuantumCircuit into a CUDA-Q kernel. |
Feature coverage
- OpenQASM 2.0: full
qelib1.incgate set, user-definedgateblocks with recursive expansion, register broadcasting,measure/reset/barrier/opaque. - OpenQASM 3.0:
qubit[N]/bit[N]declarations,c = measure q;assignment, built-inU(...)/gphase, legacy uppercaseCX/I,include "stdgates.inc";. - Qiskit: full standard gate library, with recursive
definitionfallback for custom/composite gates.
Known limitations
- Not yet implemented (these raise
NotImplementedError):- QASM3 gate modifiers:
ctrl @,negctrl @,inv @,pow(n) @. - Classical control and typed declarations / subroutines (
if,for,while,def,input/output,int/float/angle, …). This includes OpenQASM 2.0'sif (c==N) gate q;, which is legal 2.0 syntax.
- QASM3 gate modifiers:
- Endianness: CUDA-Q counts are big-endian (q0 is the leftmost bit) while Qiskit is little-endian; reverse the bitstring when comparing across the two.
- Phase-only gates (
rz,cz,cp,s,t, global phase,gphase,u0) are unobservable in Z-basis sampling. - Platform: Linux/WSL only, Python 3.11–3.13 (inherited from CUDA-Q).
Testing
pip install -e .[test]
pytest
Note: on CPU-only machines, export
CUDAQ_DEFAULT_SIMULATOR=qpp-cpubefore running the tests soimport cudaqdoesn't try to initialize a GPU context.
Contributing
Contributions are welcome — see CONTRIBUTING.md for the development setup, test instructions, and coding conventions. By participating you agree to the Code of Conduct.
Security
To report a security vulnerability, follow SECURITY.md. Do not open a public GitHub issue for security reports.
License
Apache License 2.0 — see LICENSE.
Metadata
Release files for cudaq-convert 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cudaq_convert-0.1.0.tar.gz | 32.5 kB | Without provenance | Details for cudaq_convert-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cudaq_convert-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for cudaq_convert-0.1.0-py3-none-any.whl |
Total release size: 50.7 kB
Release files / cudaq_convert-0.1.0.tar.gz
| Download URL | cudaq_convert-0.1.0.tar.gz |
|---|---|
| Size | 32.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
da7e889904c3ac87003d85347e4aa424e17909017aa4d071160c8ea522ad1b1c
|
|
BLAKE2b-256 checksum How to use checksums |
bb388e91445ca86ff8b627b1b1227125e1e43a0572e5fd9c17f1e182a7659b76
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.7
|
Release files / cudaq_convert-0.1.0-py3-none-any.whl
| Download URL | cudaq_convert-0.1.0-py3-none-any.whl |
|---|---|
| Size | 18.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
318b88b0b2b1ed4bc16633c0f1c82a80400a1967bcfdf3bfadd8de7bf784ed2e
|
|
BLAKE2b-256 checksum How to use checksums |
a20e8ffdfaebdff6b53b685ef1d63f4c7ba76329fe29fc1e4f2ca29b7879bde5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.7
|
Security for cudaq-convert 0.1.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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.