Unitary Compiler Collection: A quantum circuit interface and compiler for multiple quantum frameworks
Project description
ucc: Unitary Compiler Collection
The Unitary Compiler Collection (UCC) is a Python library for frontend-agnostic, high performance compilation of quantum circuits.
UCC interfaces automatically with multiple quantum computing frameworks, including Qiskit, Cirq, and PyTKET and supports programs in OpenQASM 2 and OpenQASM 3. For a full list of the latest supported interfaces, just call ucc.supported_formats.
Want to know more?
- Check out our documentation, which you can build locally after installation by running
make htmlinucc/docs/source. - For code, repo, or theory questions, especially those requiring more detailed responses, submit a Discussion.
- For casual or time sensitive questions, chat with us on Discord.
Quickstart
Installation
git clone https://github.com/unitaryfund/ucc.git
cd ucc
pip install -e . # Editable mode
Example with Qiskit, Cirq, and PyTKET
Define a circuit with your preferred quantum SDK and compile it!
from ucc import compile
from pytket import Circuit as TketCircuit
from cirq import Circuit as CirqCircuit
from qiskit import QuantumCircuit as QiskitCircuit
from cirq import H, CNOT, LineQubit
def test_tket_compile():
circuit = TketCircuit(2)
circuit.H(0)
circuit.CX(0, 1)
compile(circuit)
def test_qiskit_compile():
circuit = QiskitCircuit(2)
circuit.h(0)
circuit.cx(0, 1)
compile(circuit)
def test_cirq_compile():
qubits = LineQubit.range(2)
circuit = CirqCircuit(
H(qubits[0]),
CNOT(qubits[0], qubits[1]))
compile(circuit)
How does UCC stack up?
We run benchmarks regularly to compare against the most recent versions of the most popular quantum compiler frameworks for a range of circuits. Here's the latest:
And here you can see progress over time (changes usually indicate a newer version came out):
Note that the compile times before 2024-12-10 may have been run on different classical compute instances, so their exact runtime is not as important to compare as their relative performance with respect to other compilers.
After 2024-12-10, all data present in this plot should be run on the same compute instance using our ucc-benchmarks GitHub Actions workflow.
Benchmarking
You can benchmark the performance of ucc against other compilers using scripts/run_benchmarks.sh. This script runs compiler benchmarks in parallel, so you will need to first install parallel to support it.
On Mac you can do this with brew install parallel.
Contributing
We’re building UCC as a community-driven project. Your contributions help improve the tool for everyone! There are many ways you can contribute, such as
- Create a Custom Compiler Pass: Learn how in the User Guide
- Submit a bug report or feature request: Submit a bug report or feature request on GitHub.
- Contribute Code: Follow the Contribution Guide to submit new passes and improvements.
If you have questions about contributing please ask on the Unitary Foundation Discord.
License
UCC is distributed under GNU Affero General Public License version 3.0(AGPLv3). Parts of ucc contain code or modified code that is part of Qiskit, which is distributed under Apache 2.0 license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ucc-0.4.2.tar.gz.
File metadata
- Download URL: ucc-0.4.2.tar.gz
- Upload date:
- Size: 81.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
67b9ee8b4dbfd4b7f19d42dc29a3310e0018a7ce26b8354d5d628506d26f5916
|
|
| MD5 |
44a53d689af7e6687d7bf8e3a29be7bb
|
|
| BLAKE2b-256 |
7fb1b02decad24d052f2a51814a499f67caf2dc9adf913f8a0cbb73d182d680e
|
File details
Details for the file ucc-0.4.2-py3-none-any.whl.
File metadata
- Download URL: ucc-0.4.2-py3-none-any.whl
- Upload date:
- Size: 98.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab19b826f8f65359cb15c88bf43dbb90b0e7899d52f8002e7d481585e1109fb3
|
|
| MD5 |
d43ba594362d5bb0185fca4bc98941dc
|
|
| BLAKE2b-256 |
c686173153be46fd23d5a7e941df436fec1ebe35be9c03f47d9d8eac1c2c2c58
|