Home

Awesome

QASMBench Benchmark Suite

QASMBench is an OpenQASM benchmark suite for NISQ evaluation. The .qasm code can be directly loaded in IBM Quantum Experience for execution. Please see our TQC paper (DOI:10.1145/3550488 or on arXiv) for details.

If you need specialized circuits with the number of qubits being configurable, or circuits in alternative representations such as Cirq, QSharp, Qiskit, and PyQuil, please see our NWQBench.

alt text

Current version

Latest version: 1.4

About QASMBench

The rapid development of quantum computing (QC) in the NISQ era urgently demands a light-weighted, low-level benchmark suite and insightful evaluation metrics for characterizing the properties of prototype NISQ devices, the efficiency of QC programming compilers, schedulers, and assemblers, and the capability of quantum simulators in a classical computer. QASMBench is a low-level, easy-to-use benchmark suite based on the OpenQASM-2 assembly representation. It consolidates commonly used quantum routines and kernels from a variety of domains including chemistry, simulation, linear algebra, searching, optimization, arithmetic, machine learning, fault tolerance, cryptography, etc., trading-off between generality and usability. Most of the QASMBench application code can be launched and verified in IBM-Q directly. For simulation purposes, you may also want to use our State-Vector simulator (SV-Sim) and Density-Matrix simulator (DM-Sim) to run on GPU/CPU HPC clusters.

To analyze these kernels in terms of NISQ device execution, in addition to circuit width and depth, we propose four circuit metrics including gate density, retention lifespan, measurement density, and entanglement variance, to extract more insights about the execution efficiency, the susceptibility to NISQ error, and the potential gain from machine-specific optimizations. We provide a script under the metric folder to analyze the OpenQASM circuit and report the metrics we defined. For each benchmark, the README.md lists the metrics which include what we defined in the paper and those defined in SupermarQ.

QASMBench Benchmarks

Depending on the number of qubits used, QASMBench includes three categories. For the introduction of the benchmarking routines under each category, please see our paper for detail. For each benchmark in the following tables, we list its name, brief description, and the algorithm category it belongs to, which is based on this Nature paper by adding the categories of quantum arithmetic, quantum machine learning, and quantum communication. We try to update QASMBench with respect to IBMQ roadmap.

alt text

The 'Gates' here refers to the number of Standard OpenQASM-2 gates (see our paper) but excluding those gates in a branching if statement. It is known that physical qubits in a NISQ device follow a certain topology. Since the 2-qubit gates such as CNOT (i.e., CX) can only be performed between two adjacent physical qubits, a series of SWAP operations can be required to move the relevant qubits until they become directly-connected. Therefore, we list the number of CNOT gates in the tables.

Small-scale

Quantum circuits using 2 to 10 qubits.

