← Quantum Store · Guides · Lessons · Glossary · Packages · About · Türkçe

TU München — Chair for Design Automation

MQT Bench benchmark circuits

DatasetBenchmarkingLicence: MITVersion: 2.3.05.1 KB

Official source: munich-quantum-toolkit/bench

Download ZIP (free)

MQT Bench, which produces standard benchmark circuits (GHZ, QFT, Grover and dozens more) for comparing quantum software tools, with a tested example that exports the circuits as OpenQASM 3.

What is MQT Bench?

MQT Bench is part of the Technical University of Munich's Munich Quantum Toolkit (MQT) project. It produces standard sets of circuits for fairly comparing quantum compilers, simulators and other tools. Each circuit is available at different levels of abstraction (algorithmic, target-independent, mapped to hardware).

When to use it

The example in this package

benchmark_al.py generates GHZ, QFT and Grover circuits for 3 and 5 qubits, prints their depth and gate counts, and saves each one as an OpenQASM 3 file in the benchmarks/ folder.

Next steps

  1. Get the circuits in a specific hardware's gate set with level=BenchmarkLevel.NATIVEGATES.
  2. Download in bulk without writing code from the mqt-bench.app web interface.

Installation and running

pip install mqt.bench
python benchmark_al.py

Tested with: mqt.bench 2.3.0, Python 3.12.

Official source

Links

Package contents

Licence

The example code and the guide in this package were written by the Quantum Store editors and are MIT licensed. The project it uses is subject to its own licence (MIT).


Quantum Store — https://hakanerdogan.com/en

Example code

The example shipped in the package, run and checked. Comments and printed messages are in Turkish; the code is the same in any language. Everything is in the ZIP.

benchmark_al.py

"""MQT Bench: standart kıyaslama (benchmark) devrelerini üret ve dışa aktar.

GHZ, QFT ve Grover devrelerini farklı boyutlarda üretir, kapı sayılarını
yazdırır ve OpenQASM 3 dosyası olarak kaydeder.

Çalıştırma:
    pip install mqt.bench
    python benchmark_al.py
"""

from pathlib import Path

from mqt.bench import BenchmarkLevel, get_benchmark
from qiskit import qasm3

out = Path("benchmarks")
out.mkdir(exist_ok=True)

for name in ("ghz", "qft", "grover"):
    for size in (3, 5):
        qc = get_benchmark(benchmark=name, level=BenchmarkLevel.ALG, circuit_size=size)
        ops = dict(qc.count_ops())
        path = out / f"{name}_{size}.qasm"
        path.write_text(qasm3.dumps(qc), encoding="utf-8")
        print(f"{name:7s} n={size}: derinlik={qc.depth():3d}  kapılar={ops}")
        assert qc.num_qubits >= size

print(f"Tamam: devreler {out.resolve()} klasörüne kaydedildi.")

Related concepts

← All packages

Share: X · LinkedIn