Skip to main content

A package for implementation of Quantum Characterization, Verification and Validation (QCVV) techniques on IQM's hardware at gate level abstraction

Project description

IQM Benchmarks

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:

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)

uv is highly recommended for practical Python environment and package management. With uv installed in your system, start a terminal in your machine and create a new Python environment

uv venv --python=3.11

Note: refer to uv's documentation if there are problems setting up a Python environment.

After the command has run, read the output and make sure to use the prompt to activate the environment. Then, you can install the latest release of the IQM Benchmarks by running:

uv pip install iqm-benchmarks

Supplied within the Python package there is an additional requirements.txt file containing locked, security scanned dependencies. The file can be used to constrain installed dependencies either directly from the repo or by extracting it from the PyPI package.

uv pip install --constraint requirements.txt iqm-benchmarks

Optional dependencies

Optional dependencies like compressive gate set tomography and jupyter notebooks can be installed as follows:

uv pip install "iqm-benchmarks[mgst,examples]"

Current optional dependencies are:

  • examples: Jupyter notebooks
  • mgst: Compressive gate set tomography
  • test: Code testing and Linting
  • docs: Documentation building
  • cicd: CICD tools

Development installation (latest changes)

To install in development mode with all required dependencies, you can instead clone the repository and from the project directory run

uv pip install --constraint requirements.txt iqm-benchmarks

To run the tests, you can use the following command:

./test

To build the API documentation as HTML:

./docbuild

Update the requirements. This is necessary when you add a new dependency or update an existing one in pyproject.toml. After this, any changes in the lockfile requirements.txt have to be committed. The script upgrades locked dependencies defined in pyproject.toml within the given version ranges. However, transitive dependencies are deliberately not upgraded automatically.

python update-requirements.py

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


Download files

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

Source Distribution

iqm_benchmarks-2.10.tar.gz (8.5 MB view details)

Uploaded Source

Built Distribution

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

iqm_benchmarks-2.10-py3-none-any.whl (7.0 MB view details)

Uploaded Python 3

File details

Details for the file iqm_benchmarks-2.10.tar.gz.

File metadata

  • Download URL: iqm_benchmarks-2.10.tar.gz
  • Upload date:
  • Size: 8.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for iqm_benchmarks-2.10.tar.gz
Algorithm Hash digest
SHA256 6ab2183b1c13231dd1cb3d1b8a174a6dff1b8e680c7b657f1b942e624d041b41
MD5 4155defb733416a982d920a5e1fbd4fc
BLAKE2b-256 1d95ff5b9ae5fea22a636b2bce7b81eae0034eb500502089487b23acb35dbcc5

See more details on using hashes here.

File details

Details for the file iqm_benchmarks-2.10-py3-none-any.whl.

File metadata

  • Download URL: iqm_benchmarks-2.10-py3-none-any.whl
  • Upload date:
  • Size: 7.0 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for iqm_benchmarks-2.10-py3-none-any.whl
Algorithm Hash digest
SHA256 dbd3a07e571486c7458412fbb4b2cab3048269c6a21623120b977b5c23f49af0
MD5 d14768c300af857f3bbdf1973f06ae25
BLAKE2b-256 5a78a553e609059c26e7ab9f5d2f9e06499b55546bfa601a1454eb98227dfab5

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