BenchmarkDescriptionAlgorithmQubitsGatesCNOTReference
deutschDeutsch algorithm with 2 qubits for f(x) = xHidden Subgroup251OpenQASM
iswapAn entangling swapping gateLogical Operation292OpenQASM
quantumwalksQuantum walks on graphs with up to 4 nodesQuantum Walk2113Repo
groverGrover’s algorithmSearch and Optimization2162AgentANAKIN
ipeaIterative phase estimation algorithmHidden Subgroup26830OpenQASM
dnn3 layer quantum neural network sampleMachine Learning222642Ref
teleportationQuantum teleportationQuantum Communication382Ref
qaoaQuantum approximate optimization algorithmSearch and Optimization3156Repo
toffoliToffoli gateLogical Operation3186Scaffold
linearsolverSolver for a linear equation of one qubitLinear Equation3194Ref
fredkinControlled-swap gateLogical Operation3198Scaffold
wstateW-state preparation and assessmentLogical Operation3309OpenQASM
basis_changeTransform the single-particle basis of an linearly connected electronic structureQuantum Simulation35310OpenFermion
qrngQuantum random number generatorQuantum Arithmetic440Paper, Repo
cat_stateCoherent superposition of two coherent states with opposite phaseLogical Operation443Scaffold
inverseqftPerforms an exact inversion of quantum Fourier transformHidden Subgroup480OpenQASM
adderQuantum ripple-carry adderQuantum Arithmetic42310Scaffold
hs4Hidden subgroup problemHidden Subgroup4284Scaffold
bellCircuit equivalent to Bell inequality testLogic Operation4337Cirq
qftQuantum Fourier transformHidden Subgroup43612OpenQASM
variationalVariational ansatz for a Jellium Hamiltonian with a linear-swap networkQuantum Simulation45416OpenFermion
vqeVariational quantum eigensolverLinear Equation4899Scaffold
vqe_uccsdVariational quantum eigensolver with UCCSDLinear Equation422088Scaffold
basis_trotterImplement Trotter steps for molecule LiH at equilibrium geometryQuantum Simulation41626582OpenFermion
qec_smRepetition code syndrome measurementError Correction554OpenQASM
lpnLearning parity with noiseMachine Learning5112sampaio96
qec_enQuantum repetition code encoderError Correction52510sampaio96
shorShor’s algorithmHidden Subgroup56430Qiskit
peaPhase estimation algorithmHidden Subgroup59842OpenQASM
error_correctiond3Error correction with distance 3 and 5 qubitsError Correction511449Ref
simonsSimon’s algorithmHidden Subgroup64414AgentANAKIN
qaoaQuantum approximate optimization algorithmSearch and Optimization627054Cirq
vqe_uccsdVariational quantum eigensolver with UCCSDLinear Equation622821052Scaffold
hhlUsing HHL algorithm to solve linear system of equationsLinear Equation7689196Qiskit HHL
bb84A quantum key distribution circuitQuantum Communication8270Cirq
dnn16-dimension quantum neural network sampleMachine Learning81008192Ref
vqe_uccsdVariational quantum eigensolver with UCCSDLinear Equation8108085488Scaffold
qpeQuantum phase estimation algorithmHidden Subgroup912343AgentANAKIN
adderQuantum ripple-carry adderQuantum Arithmetic1014265OpenQASM
isingIsing model simulation via QCQuantum Simulation1048090Scaffold
hhlUsing HHL algorithm to solve linear system of equationsLinear Equation1018679572449Qiskit HHL

Medium-scale

Quantum circuits using 11 to 27 qubits.

BenchmarkDescriptionAlgorithmQubitsGatesCNOTReference
secaShor's error correction algorithm for teleportationError Correction1121684AgentANAKIN
satBoolean satisfiability problemSearch and Optimization11679252OpenQASM
ccCounterfeit coin finding problemSearch and Optimization122211OpenQASM
multiplyPerforming 3×5 in a quantum circuitQuantum Arithmetic139840AgentANAKIN
gcmGenerator coordinate methodQuantum Chemistry133148762GCM
bvBernstein-Vazirani algorithmHidden Subgroup144113OpenQASM
hhlUsing HHL algorithm to solve linear system of equationsLinear Equation1437265061042859HHL
qf21Using quantum phase estimation to factor the number 21Hidden Subgroup15311115AgentANAKIN
multiplierQuantum multiplierQuantum Arithmetic15574246Cirq
factor247Factorizing 247 to 13x19 with preiod=12Hidden Subgroup15610573273071Reproduced from Ref with modification
dnnquantum neural network sampleMachine Learning162016384Ref
qec9xzQuantum error correction 9-qubit codeError Correction175332Ref
qftQuantum Fourier transformHidden Subgroup18783306OpenQASM
bigadderQuantum ripple-carry adderQuantum Arithmetic18284130OpenQASM
square_rootComputing the square root of an number via amplitude amplificationQuantum Arithmetic182300898Scaffold
bvBernstein-Vazirani algorithmHidden Subgroup195618OpenQASM
qramBucket brigade qRAM prototype circuitQuantum Architecture2022392Ref
bwtBinary Welded Tree: a quantum walk algorithm in continuous time domainQuantum Walk21462001174800QASMBench
cat_stateCoherent superposition of two coherent states with opposite phaseLogical Operation222221QASMBench
ghz_stateGreenberger-Horne-Zeilinger (GHZ) state for max entanglementLogical Operation232322QASMBench
vqeVariational quantum eigensolverQuantum Simulation2423060721538240QASMBench
swap_testSwap test to measure quantum state distanceMachine Learning2523096QASMBench
knnQuantum K-nearest neighborSearch and Optimization2523096Ref
isingIsing model simulation via QCQuantum Simulation2628050QASMBench
wstateW-state preparation and assessmentLogical Operation2715752QASMBench

