MQT Bench is a quantum circuit benchmark suite with cross-level support, i.e., providing the same benchmark algorithms for different abstraction levels throughout the quantum computing software stack.
MQT Bench is part of the Munich Quantum Toolkit (MQT) developed by the Chair for Design Automation at the Technical University of Munich and is hosted at https://www.cda.cit.tum.de/mqtbench/.
This documentation explains how to use MQT Bench to create and filter benchmarks.
It uses the structure proposed by the openQASM 3.0 specification [1] and offers benchmarks on four different abstraction levels:
- Algorithmic Level
- Target-independent Level
- Target-dependent Native Gates Level
- Target-dependent Mapped Level
An example is given in the following:
- Algorithmic Level
Variational Quantum Algorithms (VQAs) are an emerging class of quantum algorithms with a wide range of applications. A respective circuit is shown above, it represents an example of an ansatz function frequently used for Variational Quantum Eigensolvers (VQEs), a subclass of VQAs. On this abstraction level, the circuit is parameterized by the angles θi of the six single-qubit gates.
- Target-independent Level
VQAs are hybrid quantum-classical algorithms, where the parameters of the quantum ansatz are iteratively updated by a classical optimizer analogous to conventional gradient-based optimization. Consider again the circuit from the previous figure. Assuming these parameters have been determined, e.g., θi = −π for i = 0, ..., 5, they are now propagated and the resulting quantum circuit is shown above.
- Target-dependent Native Gates Level
Different quantum computer realizations support different native gate-sets. In our example, we consider the IBMQ Manila device as the target device which natively supports I, X, √X, Rz and CX gates. Consequently, the Ry gates in the previous figure have to be converted using only these native gates. In this case, they are substituted by a sequence of X and Rz gates (denoted as • with a phase of −π).
- Target-dependent Mapped Level
The architecture of the IBMQ Manila device is shown above on the right and it defines between which qubits a two-qubit operation may be performed. Since the circuit shown in the previous figure contains CX gates operating between all combination of qubits, there is no mapping directly matching the target architecture's layout. As a consequence, a non-trivial mapping followed by a round of optimization leads to the resulting circuit shown above on the left. This is also the reason for the different sequence of CX gates compared to the previous example.
This circuit is now executable on the IBMQ Manila device, since all hardware induced requirements are fulfilled.
So far, the following benchmarks are implemented and provided:
- Amplitude Estimation
- Deutsch-Jozsa
- GHZ State
- Graph State
- Ground State
- Grover's (no ancilla)
- Grover's (v-chain)
- Portfolio Optimization with QAOA
- Portfolio Optimization with VQE
- Pricing Call Option
- Pricing Put Option
- Quantum Fourier Transformation (QFT)
- QFT Entangled
- Quantum Neural Network (QNN)
- Quantum Phase Estimation (QPE) Exact
- Quantum Phase Estimation (QPE) Inexact
- Quantum Walk (no ancilla)
- Quantum Walk (-chain)
- Random Circuit
- Routing
- Shor's
- Travelling Salesman
- Variational Quantum Eigensolver (VQE)
- VQE-ansätze with random values:
- Efficient SU2 ansatz with Random Parameters
- Real Amplitudes ansatz with Random Parameters
- Two Local ansatz with Random Parameters
- W-State
See the benchmark description for further details on the individual benchmarks.
At the moment, two compilers are supported:
- Qiskit with the compiler settings: Optimization level 0 to 3
- TKET with the compiler settings: Line placement and graph placement
So far, MQT Bench supports the following native gate-sets:
- IBMQ gate-set: ['rz', 'sx', 'x', 'cx', 'measure']
- Rigetti gate-set: ['rx', 'rz', 'cz', 'measure']
- IonQ gate-set: ['rxx', 'rz', 'ry', 'rx', 'measure']
- OQC gate-set: ['rz', 'sx', 'x', 'ecr', 'measure']
- Quantinuum gate-set: ['rzz', 'rz', 'ry', 'rx', 'measure']
So far, MQT Bench supports the following devices:
- IBMQ Washington with 127 qubits
- IBMQ Montreal with 27 qubits
- Rigetti Aspen-M2 with 80 qubits
- IonQ Harmony with 11 qubits
- IonQ Aria 1 with 25 qubits
- OQC Lucy with 8 qubits
- Quantinuum H2 with 32 qubits
- src/mqt/: main source directory
- bench: Directory for the MQT Bench package
- bench/benchmarks: Directory for the benchmarks
- benchviewer: Directory for the webpage (which can be started locally and is also hosted at https://www.cda.cit.tum.de/mqtbench/)
- tests: Directory for the tests for MQT Bench
There are three ways how to use this benchmark suite:
- Via the webpage hosted at https://www.cda.cit.tum.de/mqtbench/
- Via the pip package
mqt.bench
- Directly via this repository
Since the first way is rather self-explanatory, the other two ways are explained in more detail in the following.
MQT Bench is available via PyPI
(venv) $ pip install mqt.bench
To generate a benchmark circuit on the algorithmic level, please use the get_benchmark
method:
def get_benchmark(
benchmark_name: str,
level: Union[str, int],
circuit_size: int = None,
benchmark_instance_name: str = None,
compiler: str = "qiskit",
compiler_settings: mqt.bench.CompilerSettings = None,
gate_set_name: str = "ibm",
device_name: str = "ibm_washington",
):
...
The available parameters are:
benchmark_name
:"ae"
,"dj"
,"grover-noancilla"
,"grover-v-chain"
,"ghz"
,"graphstate"
,"portfolioqaoa"
,"portfoliovqe"
,"qaoa"
,"qft"
,"qftentangled"
,"qnn"
,"qpeexact"
,"qpeinexact"
,"qwalk-noancilla"
,"qwalk-v-chain"
,"random"
,"realamprandom"
,"su2random"
,"twolocalrandom"
,"vqe"
,"wstate"
,"shor"
,"pricingcall"
,"pricingput"
,"groundstate"
,"routing"
,"tsp"
level
:0
or"alg"
,1
or"indep"
,2
or"nativegates"
,3
or"mapped"
circuit_size
: for most of the cases this is equal to number of qubits (all scalable benchmarks except"qwalk-v-chain"
and"grover-v-chain"
) while for all other the qubit number is highercompiler
:"qiskit"
or"tket"
compiler_settings
: Optimization level for"qiskit"
(0
-3
), placement for"tket"
(lineplacement
orgraphplacement
), exemplary shown:
from mqt.bench import CompilerSettings, QiskitSettings, TKETSettings
compiler_settings = CompilerSettings(
qiskit=QiskitSettings(optimization_level=1),
tket=TKETSettings(placement="lineplacement"),
)
gate_set_name
:"ibm"
,"rigetti"
,"ionq"
,"oqc"
, or"quantinuum"
device_name
:"ibm_washington"
,"ibm_montreal"
,"rigetti_aspen_m2"
,"ionq_harmony"
,"ionq_aria1"
,"oqc_lucy"
, or"quantinuum_h2"
Hereby, the mappings between shortened benchmark_name
and actual benchmarks are:
benchmark_name |
Actual Benchmark |
---|---|
"ae" |
Amplitude Estimation (AE) |
"dj" |
Deutsch-Jozsa |
"grover-noancilla" |
Grover's (no ancilla) |
"grover-v-chain" |
Grover's (v-chain) |
"ghz" |
GHZ State |
"graphstate" |
Graph State |
"portfolioqaoa" |
Portfolio Optimization with QAOA |
"portfoliovqe" |
Portfolio Optimization with VQE |
"qaoa" |
Quantum Approximation Optimization Algorithm (QAOA) |
"qft" |
Quantum Fourier Transformation (QFT) |
"qftentangled" |
QFT Entangled |
"qnn" |
Quantum Neural Network (QNN) |
"qpeexact" |
Quantum Phase Estimation (QPE) exact |
"qpeinexact" |
Quantum Phase Estimation (QPE) inexact |
"qwalk-noancilla" |
Quantum Walk (no ancilla) |
"qwalk-v-chain" |
Quantum Walk (v-chain) |
"random" |
Random Quantum Circuit |
"realamprandom" |
Real Amplitudes ansatz with Random Parameters |
"su2random" |
Efficient SU2 ansatz with Random Parameters |
"twolocalrandom" |
Two Local ansatz with Random Parameters |
"vqe" |
Variational Quantum Eigensolver (VQE) |
"wstate" |
W-State |
"shor" |
Shor's |
"pricingcall" |
Pricing Call Option |
"pricingput" |
Pricing Put Option |
"groundstate" |
Ground State |
"routing" |
Routing |
"tsp" |
Travelling Salesman |
For example, in order to obtain the 5-qubit Deutsch-Josza benchmark on algorithm level, use the following:
from mqt.bench import get_benchmark
qc = get_benchmark("dj", "alg", 5)
Additionally, this python package includes the same webserver used for the hosting of the MQT Bench webpage.
After the mqt.bench
Python package is installed via
(venv) $ pip install mqt.bench
the MQT Bench Viewer can be started from the terminal via
(venv) $ mqt.bench
This first searches for the most recent version of the benchmark files on GitHub and offers to download them. Afterwards, the webserver is started locally.
For that, the repository must be cloned and installed:
git clone https://github.com/cda-tum/MQTBench.git
cd MQTBench
pip install .
Afterwards, the package can be used as described [above](#Usage via pip package).
In case you are using MQT Bench in your work, we would be thankful if you referred to it by citing the following publication:
@article{quetschlich2023mqtbench,
title={{{MQT Bench}}: {Benchmarking Software and Design Automation Tools for Quantum Computing}},
shorttitle = {{MQT Bench}},
journal = {{Quantum}},
author={Quetschlich, Nils and Burgholzer, Lukas and Wille, Robert},
year={2023},
note={{{MQT Bench}} is available at \url{https://www.cda.cit.tum.de/mqtbench/}},
}
which is also available on arXiv:
[1] A.Cross et al., OpenQASM 3: A broader and deeper quantum assembly language, arXiv:2104.14722, 2021