Open QBench
Open QBench is an open-source software framework for defining and executing benchmarks across the quantum-classical stack. It offers support for benchmarks on the:
- hybrid level (quantum-classical workflows)
- high level (quantum algorithms)
- low level (compiled quantum programs)
The framework is supports gate-based quantum computers, photonic systems (boson samplers), and quantum annealers.
Beyond the framework, this package also includes a suite of pre-implemented, high-level quantum application benchmarks. These are specifically crafted to evaluate the performance and fidelity of results on diverse physical quantum devices.
Installation
Using uv (Recommended)
First, create and activate a virtual environment:
uv venv
To install the core dependencies of the package, run:
uv sync
Optional dependencies (Extras)
We provide a number of optional dependencies (referred to as "extras") for executing specific benchmarks or for enabling support for various quantum hardware providers.
Available extras include:
- Benchmarks:
VQE,QSVM - Providers:
IBM,AQT,ORCA
To install specific optional dependencies, use the --extra flag. You can specify multiple extras in a single command. For example, to run the VQE benchmark on an IBM Quantum machine, you would run:
uv sync --extra VQE --extra IBM
You can combine any of the available extras as needed.
Using pip
The package can also be installed with pip. To install the core dependencies run:
pip install .
To install with specific optional dependencies (e.g., VQE and IBM):
pip install ".[VQE,IBM]"
Usage
How to run a benchmark
This example shows how to execute a simple application benchmark using a Grover circuit on simulated IBM Quantum hardware (check Installation to see how to enable IBM support).
First define samplers used for collecting distributions.
from qiskit_aer.primitives import SamplerV2 as AerSampler
from qiskit_ibm_runtime import Sampler
from qiskit_ibm_runtime.fake_provider import FakeGeneva
ideal_sampler = AerSampler(default_shots=1000)
backend_sampler = Sampler(FakeGeneva())
Then use Open QBench to generate a quantum circuit and create your benchmark by defining input and a function used to calculate fidelity.
from open_qbench import ApplicationBenchmark
from open_qbench.apps import grover
from open_qbench.core import BenchmarkInput
from open_qbench.fidelities import normalized_fidelity
qc = grover.grover_nq(3, 6)
backend = backend_sampler.backend()
benchmark_input = BenchmarkInput(qc, backend)
ab = ApplicationBenchmark(
backend_sampler,
ideal_sampler,
benchmark_input,
name="Grover_benchmark",
accuracy_measure=normalized_fidelity,
)
ab.run()
print(ab.result)
Contributing
We welcome contributions from the community! Please see CONTRIBUTING.md for a detailed guide.
License
Metadata
Release files for open-qbench 0.2.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 | |
|---|---|---|---|
| open_qbench-0.2.0.tar.gz | 155.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| open_qbench-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 205.6 kB
Release files / open_qbench-0.2.0.tar.gz
| Download URL | open_qbench-0.2.0.tar.gz |
|---|---|
| Size | 155.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
90522827c6a10edece1c83406f694683d73aab023ba27c89b4dd3d026458578b
|
|
BLAKE2b-256 checksum How to use checksums |
8f53a1a4a3a855cb953ec3387e72b6a6067d7cda3e239095f23f515d23f8a167
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
Release files / open_qbench-0.2.0-py3-none-any.whl
| Download URL | open_qbench-0.2.0-py3-none-any.whl |
|---|---|
| Size | 50.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d42740a9a95eebc19395bcb07f3fc4657337d7d7b21f653fcc25589672273baf
|
|
BLAKE2b-256 checksum How to use checksums |
0bb95677304a173af4678e7536e39b7c785db90decf370f40ef9e60cc3f9ee09
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|