Large-scale

Quantum circuits using 28 to 433 qubits or more.

BenchmarkDescriptionAlgorithmQubitsGatesCNOTReference
vqe_uccsdVariational quantum eigensolver with UCCSDLinear Equation28399482296648QASMBench
adderQuantum adderQuantum Arithmetic28, 64, 118, 433424, 988, 1834, 6769195, 455, 845, 3120QASMBench
bvBernstein-Vazirani algorithmHidden Subgroup30, 70, 140, 28078, 176, 352, 71218, 36, 72, 152QASMBench
bwtBinary Welded Tree: a quantum walk algorithm in continuous time domainQuantum Walk37, 57, 97, 1771649201, 3145201, 6113201, 12049201632400, 1209200, 2353200, 4641200QASMBench
catCoherent superposition of two coherent states with opposite phaseLogical Operation35, 65, 130, 26035, 65, 130, 26034, 64, 129, 259QASMBench
ccCounterfeit coin finding problemSearch and Optimization32, 64, 151, 30162, 126, 300, 60031, 63, 150, 300QASMBench
dnnquantum neural network sampleMachine Learning33, 51608, 959248, 392Ref
ghzGreenberger-Horne-Zeilinger (GHZ) state for max entanglementLogical Operation40, 78, 127, 25540, 78, 127, 25539, 77, 126, 254QASMBench
isingIsing model simulation via QCQuantum Simulation34, 66, 98, 420368, 720, 1072, 461466, 130, 194, 838QASMBench
knnQuantum K-nearest neighborSearch and Optimization31, 67, 129, 341287, 629, 1218, 3232120, 264, 512, 1260Ref
multiplierQuantum multiplierQuantum Arithmetic45, 75, 350, 4005981, 17077, 383844, 5018772574, 7350, 165200, 216000QASMBench
qftQuantum Fourier transformHidden Subgroupe29, 63, 160, 3202059, 9828, 63760, 255520812, 3906, 25440, 102080QASMBench
quganQuantum generative adversarial networkMachine Learning39, 71, 111, 395759, 1415, 2235, 8057296, 552, 872, 3144Ref
square_rootComputing the square root of an number via amplitude amplificationQuantum Arithmetic45, 60138794, 106193954151, 415123QASMBench
swap_testSwap test to measure quantum state distanceMachine Learning41, 83, 115, 361382, 781, 1085, 3422160, 328, 456, 1440QASMBench
wstateW-state preparation and assessmentLogical Operation36, 76, 118, 380211, 451, 703, 227570, 150, 234, 758QASMBench
quantum telecloningPrepare quantum telecloning stateQuantum Cloning201, 2001Ref1, Ref2, Ref3
QAOA on MAX-3-SATQAOA with random angles on random 3-SAT problemsQAOA100, 1000, 10000Ref
quantum volumeRandom Quantum Volume Benchmark CircuitsQuantum Volume32, 100, 1000Ref1, Ref2, Ref3

qelib1.inc

OpenQASM header file that defines all the gates. Please see OpenQASM and our paper for details.

QASMBenchmark Suite Structure

Each benchmark folder includes the following file:

Tests

The QASMBench circuits can be directly uploaded and verified on IBM-Q NISQ quantum device.

