A package for implementation of Quantum Characterization, Verification and Validation (QCVV) techniques on IQM's hardware at gate level abstraction
Project description
IQM Benchmarks
The IQM Benchmarks is a suite of quantum characterization, verification, and validation (QCVV) tools for quantum computing. It is designed to be a comprehensive tool for benchmarking quantum hardware. The suite is designed to be modular, allowing users to easily add new benchmarks and customize existing ones. The suite is designed to be easy to use, with a simple API that allows users to run benchmarks with a single command.
Below is a list of the benchmarks currently available in the suite:
- Randomized Benchmarking: A suite of randomized benchmarking protocols for characterizing the performance of quantum gates (Clifford Randomized Benchmarking, Mirror Randomized Benchmarking, Interleaved Randomized Benchmarking).
- Quantum Volume: A benchmark for characterizing the performance of quantum computers.
- Q-Score: A benchmark that estimates the size of combinatorial optimization problems a given number of qubits can execute with meaningful results.
- GHZ State Benchmarking: A benchmark for characterizing the performance of multi-qubit entangled states.
The project is split into different benchmarks, all sharing the Benchmark class or the legacy BenchmarkBase class. Each individual benchmark takes as an argument their own BenchmarkConfigurationBase class. All the (legacy) benchmarks executed at once are wrapped by the BenchmarkExperiment class, which handles dependencies among the benchmarks, storing the results, producing the plots...
Installation (latest release)
Usually it makes sense to use a new Conda environment (e.g. iqm-benchmarks) to isolate your setup from the global Python installation. That way, you can play around without messing the rest of your system.
Start a terminal in your machine, and type
conda create -n iqm-benchmarks python=3.11.2
conda activate iqm-benchmarks
Then, you can install the latest release of the IQM Benchmarks by running:
$ pip install iqm-benchmarks
If you have already installed iqm-benchmarks and want to get the latest release you can add the --upgrade flag:
pip install iqm-benchmarks --upgrade
Development mode (latest changes: recommended)
To install in development mode with all required dependencies, you can instead clone the repository and from the project directory run
python -m pip install -e ".[develop,test]" --upgrade --upgrade-strategy=eager
To run the tests, you can use the following command:
tox -e test
Characterize Physical Hardware
The IQM Benchmarks suite is designed to be used with real quantum hardware. To use the suite, you will need to have access to a quantum computer. The suite is designed to work with both IQM Resonance (IQM's quantum cloud service) and on-prem devices, but can be easily adapted to work with other quantum computing platforms.
To use the suite with IQM Resonance, you will need to set up an account and obtain an API token. You can then set the IQM_TOKEN environment variable to your API token. The suite will automatically use this token to authenticate with IQM Resonance.
import os
os.environ["IQM_TOKEN"] = "your_token"
Using a Jupyter notebook or Python script
You can easily set up one or more benchmarks by defining a configuration for them. For example, for Randomized, Interleaved and Mirror Benchmarking, or Quantum Volume:
from iqm.benchmarks.randomized_benchmarking.interleaved_rb.interleaved_rb import InterleavedRBConfiguration
from iqm.benchmarks.randomized_benchmarking.mirror_rb.mirror_rb import MirrorRBConfiguration
from iqm.benchmarks.quantum_volume.quantum_volume import QuantumVolumeConfiguration
EXAMPLE_IRB = InterleavedRBConfiguration(
qubits_array=[[3,4],[8,9]],
sequence_lengths=[2**(m+1)-1 for m in range(7)],
num_circuit_samples=30,
shots=2**10,
calset_id=None,
parallel_execution=True,
interleaved_gate = "iSwapGate",
interleaved_gate_params = None,
simultaneous_fit = ["amplitude", "offset"],
)
EXAMPLE_MRB = MirrorRBConfiguration(
qubits_array=[[0,1],
[0,1,3,4],
[0,1,3,4,8,9],
[0,1,3,4,8,9,13,14],
[0,1,3,4,8,9,13,14,17,18]],
depths_array=[[2**m for m in range(9)],
[2**m for m in range(8)],
[2**m for m in range(7)],
[2**m for m in range(6)],
[2**m for m in range(5)]],
num_circuit_samples=10,
num_pauli_samples=5,
shots=2**8,
two_qubit_gate_ensemble={"CZGate": 0.7, "iSwapGate": 0.3}, # {GATE: PROBABILITY}
density_2q_gates=0.25,
calset_id=None,
)
EXAMPLE_QV = QuantumVolumeConfiguration(
num_circuits=500,
shots=2**8,
calset_id=None,
num_sigmas=2,
choose_qubits_routine="custom",
custom_qubits_array=[[0,1,2,3], [0,1,3,4]],
qiskit_optim_level=3,
optimize_sqg=True,
routing_method="sabre",
physical_layout="fixed",
max_gates_per_batch=60_000,
rem=True,
mit_shots=1_000,
)
In order to execute them, you must specify a backend.
- for IQM Resonance this can be given as a simple string, such as "garnet" (together with your IQM Token environment variable)
- and for an on-prem device and IQM Resonance this can be defined using the URL of the quantum computer.
Also, you need to reference the benchmark configuration you want to run:
from iqm.benchmarks.randomized_benchmarking.mirror_rb.mirror_rb import *
# import os
# os.environ["IQM_TOKEN"] = "your_token"
backend = IQMProvider("https://example-station.qc.iqm.fi/cocos/").get_backend()
EXAMPLE_EXPERIMENT = MirrorRandomizedBenchmarking(backend, EXAMPLE_MRB)
EXAMPLE_EXPERIMENT.run()
Full examples on how to run benchmarks and analyze the results can be found in the examples folder.
Scheduled benchmarks using a CI/CD Pipeline
This repository can be setup to perform a scheduled (weekly, daily...) benchmark from a Gitlab/Github pipeline, executed on a real device. An example configuration is given in the scheduled_experiments folder.
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 iqm_benchmarks-1.4.tar.gz.
File metadata
- Download URL: iqm_benchmarks-1.4.tar.gz
- Upload date:
- Size: 4.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b8883987f0994ba5183ce26e5d69861e052c85b2196d5fd8411c4c1e4b077c94
|
|
| MD5 |
79005dfda38be1b2c1ba06dd256ca659
|
|
| BLAKE2b-256 |
3cbba45b2ab6d09fd5edf71ae65a39a147a74543aac425a22ac4a8f164f1dda7
|
File details
Details for the file iqm_benchmarks-1.4-py3-none-any.whl.
File metadata
- Download URL: iqm_benchmarks-1.4-py3-none-any.whl
- Upload date:
- Size: 4.2 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
28664ec26c12fe84f3e8735b824bee17eaaab63b0cda50ea761c946a2bc70d70
|
|
| MD5 |
fbf8ff45300c06e169dcb4052d37d7dd
|
|
| BLAKE2b-256 |
ad6dbc93f5f5d8034a5cd88e806aac866fc5546a6bd0790c0cb09f86e65c295b
|