Skip to main content

Package for developing and executing quantum computing benchmarks

Project description

Open QBench

License

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.

[!NOTE] To install the ORCA extra, you'll first need to add your SSH key to the ORCA Computing SDK website at https://sdk.orcacomputing.com/.

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

Apache License 2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

open_qbench-0.2.0.tar.gz (155.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

open_qbench-0.2.0-py3-none-any.whl (50.3 kB view details)

Uploaded Python 3

File details

Details for the file open_qbench-0.2.0.tar.gz.

File metadata

  • Download URL: open_qbench-0.2.0.tar.gz
  • Upload date:
  • Size: 155.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for open_qbench-0.2.0.tar.gz
Algorithm Hash digest
SHA256 90522827c6a10edece1c83406f694683d73aab023ba27c89b4dd3d026458578b
MD5 e5938ea8ec4e23223f29f607c3daeff7
BLAKE2b-256 8f53a1a4a3a855cb953ec3387e72b6a6067d7cda3e239095f23f515d23f8a167

See more details on using hashes here.

File details

Details for the file open_qbench-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: open_qbench-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 50.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for open_qbench-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d42740a9a95eebc19395bcb07f3fc4657337d7d7b21f653fcc25589672273baf
MD5 158b4aed186ad067be976574fa383ab3
BLAKE2b-256 0bb95677304a173af4678e7536e39b7c785db90decf370f40ef9e60cc3f9ee09

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page