qBraid-SDK extension providing support for QIR conversions.
This project aims to make QIR representations accessible via the qBraid-SDK transpiler, and by doing so, open the door to language-specific conversions from any and all high-level quantum languages supported by qbraid
. See QIR Alliance: why do we need it?.
qBraid-QIR requires Python 3.10 or greater, and can be installed with pip as follows:
pip install qbraid-qir
qBraid-QIR offers integrations that require extra (optional) dependencies, which can be installed as follows:
For OpenQASM 3 to QIR conversions, install the qasm3
extra:
pip install 'qbraid-qir[qasm3]'
For Cirq to QIR conversions, install the cirq
extra:
pip install 'qbraid-qir[cirq]'
You can also install from source by cloning this repository and running a pip install command in the root directory of the repository:
git clone https://github.com/qBraid/qbraid-qir.git
cd qbraid-qir
pip install .
To include optional dependencies when installing from source, use the same "extras_require" format, e.g.
pip install '.[qasm3,cirq]'
You can view the version of qbraid-qir you have installed within a Python shell as follows:
import qbraid_qir
qbraid_qir.__version__
from qbraid_qir import qasm3_to_qir
program = """
OPENQASM 3;
include "stdgates.inc";
qubit[2] q;
bit[2] c;
h q[0];
cx q[0], q[1];
measure q[0] -> c[0];
measure q[1] -> c[1];
"""
module = qasm3_to_qir(program, name="my-program")
ir = str(module)
import cirq
from qbraid_qir import cirq_to_qir
q0, q1 = cirq.LineQubit.range(2)
circuit = cirq.Circuit(
cirq.H(q0),
cirq.CNOT(q0, q1),
cirq.measure(q0, q1)
)
module = cirq_to_qir(circuit, name="my-circuit")
ir = str(module)
qBraid-SDK transpiler hub-and-spokes architecture with qbraid-qir integration (left) mapped to language specific conversion step in QIR abstraction layers (right).
- Interested in contributing code, or making a PR? See CONTRIBUTING.md
- For feature requests and bug reports: Submit an issue
- For discussions, and specific questions about qBraid-QIR, or other topics, join our discord community
- For questions that are more suited for a forum, post to
QCSE
with the
qbraid
tag. - By participating, you are expected to uphold our code of conduct.
If you use qBraid-QIR in your research, we kindly request that you cite it appropriately. The BibTeX entry below is aligned with the latest stable release. For the most up-to-date citation details, please refer to CITATION.cff.
@software{Gupta_qBraid-QIR_Python_package_2024,
author = {Gupta, Harshit and Jain, Rohan and Kushnir, Samuel and Parakh, Priyansh and Hill, Ryan James},
license = {GPL-3.0},
month = aug,
title = {{qBraid-QIR: Python package for QIR conversions, integrations, and utilities.}},
url = {https://github.com/qBraid/qbraid-qir},
version = {0.2.3},
year = {2024}
}
This project was conceived in cooperation with the Quantum Open Source Foundation (QOSF).