Classic HPC simulation

You may also want to use our state-vector and density-matrix quantum circuit simulator (SV-Sim and DM-Sim) for simulating the QASMBench benchmark circuits efficiently on modern CPU (Intel X86, AMD X86, IBM Power), GPU (NVIDIA GPU and AMD GPU) and Xeon-Phi workstations or HPC clusters (e.g., ORNL Summit/Frontier, ANL Theta, and NERSC Cori/Perlmutter Supercomputers).

Metrics

We propose a set of circuit-based evaluation metrics representing various features of a quantum application. These metrics are designed such that through them certain estimations can be performed on executing a particular circuit over a particular NISQ device. The metrics serve as useful indicators of how a quantum circuit can stress a NISQ hardware device. Please see our paper for the math formula and analysis.

Circuit Width

Circuit width is defined as the number of qubits that enter the superposition state at least once within an application’s lifespan. Qubits that are measured in the interim of a circuit and re-enter superposition are only counted as one qubit towards the circuit width. Circuit width dictates the spatial capacity required for a quantum device in order to run the quantum circuit. The following figure shows the circuit width of QASMBench: alt text

Circuit Depth

Circuit depth is defined as the minimum time-evolution steps required to complete a quantum application. Time evolution is the process of completing all gates defined at time T=T(j), and once these are completed, the circuit moves onto time T = T(j+1), where the following gates are to be processed. Circuit depth can be computed by decomposing OpenQASM code into a n(q) x T matrix Q, where Q(q(i),t(j)) is the time-evolution steps to complete the gate on qubit i at time j. The sum of the maximum time in each column is then equal to the minimum time required for a quantum application. The following figure shows the circuit depth of QASMBench: alt text

Gate Density

Gate density, or operation density, describes the occupancy of gate slots along the time-evolution steps of a quantum circuit. As certain qubits might need to wait for other qubits in the time evolution (i.e, gate dependency), they remain idle by executing the identity gate (ID gate). Consequently, if a gate slot is empty due to dependency, it implies a lower occupancy for the quantum hardware. This is similar to a classical processor, where data dependency introduces pipeline bubbles and reduced occupancy. We propose Gate Density to measure the likely occupancy of a circuit when mapping to quantum hardware. The following figure shows the gate density of QASMBench: alt text

Retention Lifespan

Retention Lifespan describes the maximum lifespan of a qubit within a system and is motivated by the T1 and T2 coherence time of a quantum device. A longer lifespan of a quantum system implies more decay to the ground state (T1) and state-transition due to environment noise (T2), thus is more susceptible to information loss. Therefore, we propose taking the qubit with the longest lifespan to determine the system’s retention lifespan. Using this metric, one can estimate if a particular circuit can be executed in a NISQ device with high fidelity, given its T1/T2 coherence time. Note, all IBM-Q machines offer T1/T2 coherence time as status indicators for the hardware. As circuit depth can grow substantially, we introduce the log operator to shrink the scale. The following figure shows the retention lifespan of QASMBench: alt text

Measurement Density

Measurement density assesses the importance of measurements in a circuit. A higher measurement count implies the fact that each measurement might be of relatively less importance (e.g., periodic measurement in QEC, or measurement over ancilla qubits), whereas for applications with fewer measurements, the measurement may be of utmost importance. The importance also increases when a measurement accounts for a wider and/or deeper circuit. A good example is the SWAP test, where the circuit can be very large but only one measurement is taken to report the similarity. Consequently, this measurement is extremely important to the application. Since the circuit depth/width can be large and the importance of measurement decays when the circuit depth/width keeps on increasing, we add a log to shrink the scale. The following figure shows the retention lifespan of QASMBench: alt text

Entanglement Variance

Entanglement Variance measures the balance of entanglement across the qubits of a circuit. Circuits with a higher Entanglement Variance indicate that certain qubits are more connected than other qubits (i.e., using more 2-qubit gates such as CX than others). This metric implies that when the circuit is mapped to a NISQ device: (i) fewer SWAP gates are needed if those hotspot qubits are mapped to the central vertices in the NISQ device topology, such as Qubit-1 in ibmq-belem and Qubit-2 in ibmq-yorkton). A higher entanglement variance implies a higher potential benefit from a good logic-physical qubit-mapping through quantum transpilation. If the entanglement variance is zero, the little benefit should be expected from a better transpilation strategy; (ii) Given 2-qubit gate is one of the major sources introducing error, a higher Entanglement Variance implies uneven error introduction among qubits. The following figure shows the entanglement variance of QASMBench: alt text

OpenQASM

OpenQASM (Open Quantum Assembly Language) is a low-level quantum intermediate representation (IR) for quantum instructions, similar to the traditional Hardware-Description-Language (HDL) like Verilog and VHDL. OpenQASM is the open-source unified low-level assembly language for IBM quantum machines publically available on the cloud that have been investigated and verified by many existing research works. Several popular quantum software frameworks use OpenQASM as one of their output-formats, including Qiskit, Cirq, Scaffold, ProjectQ, etc.

Qiskit

The Quantum Information Software Kit (Qiskit) is a quantum software developed by IBM. It is based on Python. OpenQASM can be generated from Qiskit via:

QuantumCircuit.qasm()

Cirq

Cirq is a quantum software framework from Google. OpenQASM can be generated from Cirq (not fully compatible) via:

cirq.Circuit.to_qasm()

Scaffold

Scaffold is a quantum programming language embedded in the C/C++ programming language based on the LLVM compiler toolchain. A Scaffold program can be compiled by Scaffcc to OpenQASM via "-b" compiler option.

ProjectQ

ProjectQ is a quantum software platform developed by Steiger et al. from ETH Zurich. The official website is here. ProjectQ can generate OpenQASM when using IBM quantum machines as the backends:

IBMBackend.get_qasm()

Authors

Ang Li, Pacific Northwest National Laboratory (PNNL)

Samuel Stein, Pacific Northwest National Laboratory (PNNL)

Sriram Krishnamoorthy, Pacific Northwest National Laboratory (PNNL)

James Ang, Pacific Northwest National Laboratory (PNNL)

And also the original authors that developed these quantum routines.

Citation format

For research articles, please cite our paper:

Bibtex:

@article{li2022qasmbench,
  title={QASMBench: A Low-Level Quantum Benchmark Suite for NISQ Evaluation and Simulation},
  author={Li, Ang and Stein, Samuel and Krishnamoorthy, Sriram, and Ang, James},
  journal={ACM Transactions on Quantum Computing},
  year={2022},
  publisher={ACM New York, NY}
}

License

This project is licensed under the BSD License, see LICENSE file for details.

Acknowledgments

We acknowledge the support from the many developers and the open-source community.

PNNL-IPID: 31924-E, IR: PNNL-SA-153380, PNNL-SA-162867, ECCN:EAR99

This work was supported by the DOE Office of Science National Quantum Information Science Research Centers, Co-design Center for Quantum Advantage (C2QA) under contract number DE-SC0012704. This research used resources from the Oak Ridge Leadership Computing Facility, which is a DOE Office of Science User Facility supported under Contract DE-AC05-00OR22725. This research used resources of the National Energy Research Scientific Computing Center (NERSC), a U.S. Department of Energy Office of Science User Facility located at Lawrence Berkeley National Laboratory, operated under Contract No. DE-AC02-05CH11231 using NERSC award ERCAP0022228.

We also acknowledge support from Microsoft’s Azure Quantum for providing credits and access to the ion-trap quantum hardware used in our evaluation. The Pacific Northwest National Laboratory is operated by Battelle for the U.S. Department of Energy under contract DE-AC05-76RL01830.

Contributing

Please contact us If you'd like to add your circuits to the benchmark suite or if you'd like to remove your circuits from the suite.