From e4d2e8f13cef45ee5dbad1efde122801a9917178 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Fri, 1 Mar 2019 08:13:54 -0500 Subject: [PATCH 01/61] Add asv benchmarks (Qiskit/qiskit-metapackage#30) * Add asv benchmarks This commit adds an asv benchmark suite to the tests include in this repo. This will enable us to track the performance of the overall qiskit project over time as we make commits. * Remove H2 and LiH dirs * Fix most, but not all, lint * Remove commented unused code * Add QV circuit benchmark and fix asv build and some lint * Make lint pass * Purity isn't in quantum_info in 0.7 * Add qft and random circuit benchmarks * Fix issue caused by namespace package and aer sticking around * Make depth an independent variable for qv benchmarks * Simplify install and uninstall stage The install stage was going off the rails trying failing to install the built wheel in certain scenarios. When this happened the empty namespace package from qiskit-aer was leftover and when benchmarks ran there was nothing leftover. To avoid this and simplify the install (and by extension uninstall) configuration to just rely on the default working behavior this commit removes the dependence on the qiskit-aer package. The aer package wasn't even used directly in the benchmarks since we're not actually running simulations (for obvious time reasons). Instead Aer was just being used as a backend for the transpiler. But, there is no reason we have to use Aer for that, and BasicAer works just as well. * Clear build artifacts before install * Fix lint failures for new pylint * Switch back to pip for wheel builds * Fix another lint issue * Fix hopefully the last lint issue --- test/benchmarks/__init__.py | 0 test/benchmarks/qasm/__init__.py | 0 test/benchmarks/qasm/pea_3_pi_8.qasm | 51 + test/benchmarks/qasm/test_eoh_qasm.qasm | 3509 ++++++++++++++++++++++ test/benchmarks/qft.py | 52 + test/benchmarks/quantum_volume.py | 96 + test/benchmarks/random_circuit_hex.py | 75 + test/benchmarks/state_tomography.py | 181 ++ test/benchmarks/transpiler_benchmarks.py | 103 + 9 files changed, 4067 insertions(+) create mode 100644 test/benchmarks/__init__.py create mode 100644 test/benchmarks/qasm/__init__.py create mode 100644 test/benchmarks/qasm/pea_3_pi_8.qasm create mode 100644 test/benchmarks/qasm/test_eoh_qasm.qasm create mode 100644 test/benchmarks/qft.py create mode 100644 test/benchmarks/quantum_volume.py create mode 100644 test/benchmarks/random_circuit_hex.py create mode 100644 test/benchmarks/state_tomography.py create mode 100644 test/benchmarks/transpiler_benchmarks.py diff --git a/test/benchmarks/__init__.py b/test/benchmarks/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/test/benchmarks/qasm/__init__.py b/test/benchmarks/qasm/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/test/benchmarks/qasm/pea_3_pi_8.qasm b/test/benchmarks/qasm/pea_3_pi_8.qasm new file mode 100644 index 000000000000..c9953bf91d98 --- /dev/null +++ b/test/benchmarks/qasm/pea_3_pi_8.qasm @@ -0,0 +1,51 @@ +// Name of Experiment: pea_3*pi/8 v3 + +OPENQASM 2.0; +include "qelib1.inc"; + + +qreg q[5]; +creg c[4]; +gate cu1fixed (a) c,t { +u1 (-a) t; +cx c,t; +u1 (a) t; +cx c,t; +} +gate cu c,t { +cu1fixed (3*pi/8) c,t; +} + +h q[0]; +h q[1]; +h q[2]; +h q[3]; +cu q[3],q[4]; +cu q[2],q[4]; +cu q[2],q[4]; +cu q[1],q[4]; +cu q[1],q[4]; +cu q[1],q[4]; +cu q[1],q[4]; +cu q[0],q[4]; +cu q[0],q[4]; +cu q[0],q[4]; +cu q[0],q[4]; +cu q[0],q[4]; +cu q[0],q[4]; +cu q[0],q[4]; +cu q[0],q[4]; +h q[0]; +cu1(-pi/2) q[0],q[1]; +h q[1]; +cu1(-pi/4) q[0],q[2]; +cu1(-pi/2) q[1],q[2]; +h q[2]; +cu1(-pi/8) q[0],q[3]; +cu1(-pi/4) q[1],q[3]; +cu1(-pi/2) q[2],q[3]; +h q[3]; +measure q[0] -> c[0]; +measure q[1] -> c[1]; +measure q[2] -> c[2]; +measure q[3] -> c[3]; diff --git a/test/benchmarks/qasm/test_eoh_qasm.qasm b/test/benchmarks/qasm/test_eoh_qasm.qasm new file mode 100644 index 000000000000..d0bd6728bc60 --- /dev/null +++ b/test/benchmarks/qasm/test_eoh_qasm.qasm @@ -0,0 +1,3509 @@ +OPENQASM 2.0; +include "qelib1.inc"; +qreg q[2]; +u3(1.81601579278081,0,0) q[1]; +cx q[1],q[0]; +u3(0.282876323465342,0,0) q[0]; +cx q[1],q[0]; +u3(1.79619280826017,0,0) q[0]; + +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.000724567026336298) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +cx q[0],q[1]; +u1(0.00679198609867374) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u1(-0.00550515131412464) q[1]; +u3(pi/2,-pi/2,pi/2) q[0]; +u3(pi/2,-pi/2,pi/2) q[1]; +cx q[0],q[1]; +u1(0.00446908620956922) q[1]; +cx q[0],q[1]; +u3(-pi/2,-pi/2,pi/2) q[0]; +u3(-pi/2,-pi/2,pi/2) q[1]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(-0.00767779564284270) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +cx q[0],q[1]; +u1(0.0234616911265225) q[1]; +cx q[0],q[1]; +u2(0.0,pi) q[0]; +u2(0.0,pi) q[1]; +u2(0.0,pi) q[1]; +u1(0.0114893260817785) q[1]; +u2(0.0,pi) q[1]; +u1(0.00893526017156342) q[0]; +u2(0.0,pi) q[0]; +u1(0.0168841346050307) q[0]; +u2(0.0,pi) q[0]; \ No newline at end of file diff --git a/test/benchmarks/qft.py b/test/benchmarks/qft.py new file mode 100644 index 000000000000..ab1ced3c7a1c --- /dev/null +++ b/test/benchmarks/qft.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -* + +# Copyright 2019, IBM. +# +# This source code is licensed under the Apache License, Version 2.0 found in +# the LICENSE.txt file in the root directory of this source tree. + +# pylint: disable=missing-docstring,invalid-name,no-member +# pylint: disable=attribute-defined-outside-init + +import math + +from qiskit import QuantumRegister, QuantumCircuit +from qiskit import BasicAer +from qiskit import transpiler + + +def build_model_circuit(qreg, circuit=None): + """Create quantum fourier transform circuit on quantum register qreg.""" + if circuit is None: + circuit = QuantumCircuit(qreg, name="qft") + + n = len(qreg) + + for i in range(n): + for j in range(i): + circuit.cu1(math.pi/float(2**(i-j)), qreg[i], qreg[j]) + circuit.h(qreg[i]) + + return circuit + + +class QftTranspileBench: + params = [1, 2, 3, 5, 8, 13, 14] + + def setup(self, n): + qr = QuantumRegister(n) + self.circuit = build_model_circuit(qr) + self.sim_backend = BasicAer.get_backend('qasm_simulator') + + def time_simulator_transpile(self, _): + transpiler.transpile(self.circuit, self.sim_backend) + + def time_ibmq_backend_transpile(self, _): + # Run with ibmq_16_melbourne configuration + coupling_map = [[1, 0], [1, 2], [2, 3], [4, 3], [4, 10], [5, 4], + [5, 6], [5, 9], [6, 8], [7, 8], [9, 8], [9, 10], + [11, 3], [11, 10], [11, 12], [12, 2], [13, 1], + [13, 12]] + transpiler.transpile(self.circuit, + basis_gates=['u1', 'u2', 'u3', 'cx', 'id'], + coupling_map=coupling_map) diff --git a/test/benchmarks/quantum_volume.py b/test/benchmarks/quantum_volume.py new file mode 100644 index 000000000000..aec2831dee19 --- /dev/null +++ b/test/benchmarks/quantum_volume.py @@ -0,0 +1,96 @@ +# -*- coding: utf-8 -*- + +# Copyright 2018 IBM RESEARCH. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================= + +# pylint: disable=no-member,invalid-name,missing-docstring +# pylint: disable=attribute-defined-outside-init,unsubscriptable-object + +"""Module for estimating quantum volume. +See arXiv:1811.12926 [quant-ph]""" + +import numpy as np + +from qiskit import QuantumCircuit, QuantumRegister +from qiskit.tools.qi.qi import random_unitary_matrix +from qiskit.mapper import two_qubit_kak +from qiskit import BasicAer +from qiskit import transpiler + + +def build_model_circuit(qreg, depth=None, seed=None): + """Create quantum volume model circuit on quantum register qreg of given + depth (default depth is equal to width) and random seed. + The model circuits consist of layers of Haar random + elements of U(4) applied between corresponding pairs + of qubits in a random bipartition. + """ + width = len(qreg) + depth = depth or width + + np.random.seed(seed) + circuit = QuantumCircuit( + qreg, name="Qvolume: %s by %s, seed: %s" % (width, depth, seed)) + + for _ in range(depth): + # Generate uniformly random permutation Pj of [0...n-1] + perm = np.random.permutation(width) + + # For each pair p in Pj, generate Haar random U(4) + # Decompose each U(4) into CNOT + SU(2) + for k in range(width // 2): + U = random_unitary_matrix(4) + for gate in two_qubit_kak(U): + qs = [qreg[int(perm[2 * k + i])] for i in gate["args"]] + pars = gate["params"] + name = gate["name"] + if name == "cx": + circuit.cx(qs[0], qs[1]) + elif name == "u1": + circuit.u1(pars[0], qs[0]) + elif name == "u2": + circuit.u2(*pars[:2], qs[0]) + elif name == "u3": + circuit.u3(*pars[:3], qs[0]) + elif name == "id": + pass # do nothing + else: + raise Exception("Unexpected gate name: %s" % name) + return circuit + + +class QuantumVolumeBenchmark: + params = ([1, 2, 3, 5, 8, 13, 14], [1, 2, 3, 5, 8, 13, 21, 34]) + param_names = ['qubits', 'depth'] + timeout = 600 + + def setup(self, n, depth): + random_seed = np.random.seed(10) + qreg = QuantumRegister(n) + self.circuit = build_model_circuit(qreg, depth=depth, seed=random_seed) + self.sim_backend = BasicAer.get_backend('qasm_simulator') + + def time_simulator_transpile(self, _, __): + transpiler.transpile(self.circuit, self.sim_backend) + + def time_ibmq_backend_transpile(self, _, __): + # Run with ibmq_16_melbourne configuration + coupling_map = [[1, 0], [1, 2], [2, 3], [4, 3], [4, 10], [5, 4], + [5, 6], [5, 9], [6, 8], [7, 8], [9, 8], [9, 10], + [11, 3], [11, 10], [11, 12], [12, 2], [13, 1], + [13, 12]] + transpiler.transpile(self.circuit, + basis_gates=['u1', 'u2', 'u3', 'cx', 'id'], + coupling_map=coupling_map) diff --git a/test/benchmarks/random_circuit_hex.py b/test/benchmarks/random_circuit_hex.py new file mode 100644 index 000000000000..c5a58dc0efd0 --- /dev/null +++ b/test/benchmarks/random_circuit_hex.py @@ -0,0 +1,75 @@ +# -*- coding: utf-8 -*- + +# Copyright 2019, IBM. +# +# This source code is licensed under the Apache License, Version 2.0 found in +# the LICENSE.txt file in the root directory of this source tree. + +# pylint: disable=missing-docstring,invalid-name,no-member +# pylint: disable=attribute-defined-outside-init + +import copy + +import numpy as np + +try: + from qiskit.mapper import _compiling as compiling +except ImportError: + from qiskit.mapper import compiling +from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister +from qiskit import BasicAer +from qiskit import transpiler +import qiskit.tools.qi.qi as qi + + +# Make a random circuit on a ring +def make_circuit_ring(nq, depth, seed): + assert int(nq / 2) == nq / 2 # for now size of ring must be even + np.random.seed(seed) + # Create a Quantum Register + q = QuantumRegister(nq) + # Create a Classical Register + c = ClassicalRegister(nq) + # Create a Quantum Circuit + qc = QuantumCircuit(q, c) + offset = np.random.randint(2) + # initial round of random single-qubit unitaries + for i in range(nq): + qc.h(q[i]) + for j in range(depth): + for i in range(int(nq / 2)): # round of CNOTS + k = i * 2 + offset + j % 2 # j%2 makes alternating rounds overlap + qc.cx(q[k % nq], q[(k + 1) % nq]) + for i in range(nq): # round of single-qubit unitaries + u = qi.random_unitary_matrix(2) + angles = compiling.euler_angles_1q(u) + qc.u3(angles[0], angles[1], angles[2], q[i]) + + # insert the final measurements + qcm = copy.deepcopy(qc) + for i in range(nq): + qcm.measure(q[i], c[i]) + return [qc, qcm, nq] + + +class BenchRandomCircuitHex: + params = [2 * i for i in range(2, 8)] + + def setup(self, n): + depth = 2 * n + seed = 5 + self.circuit = make_circuit_ring(n, depth, seed)[0] + self.sim_backend = BasicAer.get_backend('qasm_simulator') + + def time_simulator_transpile(self, _): + transpiler.transpile(self.circuit, self.sim_backend) + + def time_ibmq_backend_transpile(self, _): + # Run with ibmq_16_melbourne configuration + coupling_map = [[1, 0], [1, 2], [2, 3], [4, 3], [4, 10], [5, 4], + [5, 6], [5, 9], [6, 8], [7, 8], [9, 8], [9, 10], + [11, 3], [11, 10], [11, 12], [12, 2], [13, 1], + [13, 12]] + transpiler.transpile(self.circuit, + basis_gates=['u1', 'u2', 'u3', 'cx', 'id'], + coupling_map=coupling_map) diff --git a/test/benchmarks/state_tomography.py b/test/benchmarks/state_tomography.py new file mode 100644 index 000000000000..6e47b86f2f0a --- /dev/null +++ b/test/benchmarks/state_tomography.py @@ -0,0 +1,181 @@ +# -*- coding: utf-8 -*- + +# Copyright 2017, IBM. +# +# This source code is licensed under the Apache License, Version 2.0 found in +# the LICENSE.txt file in the root directory of this source tree. + +# pylint: disable=missing-docstring,invalid-name,no-member,broad-except +# pylint: disable=no-else-return + +""" +Quantum State Tomography. +Generates many small circuits, thus good for profiling compiler overhead. +Number of circuits grows like 3^n_qubits +""" + +import numpy as np + +import qiskit +# import tomography libary and other useful tools +import qiskit.tools.qcvv.tomography as tomo +from qiskit.quantum_info import state_fidelity +from qiskit.tools.qi.qi import random_unitary_matrix, purity + + +class StateTomographyBench: + params = [2, 3, 4, 5] + timeout = 360.0 + use_quantum_program = False + + def setup(self, _): + if hasattr(qiskit, 'QuantumProgram'): + self.use_quantum_program = True + else: + self.use_quantum_program = False + + # circuit that outputs the target state + def target_prep(self, state, target, n_qubits, qp=None): + if not self.use_quantum_program: + # quantum circuit to make an entangled cat state + if state == 'cat': + n_qubits = int(np.log2(target.size)) + qr = qiskit.QuantumRegister(n_qubits, 'qr') + cr = qiskit.ClassicalRegister(n_qubits, 'cr') + circ = qiskit.QuantumCircuit(qr, cr, name='cat') + circ.h(qr[0]) + for i in range(1, n_qubits): + circ.cx(qr[0], qr[i]) + # quantum circuit to prepare arbitrary given state + elif state == 'random': + n_qubits = int(np.log2(target.size)) + qr = qiskit.QuantumRegister(n_qubits, 'qr') + cr = qiskit.ClassicalRegister(n_qubits, 'cr') + circ = qiskit.QuantumCircuit(qr, cr, name='random') + circ.initialize(target, [qr[i] for i in range(n_qubits)]) + return circ + else: + if state == 'cat': + n_qubits = int(np.log2(target.size)) + qr = qp.create_quantum_register('qr', n_qubits) + cr = qp.create_classical_register('cr', n_qubits) + cat = qp.create_circuit('prep', [qr], [cr]) + cat.h(qr[0]) + for i in range(1, n_qubits): + cat.cx(qr[0], qr[i]) + # quantum circuit to prepare arbitrary given state + elif state == 'random': + n_qubits = int(np.log2(target.size)) + qr = qp.create_quantum_register('qr', n_qubits) + cr = qp.create_classical_register('cr', n_qubits) + random = qp.create_circuit('prep', [qr], [cr]) + try: + random.initialize( + "Qinit", target, [qr[i] for i in range(n_qubits)]) + except Exception: + random.initialize( + target, [qr[i] for i in range(n_qubits)]) + return qp + + # add basis measurements to the circuit for tomography + # XX..X, XX..Y, .., ZZ..Z + def add_tomo_circuits(self, circ): + if not self.use_quantum_program: + # Construct state tomography set for measurement of qubits in the + # register + qr = next(iter(circ.qregs)) + cr = next(iter(circ.cregs)) + tomo_set = tomo.state_tomography_set(list(range(qr.size))) + # Add the state tomography measurement circuits + tomo_circuits = tomo.create_tomography_circuits( + circ, qr, cr, tomo_set) + return tomo_set, tomo_circuits + if self.use_quantum_program: + # Construct state tomography set for measurement of qubits in the + # register + qr_name = list(circ.get_quantum_register_names())[0] + cr_name = list(circ.get_classical_register_names())[0] + qr = circ.get_quantum_register(qr_name) + cr = circ.get_classical_register(cr_name) + tomo_set = tomo.state_tomography_set(list(range(qr.size))) + # Add the state tomography measurement circuits to the Quantum + # Program + tomo_circuits = tomo.create_tomography_circuits( + circ, qr, cr, tomo_set) + return circ, tomo_set, tomo_circuits + raise Exception + + def time_state_tomography_cat(self, n_qubits): + # cat target state: [1. 0. 0. ... 0. 0. 1.]/sqrt(2.) + target = np.zeros(pow(2, n_qubits)) + target[0] = 1 + target[pow(2, n_qubits)-1] = 1.0 + target /= np.sqrt(2.0) + if not self.use_quantum_program: + self._state_tomography(target, 'cat', n_qubits) + else: + self._state_tomography_quantum_program(target, 'cat', n_qubits) + + def time_state_tomography_random(self, n_qubits): + # random target state: first column of a random unitary + target = random_unitary_matrix(pow(2, n_qubits))[0] + if not self.use_quantum_program: + self._state_tomography(target, 'random', n_qubits) + else: + self._state_tomography_quantum_program(target, 'random', n_qubits) + + def _state_tomography_quantum_program(self, target, state, n_qubits, + shots=1): + qp = qiskit.QuantumProgram() + try: + backend = 'local_qiskit_simulator' + qp.get_backend_configuration(backend) + except LookupError: + backend = 'local_qasm_simulator' + + # Prepared target state and assess quality + qp = self.target_prep(state, target, n_qubits, qp=qp) + prep_result = qp.execute(['prep'], + backend=backend, shots=1) + prep_state = prep_result.get_data('prep')['quantum_state'] + F_prep = state_fidelity(prep_state, target) + print('Prepared state fidelity =', F_prep) + + # Run state tomography simulation and fit data to reconstruct circuit + qp, tomo_set, tomo_circuits = self.add_tomo_circuits(qp) + tomo_result = qp.execute(tomo_circuits, backend=backend, shots=shots) + tomo_data = tomo.tomography_data(tomo_result, 'prep', tomo_set) + rho_fit = tomo.fit_tomography_data(tomo_data) + + # calculate fidelity and purity of fitted state + F_fit = state_fidelity(rho_fit, target) + pur = purity(rho_fit) + print('Fitted state fidelity =', F_fit) + print('Fitted state purity =', str(pur)) + + # perform quantum state tomography and assess quality of reconstructed + # vector + def _state_tomography(self, target, state, n_qubits, shots=1): + # Use the local qasm simulator + backend = qiskit.BasicAer.get_backend('statevector_simulator') + + # Prepared target state and assess quality + prep_circ = self.target_prep(state, target, n_qubits) + prep_result = qiskit.execute( + prep_circ, backend=backend).result() + prep_state = prep_result.get_statevector(prep_circ) + F_prep = state_fidelity(prep_state, target) + print('Prepared state fidelity =', F_prep) + + # Run state tomography simulation and fit data to reconstruct circuit + tomo_set, tomo_circuits = self.add_tomo_circuits(prep_circ) + tomo_result = qiskit.execute( + tomo_circuits, backend=backend, shots=shots).result() + tomo_data = tomo.tomography_data(tomo_result, prep_circ.name, tomo_set) + rho_fit = tomo.fit_tomography_data(tomo_data) + + # calculate fidelity and purity of fitted state + F_fit = state_fidelity(rho_fit, target) + pur = purity(rho_fit) + print('Fitted state fidelity =', F_fit) + print('Fitted state purity =', str(pur)) diff --git a/test/benchmarks/transpiler_benchmarks.py b/test/benchmarks/transpiler_benchmarks.py new file mode 100644 index 000000000000..f6bdea4c63ee --- /dev/null +++ b/test/benchmarks/transpiler_benchmarks.py @@ -0,0 +1,103 @@ +# -*- coding: utf-8 -* + +# Copyright 2018, IBM. +# +# This source code is licensed under the Apache License, Version 2.0 found in +# the LICENSE.txt file in the root directory of this source tree. + +# pylint: disable=missing-docstring,invalid-name,no-member +# pylint: disable=attribute-defined-outside-init + +import os + +import qiskit + + +class TranspilerBenchSuite: + + def _build_cx_circuit(self): + if self.local_qasm_simulator is None: + qp = qiskit.QuantumProgram() + cx_register = qp.create_quantum_register('qr', 2) + cx_circuit = qp.create_circuit("cx_circuit", [cx_register]) + cx_circuit.h(cx_register[0]) + cx_circuit.h(cx_register[0]) + cx_circuit.cx(cx_register[0], cx_register[1]) + cx_circuit.cx(cx_register[0], cx_register[1]) + cx_circuit.cx(cx_register[0], cx_register[1]) + cx_circuit.cx(cx_register[0], cx_register[1]) + return qp + if self.local_qasm_simulator is not None: + cx_register = qiskit.QuantumRegister(2) + cx_circuit = qiskit.QuantumCircuit(cx_register) + cx_circuit.h(cx_register[0]) + cx_circuit.h(cx_register[0]) + cx_circuit.cx(cx_register[0], cx_register[1]) + cx_circuit.cx(cx_register[0], cx_register[1]) + cx_circuit.cx(cx_register[0], cx_register[1]) + cx_circuit.cx(cx_register[0], cx_register[1]) + return cx_circuit + return None + + def _build_single_gate_circuit(self): + if self.local_qasm_simulator is None: + qp = qiskit.QuantumProgram() + single_register = qp.create_quantum_register('qr', 1) + single_gate_circuit = qp.create_circuit('single_gate', + [single_register]) + single_gate_circuit.h(single_register[0]) + return qp + if self.local_qasm_simulator is not None: + single_register = qiskit.QuantumRegister(1) + single_gate_circuit = qiskit.QuantumCircuit(single_register) + single_gate_circuit.h(single_register[0]) + return single_gate_circuit + return None + + def setup(self): + version_parts = qiskit.__version__.split('.') + + if version_parts[0] == '0' and int(version_parts[1]) < 5: + self.local_qasm_simulator = None + elif hasattr(qiskit, 'BasicAer'): + self.local_qasm_simulator = qiskit.BasicAer.get_backend( + 'qasm_simulator') + elif hasattr(qiskit, 'get_backend'): + self.local_qasm_simulator = qiskit.get_backend( + 'local_qasm_simulator') + else: + self.local_qasm_simulator = qiskit.BasicAer.get_backend( + "qasm_simulator") + self.single_gate_circuit = self._build_single_gate_circuit() + self.cx_circuit = self._build_cx_circuit() + self.qasm_path = os.path.abspath( + os.path.join(os.path.dirname(__file__), 'qasm')) + large_qasm_path = os.path.join(self.qasm_path, 'test_eoh_qasm.qasm') + + if hasattr(qiskit, 'load_qasm_file'): + self.large_qasm = qiskit.load_qasm_file(large_qasm_path) + elif version_parts[0] == '0' and int(version_parts[1]) < 5: + self.large_qasm = qiskit.QuantumProgram() + self.large_qasm.load_qasm_file(large_qasm_path, + name='large_qasm') + else: + self.large_qasm = qiskit.QuantumCircuit.from_qasm_file( + large_qasm_path) + + def time_single_gate_transpile(self): + if self.local_qasm_simulator is None: + self.single_gate_circuit.compile('single_gate') + else: + qiskit.compile(self.single_gate_circuit, self.local_qasm_simulator) + + def time_cx_transpile(self): + if self.local_qasm_simulator is None: + self.cx_circuit.compile('cx_circuit') + else: + qiskit.compile(self.cx_circuit, self.local_qasm_simulator) + + def time_transpile_from_large_qasm(self): + if self.local_qasm_simulator is None: + self.large_qasm.compile('large_qasm') + else: + qiskit.compile(self.large_qasm, self.local_qasm_simulator) From 6bc648ea3ca0ab8ef64eea52b8c981a7c1aa83db Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Sun, 21 Apr 2019 21:41:22 -0400 Subject: [PATCH 02/61] Add depth tracking to random hex circuit benchmarks (Qiskit/qiskit-metapackage#201) This commit adds 2 new benchmarks that use the same random hex circuit setup but instead of measuring the time it takes to transpile() it tracks the depth of the output circuit. This will serve as an example for how we can track other transpiler performance metrics over time in terra (not just depth). --- test/benchmarks/random_circuit_hex.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/benchmarks/random_circuit_hex.py b/test/benchmarks/random_circuit_hex.py index c5a58dc0efd0..c8bf577ef46c 100644 --- a/test/benchmarks/random_circuit_hex.py +++ b/test/benchmarks/random_circuit_hex.py @@ -64,6 +64,9 @@ def setup(self, n): def time_simulator_transpile(self, _): transpiler.transpile(self.circuit, self.sim_backend) + def track_depth_simulator_transpile(self, _): + return transpiler.transpile(self.circuit, self.sim_backend).depth() + def time_ibmq_backend_transpile(self, _): # Run with ibmq_16_melbourne configuration coupling_map = [[1, 0], [1, 2], [2, 3], [4, 3], [4, 10], [5, 4], @@ -73,3 +76,13 @@ def time_ibmq_backend_transpile(self, _): transpiler.transpile(self.circuit, basis_gates=['u1', 'u2', 'u3', 'cx', 'id'], coupling_map=coupling_map) + + def track_depth_ibmq_backend_transpile(self, _): + # Run with ibmq_16_melbourne configuration + coupling_map = [[1, 0], [1, 2], [2, 3], [4, 3], [4, 10], [5, 4], + [5, 6], [5, 9], [6, 8], [7, 8], [9, 8], [9, 10], + [11, 3], [11, 10], [11, 12], [12, 2], [13, 1], + [13, 12]] + return transpiler.transpile(self.circuit, + basis_gates=['u1', 'u2', 'u3', 'cx', 'id'], + coupling_map=coupling_map).depth() From 045a6f4f66d5a49b0dd1dc392ba85553b4c81f2d Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Tue, 23 Apr 2019 12:57:45 -0400 Subject: [PATCH 03/61] Remove randomness from random_hex_circuit_benchmark (Qiskit/qiskit-metapackage#204) * Remove randomness from random_hex_circuit_benchmark The random_hex benchmark had one np.random.randomint() call that was used to determine if the cnots in the circuit were for odd or even numbered qubits. While not a big difference (and difficult to detect by visual inspection) we want to eliminate any difference between runs for benchmarking. These subtle differences can make the results unusable and anomaly detection more difficult. To that end this commit just sets the random value to be fixed so the generated circuit will always be the same. Since this changes the results the version for the benchmark is changed so that we'll treat new results different from the previous results with the random number. * Fix lint --- test/benchmarks/random_circuit_hex.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/test/benchmarks/random_circuit_hex.py b/test/benchmarks/random_circuit_hex.py index c8bf577ef46c..aea31c9c6a6f 100644 --- a/test/benchmarks/random_circuit_hex.py +++ b/test/benchmarks/random_circuit_hex.py @@ -10,8 +10,6 @@ import copy -import numpy as np - try: from qiskit.mapper import _compiling as compiling except ImportError: @@ -23,16 +21,15 @@ # Make a random circuit on a ring -def make_circuit_ring(nq, depth, seed): +def make_circuit_ring(nq, depth): assert int(nq / 2) == nq / 2 # for now size of ring must be even - np.random.seed(seed) # Create a Quantum Register q = QuantumRegister(nq) # Create a Classical Register c = ClassicalRegister(nq) # Create a Quantum Circuit qc = QuantumCircuit(q, c) - offset = np.random.randint(2) + offset = 1 # initial round of random single-qubit unitaries for i in range(nq): qc.h(q[i]) @@ -54,11 +51,12 @@ def make_circuit_ring(nq, depth, seed): class BenchRandomCircuitHex: params = [2 * i for i in range(2, 8)] + param_names = ['n_qubits'] + version = 2 def setup(self, n): depth = 2 * n - seed = 5 - self.circuit = make_circuit_ring(n, depth, seed)[0] + self.circuit = make_circuit_ring(n, depth)[0] self.sim_backend = BasicAer.get_backend('qasm_simulator') def time_simulator_transpile(self, _): From 692006cfd2631b94fd419313a085f9b18f001a32 Mon Sep 17 00:00:00 2001 From: Paul Nation Date: Tue, 30 Apr 2019 11:47:51 -0400 Subject: [PATCH 04/61] Update Copyrights (Qiskit/qiskit-metapackage#215) --- test/benchmarks/qft.py | 13 ++++++++++--- test/benchmarks/random_circuit_hex.py | 13 ++++++++++--- test/benchmarks/transpiler_benchmarks.py | 13 ++++++++++--- 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/test/benchmarks/qft.py b/test/benchmarks/qft.py index ab1ced3c7a1c..c7f1b91defe6 100644 --- a/test/benchmarks/qft.py +++ b/test/benchmarks/qft.py @@ -1,9 +1,16 @@ # -*- coding: utf-8 -* -# Copyright 2019, IBM. +# This code is part of Qiskit. # -# This source code is licensed under the Apache License, Version 2.0 found in -# the LICENSE.txt file in the root directory of this source tree. +# (C) Copyright IBM 2018, 2019. +# +# This code is licensed under the Apache License, Version 2.0. You may +# obtain a copy of this license in the LICENSE.txt file in the root directory +# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. +# +# Any modifications or derivative works of this code must retain this +# copyright notice, and modified files need to carry a notice indicating +# that they have been altered from the originals. # pylint: disable=missing-docstring,invalid-name,no-member # pylint: disable=attribute-defined-outside-init diff --git a/test/benchmarks/random_circuit_hex.py b/test/benchmarks/random_circuit_hex.py index aea31c9c6a6f..7efc5b97d95f 100644 --- a/test/benchmarks/random_circuit_hex.py +++ b/test/benchmarks/random_circuit_hex.py @@ -1,9 +1,16 @@ # -*- coding: utf-8 -*- -# Copyright 2019, IBM. +# This code is part of Qiskit. # -# This source code is licensed under the Apache License, Version 2.0 found in -# the LICENSE.txt file in the root directory of this source tree. +# (C) Copyright IBM 2018, 2019. +# +# This code is licensed under the Apache License, Version 2.0. You may +# obtain a copy of this license in the LICENSE.txt file in the root directory +# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. +# +# Any modifications or derivative works of this code must retain this +# copyright notice, and modified files need to carry a notice indicating +# that they have been altered from the originals. # pylint: disable=missing-docstring,invalid-name,no-member # pylint: disable=attribute-defined-outside-init diff --git a/test/benchmarks/transpiler_benchmarks.py b/test/benchmarks/transpiler_benchmarks.py index f6bdea4c63ee..0283ab9e2301 100644 --- a/test/benchmarks/transpiler_benchmarks.py +++ b/test/benchmarks/transpiler_benchmarks.py @@ -1,9 +1,16 @@ # -*- coding: utf-8 -* -# Copyright 2018, IBM. +# This code is part of Qiskit. # -# This source code is licensed under the Apache License, Version 2.0 found in -# the LICENSE.txt file in the root directory of this source tree. +# (C) Copyright IBM 2018. +# +# This code is licensed under the Apache License, Version 2.0. You may +# obtain a copy of this license in the LICENSE.txt file in the root directory +# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. +# +# Any modifications or derivative works of this code must retain this +# copyright notice, and modified files need to carry a notice indicating +# that they have been altered from the originals. # pylint: disable=missing-docstring,invalid-name,no-member # pylint: disable=attribute-defined-outside-init From fd5aa1b4c8bc3cb7f18cf5dbec572695d1ae2003 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Thu, 2 May 2019 21:59:41 -0400 Subject: [PATCH 05/61] Bump released package versions and set meta package version to 0.9.0 (Qiskit/qiskit-metapackage#227) * Bump released package versions and set meta package version to 0.9.0 This commit bumps the version numbers for the newly released versions of terra, aer, and ignis. It also bumps the version of the package to reflect this change per the versioning policy. * Ibmq provider too * Fix lint until test update --- test/benchmarks/quantum_volume.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/benchmarks/quantum_volume.py b/test/benchmarks/quantum_volume.py index aec2831dee19..3f2c7c755db2 100644 --- a/test/benchmarks/quantum_volume.py +++ b/test/benchmarks/quantum_volume.py @@ -15,7 +15,7 @@ # limitations under the License. # ============================================================================= -# pylint: disable=no-member,invalid-name,missing-docstring +# pylint: disable=no-member,invalid-name,missing-docstring,no-name-in-module # pylint: disable=attribute-defined-outside-init,unsubscriptable-object """Module for estimating quantum volume. From 7bec877de937b6ecb03b08a0e3457f47a7bf85f9 Mon Sep 17 00:00:00 2001 From: Ali Javadi-Abhari Date: Fri, 24 May 2019 10:39:26 -0400 Subject: [PATCH 06/61] Update all benchmarks to work on Terra Master (Qiskit/qiskit-metapackage#276) This PR updates all the benchmarks to work again with recent API changes made on Terra master. These were all things coming, but were neglected until the entire benchmark suite was broken. Once this lands we should continue getting published data from the periodic benchmark runs from the point in the git history when the breaking changes in terra landed. Co-Authored-By: Matthew Treinish --- test/benchmarks/qft.py | 13 ++-- test/benchmarks/quantum_volume.py | 80 ++++++++++++++++++------ test/benchmarks/random_circuit_hex.py | 26 +++++--- test/benchmarks/state_tomography.py | 8 ++- test/benchmarks/transpiler_benchmarks.py | 25 +++++++- 5 files changed, 113 insertions(+), 39 deletions(-) diff --git a/test/benchmarks/qft.py b/test/benchmarks/qft.py index c7f1b91defe6..413e1ee4b0d8 100644 --- a/test/benchmarks/qft.py +++ b/test/benchmarks/qft.py @@ -19,7 +19,10 @@ from qiskit import QuantumRegister, QuantumCircuit from qiskit import BasicAer -from qiskit import transpiler +try: + from qiskit.compiler import transpile +except ImportError: + from qiskit.transpiler import transpile def build_model_circuit(qreg, circuit=None): @@ -46,7 +49,7 @@ def setup(self, n): self.sim_backend = BasicAer.get_backend('qasm_simulator') def time_simulator_transpile(self, _): - transpiler.transpile(self.circuit, self.sim_backend) + transpile(self.circuit, self.sim_backend) def time_ibmq_backend_transpile(self, _): # Run with ibmq_16_melbourne configuration @@ -54,6 +57,6 @@ def time_ibmq_backend_transpile(self, _): [5, 6], [5, 9], [6, 8], [7, 8], [9, 8], [9, 10], [11, 3], [11, 10], [11, 12], [12, 2], [13, 1], [13, 12]] - transpiler.transpile(self.circuit, - basis_gates=['u1', 'u2', 'u3', 'cx', 'id'], - coupling_map=coupling_map) + transpile(self.circuit, + basis_gates=['u1', 'u2', 'u3', 'cx', 'id'], + coupling_map=coupling_map) diff --git a/test/benchmarks/quantum_volume.py b/test/benchmarks/quantum_volume.py index 3f2c7c755db2..7fb735b9c094 100644 --- a/test/benchmarks/quantum_volume.py +++ b/test/benchmarks/quantum_volume.py @@ -23,21 +23,59 @@ import numpy as np -from qiskit import QuantumCircuit, QuantumRegister -from qiskit.tools.qi.qi import random_unitary_matrix -from qiskit.mapper import two_qubit_kak -from qiskit import BasicAer -from qiskit import transpiler +from qiskit.providers.basicaer import QasmSimulatorPy +from qiskit.test.mock import FakeMelbourne +try: + from qiskit.mapper import two_qubit_kak + NO_KAK = False +except ImportError: + NO_KAK = True -def build_model_circuit(qreg, depth=None, seed=None): +try: + from qiskit.circuit import QuantumCircuit, QuantumRegister +except ImportError: + from qiskit import QuantumCircuit, QuantumRegister + +try: + from qiskit.compiler import transpile +except ImportError: + from qiskit.transpiler import transpile + +if NO_KAK: + from qiskit.quantum_info.random import random_unitary +else: + from qiskit.tools.qi.qi import random_unitary_matrix + + +def build_model_circuit(width, depth, seed=None): + """ + The model circuits consist of layers of Haar random + elements of SU(4) applied between corresponding pairs + of qubits in a random bipartition. + """ + np.random.seed(seed) + circuit = QuantumCircuit(width) + # For each layer + for _ in range(depth): + # Generate uniformly random permutation Pj of [0...n-1] + perm = np.random.permutation(width) + # For each pair p in Pj, generate Haar random SU(4) + for k in range(int(np.floor(width/2))): + U = random_unitary(4) + pair = int(perm[2*k]), int(perm[2*k+1]) + circuit.append(U, [pair[0], pair[1]]) + return circuit + + +def build_model_circuit_kak(width, depth, seed=None): """Create quantum volume model circuit on quantum register qreg of given depth (default depth is equal to width) and random seed. The model circuits consist of layers of Haar random elements of U(4) applied between corresponding pairs of qubits in a random bipartition. """ - width = len(qreg) + qreg = QuantumRegister(width) depth = depth or width np.random.seed(seed) @@ -73,24 +111,26 @@ def build_model_circuit(qreg, depth=None, seed=None): class QuantumVolumeBenchmark: params = ([1, 2, 3, 5, 8, 13, 14], [1, 2, 3, 5, 8, 13, 21, 34]) - param_names = ['qubits', 'depth'] + param_names = ['width', 'depth'] + version = 2 timeout = 600 - def setup(self, n, depth): + def setup(self, width, depth): random_seed = np.random.seed(10) - qreg = QuantumRegister(n) - self.circuit = build_model_circuit(qreg, depth=depth, seed=random_seed) - self.sim_backend = BasicAer.get_backend('qasm_simulator') + if NO_KAK: + self.circuit = build_model_circuit( + width=width, depth=depth, seed=random_seed) + else: + self.circuit = build_model_circuit_kak(width, depth, random_seed) + + self.sim_backend = QasmSimulatorPy() def time_simulator_transpile(self, _, __): - transpiler.transpile(self.circuit, self.sim_backend) + transpile(self.circuit, self.sim_backend) def time_ibmq_backend_transpile(self, _, __): # Run with ibmq_16_melbourne configuration - coupling_map = [[1, 0], [1, 2], [2, 3], [4, 3], [4, 10], [5, 4], - [5, 6], [5, 9], [6, 8], [7, 8], [9, 8], [9, 10], - [11, 3], [11, 10], [11, 12], [12, 2], [13, 1], - [13, 12]] - transpiler.transpile(self.circuit, - basis_gates=['u1', 'u2', 'u3', 'cx', 'id'], - coupling_map=coupling_map) + backend = FakeMelbourne() + transpile(self.circuit, + basis_gates=['u1', 'u2', 'u3', 'cx', 'id'], + coupling_map=backend.configuration().coupling_map) diff --git a/test/benchmarks/random_circuit_hex.py b/test/benchmarks/random_circuit_hex.py index 7efc5b97d95f..85d3498f7e6e 100644 --- a/test/benchmarks/random_circuit_hex.py +++ b/test/benchmarks/random_circuit_hex.py @@ -20,10 +20,16 @@ try: from qiskit.mapper import _compiling as compiling except ImportError: - from qiskit.mapper import compiling + try: + from qiskit.mapper import compiling + except ImportError: + from qiskit.quantum_info import synthesis as compiling from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister from qiskit import BasicAer -from qiskit import transpiler +try: + from qiskit.compiler import transpile +except ImportError: + from qiskit.transpiler import transpile import qiskit.tools.qi.qi as qi @@ -67,10 +73,10 @@ def setup(self, n): self.sim_backend = BasicAer.get_backend('qasm_simulator') def time_simulator_transpile(self, _): - transpiler.transpile(self.circuit, self.sim_backend) + transpile(self.circuit, self.sim_backend) def track_depth_simulator_transpile(self, _): - return transpiler.transpile(self.circuit, self.sim_backend).depth() + return transpile(self.circuit, self.sim_backend).depth() def time_ibmq_backend_transpile(self, _): # Run with ibmq_16_melbourne configuration @@ -78,9 +84,9 @@ def time_ibmq_backend_transpile(self, _): [5, 6], [5, 9], [6, 8], [7, 8], [9, 8], [9, 10], [11, 3], [11, 10], [11, 12], [12, 2], [13, 1], [13, 12]] - transpiler.transpile(self.circuit, - basis_gates=['u1', 'u2', 'u3', 'cx', 'id'], - coupling_map=coupling_map) + transpile(self.circuit, + basis_gates=['u1', 'u2', 'u3', 'cx', 'id'], + coupling_map=coupling_map) def track_depth_ibmq_backend_transpile(self, _): # Run with ibmq_16_melbourne configuration @@ -88,6 +94,6 @@ def track_depth_ibmq_backend_transpile(self, _): [5, 6], [5, 9], [6, 8], [7, 8], [9, 8], [9, 10], [11, 3], [11, 10], [11, 12], [12, 2], [13, 1], [13, 12]] - return transpiler.transpile(self.circuit, - basis_gates=['u1', 'u2', 'u3', 'cx', 'id'], - coupling_map=coupling_map).depth() + return transpile(self.circuit, + basis_gates=['u1', 'u2', 'u3', 'cx', 'id'], + coupling_map=coupling_map).depth() diff --git a/test/benchmarks/state_tomography.py b/test/benchmarks/state_tomography.py index 6e47b86f2f0a..2ff189ef99aa 100644 --- a/test/benchmarks/state_tomography.py +++ b/test/benchmarks/state_tomography.py @@ -18,7 +18,11 @@ import qiskit # import tomography libary and other useful tools -import qiskit.tools.qcvv.tomography as tomo +try: + import qiskit.tools.qcvv.tomography as tomo + NO_TOMO = False +except ImportError: + NO_TOMO = True from qiskit.quantum_info import state_fidelity from qiskit.tools.qi.qi import random_unitary_matrix, purity @@ -33,6 +37,8 @@ def setup(self, _): self.use_quantum_program = True else: self.use_quantum_program = False + if NO_TOMO: + raise NotImplementedError # circuit that outputs the target state def target_prep(self, state, target, n_qubits, qp=None): diff --git a/test/benchmarks/transpiler_benchmarks.py b/test/benchmarks/transpiler_benchmarks.py index 0283ab9e2301..6afb92f141f6 100644 --- a/test/benchmarks/transpiler_benchmarks.py +++ b/test/benchmarks/transpiler_benchmarks.py @@ -75,6 +75,9 @@ def setup(self): else: self.local_qasm_simulator = qiskit.BasicAer.get_backend( "qasm_simulator") + self.has_compile = False + if hasattr(qiskit, 'compile'): + self.has_compile = True self.single_gate_circuit = self._build_single_gate_circuit() self.cx_circuit = self._build_cx_circuit() self.qasm_path = os.path.abspath( @@ -95,16 +98,32 @@ def time_single_gate_transpile(self): if self.local_qasm_simulator is None: self.single_gate_circuit.compile('single_gate') else: - qiskit.compile(self.single_gate_circuit, self.local_qasm_simulator) + if self.has_compile: + qiskit.compile(self.single_gate_circuit, + self.local_qasm_simulator) + else: + circ = qiskit.compiler.transpile(self.single_gate_circuit, + self.local_qasm_simulator) + qiskit.compiler.assemble(circ, self.local_qasm_simulator) def time_cx_transpile(self): if self.local_qasm_simulator is None: self.cx_circuit.compile('cx_circuit') else: - qiskit.compile(self.cx_circuit, self.local_qasm_simulator) + if self.has_compile: + qiskit.compile(self.cx_circuit, self.local_qasm_simulator) + else: + circ = qiskit.compiler.transpile(self.cx_circuit, + self.local_qasm_simulator) + qiskit.compiler.assemble(circ, self.local_qasm_simulator) def time_transpile_from_large_qasm(self): if self.local_qasm_simulator is None: self.large_qasm.compile('large_qasm') else: - qiskit.compile(self.large_qasm, self.local_qasm_simulator) + if self.has_compile: + qiskit.compile(self.large_qasm, self.local_qasm_simulator) + else: + circ = qiskit.compiler.transpile(self.large_qasm, + self.local_qasm_simulator) + qiskit.compiler.assemble(circ, self.local_qasm_simulator) From 069d308c00acf5ff0e90448b85c1605dbb8add1e Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Fri, 24 May 2019 11:59:12 -0400 Subject: [PATCH 07/61] Avoid using FakeMelbourne from qiskit/test (Qiskit/qiskit-metapackage#301) In the previous update to the the quantum volume benchmarks the fake melbourne class from the terra tests was used instead of hardcoding the coupling map directly in the benchmark. However because this lives in the terra tests python namespace it has a depedency on a bunch of test requirements at import time (even though they're not used). This causes the benchmarks to fail in a production environment because they do not install the terra development/testing requirements in the venv used for testing. To avoid this failure, this commit removes the fake backend usage and switches to a hard coded coupling map which was just copied from the backend code. [1] [1] https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/test/mock.py#L258-L260 --- test/benchmarks/quantum_volume.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/benchmarks/quantum_volume.py b/test/benchmarks/quantum_volume.py index 7fb735b9c094..d3c50e5bbc4a 100644 --- a/test/benchmarks/quantum_volume.py +++ b/test/benchmarks/quantum_volume.py @@ -24,7 +24,6 @@ import numpy as np from qiskit.providers.basicaer import QasmSimulatorPy -from qiskit.test.mock import FakeMelbourne try: from qiskit.mapper import two_qubit_kak @@ -130,7 +129,11 @@ def time_simulator_transpile(self, _, __): def time_ibmq_backend_transpile(self, _, __): # Run with ibmq_16_melbourne configuration - backend = FakeMelbourne() + coupling_map = [[1, 0], [1, 2], [2, 3], [4, 3], [4, 10], [5, 4], + [5, 6], [5, 9], [6, 8], [7, 8], [9, 8], [9, 10], + [11, 3], [11, 10], [11, 12], [12, 2], [13, 1], + [13, 12]] + transpile(self.circuit, basis_gates=['u1', 'u2', 'u3', 'cx', 'id'], - coupling_map=backend.configuration().coupling_map) + coupling_map=coupling_map) From 7610733f73ce8767dd5ec19661fc3692ebf90982 Mon Sep 17 00:00:00 2001 From: Kevin Krsulich Date: Fri, 21 Jun 2019 14:12:50 -0400 Subject: [PATCH 08/61] Add first benchmarks for circuit construction and composition. (Qiskit/qiskit-metapackage#343) Add two benchmarks timing construction of a simple circuit of one and two qubit gates at various widths and lengths, and another for composing the same circuit on top of an empty circuit. --- test/benchmarks/circuit_construction.py | 47 +++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 test/benchmarks/circuit_construction.py diff --git a/test/benchmarks/circuit_construction.py b/test/benchmarks/circuit_construction.py new file mode 100644 index 000000000000..edba37f66ddf --- /dev/null +++ b/test/benchmarks/circuit_construction.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -* + +# This code is part of Qiskit. +# +# (C) Copyright IBM 2018, 2019. +# +# This code is licensed under the Apache License, Version 2.0. You may +# obtain a copy of this license in the LICENSE.txt file in the root directory +# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. +# +# Any modifications or derivative works of this code must retain this +# copyright notice, and modified files need to carry a notice indicating +# that they have been altered from the originals. + +# pylint: disable=missing-docstring,invalid-name,no-member +# pylint: disable=attribute-defined-outside-init + +from qiskit import QuantumRegister, QuantumCircuit + + +def build_circuit(width, gates): + qr = QuantumRegister(width) + qc = QuantumCircuit(qr) + + while len(qc) < gates: + for k in range(width): + qc.h(qr[k]) + for k in range(width-1): + qc.cx(qr[k], qr[k+1]) + + return qc + + +class CircuitConstructionBench: + params = ([1, 2, 5, 8, 14, 20], [8, 128, 2048, 8192, 32768, 131072]) + param_names = ['width', 'gates'] + timeout = 600 + + def setup(self, width, gates): + self.empty_circuit = build_circuit(width, 0) + self.sample_circuit = build_circuit(width, gates) + + def time_circuit_construction(self, width, gates): + build_circuit(width, gates) + + def time_circuit_extend(self, _, __): + self.empty_circuit.extend(self.sample_circuit) From 68fb44795aa7595c7297000864fe5af9da6dcfee Mon Sep 17 00:00:00 2001 From: Kevin Krsulich Date: Mon, 24 Jun 2019 17:33:42 -0400 Subject: [PATCH 09/61] Random circuit hex less random (Qiskit/qiskit-metapackage#344) Attempt to remove some of the randomness in the random_circuit_hex benchmark [1] by seeding the random_unitary generation and the transpiler. [1] https://qiskit.github.io/qiskit/#random_circuit_hex.BenchRandomCircuitHex.track_depth_ibmq_backend_transpile * Remove deprecated function from random_circuit_hex benchmark. * Remove some rmore randomness from random_circuit_hex benchmark. * Bump random_circuit_hex benchmark version. --- test/benchmarks/random_circuit_hex.py | 31 +++++++++++++++++++-------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/test/benchmarks/random_circuit_hex.py b/test/benchmarks/random_circuit_hex.py index 85d3498f7e6e..98347279a29a 100644 --- a/test/benchmarks/random_circuit_hex.py +++ b/test/benchmarks/random_circuit_hex.py @@ -30,11 +30,16 @@ from qiskit.compiler import transpile except ImportError: from qiskit.transpiler import transpile -import qiskit.tools.qi.qi as qi +try: + from qiskit.quantum_info.random import random_unitary + HAS_RANDOM_UNITARY = True +except ImportError: + from qiskit.tools.qi.qi import random_unitary_matrix + HAS_RANDOM_UNITARY = False # Make a random circuit on a ring -def make_circuit_ring(nq, depth): +def make_circuit_ring(nq, depth, seed): assert int(nq / 2) == nq / 2 # for now size of ring must be even # Create a Quantum Register q = QuantumRegister(nq) @@ -51,7 +56,11 @@ def make_circuit_ring(nq, depth): k = i * 2 + offset + j % 2 # j%2 makes alternating rounds overlap qc.cx(q[k % nq], q[(k + 1) % nq]) for i in range(nq): # round of single-qubit unitaries - u = qi.random_unitary_matrix(2) + if HAS_RANDOM_UNITARY: + u = random_unitary(2, seed).data + else: + u = random_unitary_matrix(2) + angles = compiling.euler_angles_1q(u) qc.u3(angles[0], angles[1], angles[2], q[i]) @@ -65,18 +74,20 @@ def make_circuit_ring(nq, depth): class BenchRandomCircuitHex: params = [2 * i for i in range(2, 8)] param_names = ['n_qubits'] - version = 2 + version = 3 def setup(self, n): depth = 2 * n - self.circuit = make_circuit_ring(n, depth)[0] + self.seed = 0 + self.circuit = make_circuit_ring(n, depth, self.seed)[0] self.sim_backend = BasicAer.get_backend('qasm_simulator') def time_simulator_transpile(self, _): - transpile(self.circuit, self.sim_backend) + transpile(self.circuit, self.sim_backend, seed_transpiler=self.seed) def track_depth_simulator_transpile(self, _): - return transpile(self.circuit, self.sim_backend).depth() + return transpile(self.circuit, self.sim_backend, + seed_transpiler=self.seed).depth() def time_ibmq_backend_transpile(self, _): # Run with ibmq_16_melbourne configuration @@ -86,7 +97,8 @@ def time_ibmq_backend_transpile(self, _): [13, 12]] transpile(self.circuit, basis_gates=['u1', 'u2', 'u3', 'cx', 'id'], - coupling_map=coupling_map) + coupling_map=coupling_map, + seed_transpiler=self.seed) def track_depth_ibmq_backend_transpile(self, _): # Run with ibmq_16_melbourne configuration @@ -96,4 +108,5 @@ def track_depth_ibmq_backend_transpile(self, _): [13, 12]] return transpile(self.circuit, basis_gates=['u1', 'u2', 'u3', 'cx', 'id'], - coupling_map=coupling_map).depth() + coupling_map=coupling_map, + seed_transpiler=self.seed).depth() From 854b7a7d25e149b965e1712e45872fbe5d74f846 Mon Sep 17 00:00:00 2001 From: Kevin Krsulich Date: Tue, 2 Jul 2019 15:24:52 -0400 Subject: [PATCH 10/61] random_circuit_hex benchmark backwards compatility (Qiskit/qiskit-metapackage#358) Makes two additional changes to random_circuit_hex to better support older qiskit versions. Re-orders import attempts for euler_angles_1q. At some point in time, trying to call euler_angles_1q via qiskit.mapper would import successfully, but raise when called with an error like qiskit.exceptions.QiskitError: 'euler_angles_1q functionality is now accessible in qiskit.quantum_info.synthesis'. Change default order to always use the newest version of euler_angles_1q that's available. Falls back to setting seed_mapper for versions of qiskit earlier than seed_transpiler. --- test/benchmarks/random_circuit_hex.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/test/benchmarks/random_circuit_hex.py b/test/benchmarks/random_circuit_hex.py index 98347279a29a..e063a66af6bd 100644 --- a/test/benchmarks/random_circuit_hex.py +++ b/test/benchmarks/random_circuit_hex.py @@ -18,18 +18,20 @@ import copy try: - from qiskit.mapper import _compiling as compiling + from qiskit.quantum_info.synthesis import euler_angles_1q except ImportError: try: - from qiskit.mapper import compiling + from qiskit.mapper.compiling import euler_angles_1q except ImportError: - from qiskit.quantum_info import synthesis as compiling + from qiskit.mapper._compiling import euler_angles_1q from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister from qiskit import BasicAer try: from qiskit.compiler import transpile + TRANSPILER_SEED_KEYWORD = 'seed_transpiler' except ImportError: from qiskit.transpiler import transpile + TRANSPILER_SEED_KEYWORD = 'seed_mapper' try: from qiskit.quantum_info.random import random_unitary HAS_RANDOM_UNITARY = True @@ -61,7 +63,7 @@ def make_circuit_ring(nq, depth, seed): else: u = random_unitary_matrix(2) - angles = compiling.euler_angles_1q(u) + angles = euler_angles_1q(u) qc.u3(angles[0], angles[1], angles[2], q[i]) # insert the final measurements @@ -83,11 +85,12 @@ def setup(self, n): self.sim_backend = BasicAer.get_backend('qasm_simulator') def time_simulator_transpile(self, _): - transpile(self.circuit, self.sim_backend, seed_transpiler=self.seed) + transpile(self.circuit, self.sim_backend, + **{TRANSPILER_SEED_KEYWORD: self.seed}) def track_depth_simulator_transpile(self, _): return transpile(self.circuit, self.sim_backend, - seed_transpiler=self.seed).depth() + **{TRANSPILER_SEED_KEYWORD: self.seed}).depth() def time_ibmq_backend_transpile(self, _): # Run with ibmq_16_melbourne configuration @@ -98,7 +101,7 @@ def time_ibmq_backend_transpile(self, _): transpile(self.circuit, basis_gates=['u1', 'u2', 'u3', 'cx', 'id'], coupling_map=coupling_map, - seed_transpiler=self.seed) + **{TRANSPILER_SEED_KEYWORD: self.seed}) def track_depth_ibmq_backend_transpile(self, _): # Run with ibmq_16_melbourne configuration @@ -109,4 +112,4 @@ def track_depth_ibmq_backend_transpile(self, _): return transpile(self.circuit, basis_gates=['u1', 'u2', 'u3', 'cx', 'id'], coupling_map=coupling_map, - seed_transpiler=self.seed).depth() + **{TRANSPILER_SEED_KEYWORD: self.seed}).depth() From 3bc9cd01cbedd3f740a6cdad828c26262b461813 Mon Sep 17 00:00:00 2001 From: Raban Iten Date: Tue, 2 Jul 2019 23:01:14 +0200 Subject: [PATCH 11/61] Added benchmarks for isometries (Qiskit/qiskit-metapackage#315) * Added benchmarks for isometries * Some small fixes * Track numerical value * Simplify counts get logic * Set a seed and skip faster In an effort to reduce the noise in the measurements made by the benchmark this commit sets a seed for all calls that take one; transpile() and random_unitary(). It also moves the skip check to the top of setup so we don't waste time trying to do anything if we're just going to skip. --- test/benchmarks/isometry.py | 48 +++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 test/benchmarks/isometry.py diff --git a/test/benchmarks/isometry.py b/test/benchmarks/isometry.py new file mode 100644 index 000000000000..23b54d171098 --- /dev/null +++ b/test/benchmarks/isometry.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- + +# This code is part of Qiskit. +# +# (C) Copyright IBM 2019. +# +# This code is licensed under the Apache License, Version 2.0. You may +# obtain a copy of this license in the LICENSE.txt file in the root directory +# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. +# +# Any modifications or derivative works of this code must retain this +# copyright notice, and modified files need to carry a notice indicating +# that they have been altered from the originals. + +# pylint: disable=missing-docstring,invalid-name,no-member +# pylint: disable=attribute-defined-outside-init +# pylint: disable=unused-argument + +from qiskit import QuantumRegister, QuantumCircuit +from qiskit.compiler import transpile +from qiskit.quantum_info.random import random_unitary + + +class IsometryTranspileBench: + params = ([0, 1, 2, 3], [3, 4, 5, 6]) + param_names = ['number of input qubits', 'number of output qubits'] + + def setup(self, m, n): + q = QuantumRegister(n) + qc = QuantumCircuit(q) + if not hasattr(qc, 'iso'): + raise NotImplementedError + iso = random_unitary(2 ** n, seed=0).data[:, 0:2 ** m] + if len(iso.shape) == 1: + iso = iso.reshape((len(iso), 1)) + qc.iso(iso, q[:m], q[m:]) + self.circuit = qc + + def time_simulator_transpile(self, *unused): + transpile(self.circuit, basis_gates=['u1', 'u3', 'u2', 'cx'], + seed_transpiler=0) + + def track_cnot_counts(self, *unused): + circuit = transpile(self.circuit, basis_gates=['u1', 'u3', 'u2', 'cx'], + seed_transpiler=0) + counts = circuit.count_ops() + cnot_count = counts.get('cx', 0) + return cnot_count From a2e9c977a26da84a7c5a970557c9024335bd19ca Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Fri, 12 Jul 2019 08:17:34 -0400 Subject: [PATCH 12/61] Handle missing qi modules (Qiskit/qiskit-metapackage#368) Qiskit/qiskit-terra#2761 removed some more of the deprecated qi modules from terra that the state tomography benchmarks were previously relying on. While we've been skipping these benchmarks since the tomography module was removed from terra this caused an import error to be raised when importing the test. To avoid the import error breaking asv runs until we rewrite the benchmark to use ignis this commit handles an import error and treats it as a skip condition. --- test/benchmarks/state_tomography.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/benchmarks/state_tomography.py b/test/benchmarks/state_tomography.py index 2ff189ef99aa..ea172428a38d 100644 --- a/test/benchmarks/state_tomography.py +++ b/test/benchmarks/state_tomography.py @@ -24,7 +24,10 @@ except ImportError: NO_TOMO = True from qiskit.quantum_info import state_fidelity -from qiskit.tools.qi.qi import random_unitary_matrix, purity +try: + from qiskit.tools.qi.qi import random_unitary_matrix, purity +except ImportError: + NO_TOMO = True class StateTomographyBench: From 2fe86fab71b6b0bbc9e11560aa0bca17f73291ca Mon Sep 17 00:00:00 2001 From: Shelly Garion <46566946+ShellyGarion@users.noreply.github.com> Date: Sun, 21 Jul 2019 04:21:28 +0300 Subject: [PATCH 13/61] Randomize Benchmarking Performace Benchmark (Qiskit/qiskit-metapackage#306) * first version of benchmark/randomize_benchmarking.py * fix lint error * fixed a misprint * updated benchmark test for RB * fixed RB benchmark test following comment * fix lint error * Add qiskit-ignis to benchmark env * removed nq from the parameters * Correct setup() parameter order * Only return circuits for transpilation * nseeds = [1] * Fix various issues with the benchmark This commit fixes a number of issues with the benchmark. First it removes single entry parameters from the parameter list, there's no reason to make them parameters if we don't use multiple values. It also fixes a small bug in the return from the build_rb_circuit() function where we were only returning one sequence of circuits instead of the whole set. It also adjusts how we use random values by properly setting a seed for both circuit building and tranpile. The last thing it does is for consistency it pins the ignis version to a single version and sets the benchmark version number to match that. This way if/when we need to bump the ignis version we use in the benchmarks we'll have to bump the benchmark's version too to match. This way we can make sure we're using the same ignis version for all benchmark results. * Reduce the number of length vectors used to 1 This commit removes one of the two length vectors we were using for constructing the RB circuits. This is done in the interest of time since the RB benchmarking can be quite slow so this reduces the number of input parameters we iterate over which decreases the total run time of RB benchmarks. If in the future we improve the performance so that the impact is minimal to the full asv run we can add back additional length vectors for benchmarking. * Update copyright header to use consistent format --- test/benchmarks/randomized_benchmarking.py | 94 ++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 test/benchmarks/randomized_benchmarking.py diff --git a/test/benchmarks/randomized_benchmarking.py b/test/benchmarks/randomized_benchmarking.py new file mode 100644 index 000000000000..50e4c8480cfb --- /dev/null +++ b/test/benchmarks/randomized_benchmarking.py @@ -0,0 +1,94 @@ +# -*- coding: utf-8 -*- + +# This code is part of Qiskit. +# +# (C) Copyright IBM 2019. +# +# This code is licensed under the Apache License, Version 2.0. You may +# obtain a copy of this license in the LICENSE.txt file in the root directory +# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. +# +# Any modifications or derivative works of this code must retain this +# copyright notice, and modified files need to carry a notice indicating +# that they have been altered from the originals. + +# pylint: disable=no-member,invalid-name,missing-docstring,no-name-in-module +# pylint: disable=attribute-defined-outside-init,unsubscriptable-object + +"""Module for estimating randomized benchmarking.""" + +import numpy as np +import qiskit.ignis.verification.randomized_benchmarking as rb +from qiskit.providers.basicaer import QasmSimulatorPy + +try: + from qiskit.compiler import transpile + TRANSPILER_SEED_KEYWORD = 'seed_transpiler' +except ImportError: + from qiskit.transpiler import transpile + TRANSPILER_SEED_KEYWORD = 'seed_mapper' + + +def build_rb_circuit(nseeds=1, length_vector=None, + rb_pattern=None, length_multiplier=1, + seed_offset=0, align_cliffs=False, seed=None): + """ + Randomized Benchmarking sequences. + """ + if not seed: + np.random.seed(10) + else: + np.random.seed(seed) + rb_opts = {} + rb_opts['nseeds'] = nseeds + rb_opts['length_vector'] = length_vector + rb_opts['rb_pattern'] = rb_pattern + rb_opts['length_multiplier'] = length_multiplier + rb_opts['seed_offset'] = seed_offset + rb_opts['align_cliffs'] = align_cliffs + + # Generate the sequences + try: + rb_circs, _ = rb.randomized_benchmarking_seq(**rb_opts) + except OSError: + skip_msg = ('Skipping tests because ' + 'tables are missing') + raise NotImplementedError(skip_msg) + all_circuits = [] + for seq in rb_circs: + all_circuits += seq + return all_circuits + + +class RandomizedBenchmarkingBenchmark: + # parameters for RB (1&2 qubits): + params = ([[[0]], [[0, 1]], [[0, 2], [1]]],) + param_names = ['rb_pattern'] + version = '0.1.1' + timeout = 600 + + def setup(self, rb_pattern): + length_vector = np.arange(1, 200, 4) + nseeds = 1 + self.seed = 10 + self.circuits = build_rb_circuit(nseeds=nseeds, + length_vector=length_vector, + rb_pattern=rb_pattern, + seed=self.seed) + self.sim_backend = QasmSimulatorPy() + + def time_simulator_transpile(self, __): + transpile(self.circuits, self.sim_backend, + **{TRANSPILER_SEED_KEYWORD: self.seed}) + + def time_ibmq_backend_transpile(self, __): + # Run with ibmq_16_melbourne configuration + coupling_map = [[1, 0], [1, 2], [2, 3], [4, 3], [4, 10], [5, 4], + [5, 6], [5, 9], [6, 8], [7, 8], [9, 8], [9, 10], + [11, 3], [11, 10], [11, 12], [12, 2], [13, 1], + [13, 12]] + + transpile(self.circuits, + basis_gates=['u1', 'u2', 'u3', 'cx', 'id'], + coupling_map=coupling_map, + **{TRANSPILER_SEED_KEYWORD: self.seed}) From 052b3402774e46a0a4660025d414db4fa8514ffc Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Tue, 13 Aug 2019 16:53:51 -0400 Subject: [PATCH 14/61] Update state tomography benchmarks to use ignis (Qiskit/qiskit-metapackage#400) * Update state tomography benchmarks to use ignis The state tomography benchmarks have been skipped since terra deprecated and then removed it's support for doing tomography. The new way to run tomography is by using ignis. This commit does just that and rewrites the tomography benchmarks to use ignis instead of terra so that we can now run them on the current versions of terra. * Fix lint * Add a 6 qubit benchmark * Fix lint again * Remove setting timer it's already the default * Increase timeout for state tomography benchmarks The cat state tomography benchmark for 5 qubits typically takes about 55 seconds for my local desktop. However, sometimes it can take slightly longer and with a default timeout of 60 seconds it doesn't give much of a margin. * Remove 6 qubit benchmark The 6 qubit cat state tomography benchmark is a bit too slow to be valuable. On my local desktop it's consistently more than the current timeout of the state tomography benchmark which is 2min (the bell state tomography does not have an duration issues, it's minimally slower with 6 qubits). We already have a ton of very slow benchmarks and the additional value for running tomography with 6 qubits vs 5 is minimal. So in the interest of time this commit removes the 6 qubit cases. * Fix lint yet again --- test/benchmarks/state_tomography.py | 217 ++++++---------------------- 1 file changed, 45 insertions(+), 172 deletions(-) diff --git a/test/benchmarks/state_tomography.py b/test/benchmarks/state_tomography.py index ea172428a38d..e80e340f5a6a 100644 --- a/test/benchmarks/state_tomography.py +++ b/test/benchmarks/state_tomography.py @@ -1,190 +1,63 @@ # -*- coding: utf-8 -*- -# Copyright 2017, IBM. +# This code is part of Qiskit. # -# This source code is licensed under the Apache License, Version 2.0 found in -# the LICENSE.txt file in the root directory of this source tree. +# (C) Copyright IBM 2017, 2019. +# +# This code is licensed under the Apache License, Version 2.0. You may +# obtain a copy of this license in the LICENSE.txt file in the root directory +# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. +# +# Any modifications or derivative works of this code must retain this +# copyright notice, and modified files need to carry a notice indicating +# that they have been altered from the originals. # pylint: disable=missing-docstring,invalid-name,no-member,broad-except -# pylint: disable=no-else-return +# pylint: disable=no-else-return, attribute-defined-outside-init -""" -Quantum State Tomography. -Generates many small circuits, thus good for profiling compiler overhead. -Number of circuits grows like 3^n_qubits -""" - -import numpy as np +from qiskit.ignis.verification import tomography as tomo import qiskit -# import tomography libary and other useful tools -try: - import qiskit.tools.qcvv.tomography as tomo - NO_TOMO = False -except ImportError: - NO_TOMO = True from qiskit.quantum_info import state_fidelity -try: - from qiskit.tools.qi.qi import random_unitary_matrix, purity -except ImportError: - NO_TOMO = True class StateTomographyBench: params = [2, 3, 4, 5] - timeout = 360.0 - use_quantum_program = False + param_names = ['n_qubits'] + version = '0.1.1' + timeout = 120.0 def setup(self, _): - if hasattr(qiskit, 'QuantumProgram'): - self.use_quantum_program = True - else: - self.use_quantum_program = False - if NO_TOMO: - raise NotImplementedError - - # circuit that outputs the target state - def target_prep(self, state, target, n_qubits, qp=None): - if not self.use_quantum_program: - # quantum circuit to make an entangled cat state - if state == 'cat': - n_qubits = int(np.log2(target.size)) - qr = qiskit.QuantumRegister(n_qubits, 'qr') - cr = qiskit.ClassicalRegister(n_qubits, 'cr') - circ = qiskit.QuantumCircuit(qr, cr, name='cat') - circ.h(qr[0]) - for i in range(1, n_qubits): - circ.cx(qr[0], qr[i]) - # quantum circuit to prepare arbitrary given state - elif state == 'random': - n_qubits = int(np.log2(target.size)) - qr = qiskit.QuantumRegister(n_qubits, 'qr') - cr = qiskit.ClassicalRegister(n_qubits, 'cr') - circ = qiskit.QuantumCircuit(qr, cr, name='random') - circ.initialize(target, [qr[i] for i in range(n_qubits)]) - return circ - else: - if state == 'cat': - n_qubits = int(np.log2(target.size)) - qr = qp.create_quantum_register('qr', n_qubits) - cr = qp.create_classical_register('cr', n_qubits) - cat = qp.create_circuit('prep', [qr], [cr]) - cat.h(qr[0]) - for i in range(1, n_qubits): - cat.cx(qr[0], qr[i]) - # quantum circuit to prepare arbitrary given state - elif state == 'random': - n_qubits = int(np.log2(target.size)) - qr = qp.create_quantum_register('qr', n_qubits) - cr = qp.create_classical_register('cr', n_qubits) - random = qp.create_circuit('prep', [qr], [cr]) - try: - random.initialize( - "Qinit", target, [qr[i] for i in range(n_qubits)]) - except Exception: - random.initialize( - target, [qr[i] for i in range(n_qubits)]) - return qp - - # add basis measurements to the circuit for tomography - # XX..X, XX..Y, .., ZZ..Z - def add_tomo_circuits(self, circ): - if not self.use_quantum_program: - # Construct state tomography set for measurement of qubits in the - # register - qr = next(iter(circ.qregs)) - cr = next(iter(circ.cregs)) - tomo_set = tomo.state_tomography_set(list(range(qr.size))) - # Add the state tomography measurement circuits - tomo_circuits = tomo.create_tomography_circuits( - circ, qr, cr, tomo_set) - return tomo_set, tomo_circuits - if self.use_quantum_program: - # Construct state tomography set for measurement of qubits in the - # register - qr_name = list(circ.get_quantum_register_names())[0] - cr_name = list(circ.get_classical_register_names())[0] - qr = circ.get_quantum_register(qr_name) - cr = circ.get_classical_register(cr_name) - tomo_set = tomo.state_tomography_set(list(range(qr.size))) - # Add the state tomography measurement circuits to the Quantum - # Program - tomo_circuits = tomo.create_tomography_circuits( - circ, qr, cr, tomo_set) - return circ, tomo_set, tomo_circuits - raise Exception + self.sv_backend = qiskit.BasicAer.get_backend('statevector_simulator') + self.qasm_backend = qiskit.BasicAer.get_backend('qasm_simulator') + + def time_state_tomography_bell(self, n_qubits): + qr = qiskit.QuantumRegister(2) + bell = qiskit.QuantumCircuit(qr) + bell.h(qr[0]) + bell.cx(qr[0], qr[1]) + psi_bell = qiskit.execute( + bell, self.sv_backend).result().get_statevector(bell) + qr_full = qiskit.QuantumRegister(n_qubits) + bell = qiskit.QuantumCircuit(qr_full) + bell.h(qr_full[n_qubits - 2]) + bell.cx(qr_full[n_qubits - 2], qr_full[n_qubits - 1]) + qst_bell = tomo.state_tomography_circuits(bell, + [qr_full[n_qubits - 2], + qr_full[n_qubits - 1]]) + job = qiskit.execute(qst_bell, self.qasm_backend, shots=5000) + rho_bell = tomo.StateTomographyFitter(job.result(), qst_bell).fit() + state_fidelity(psi_bell, rho_bell) def time_state_tomography_cat(self, n_qubits): - # cat target state: [1. 0. 0. ... 0. 0. 1.]/sqrt(2.) - target = np.zeros(pow(2, n_qubits)) - target[0] = 1 - target[pow(2, n_qubits)-1] = 1.0 - target /= np.sqrt(2.0) - if not self.use_quantum_program: - self._state_tomography(target, 'cat', n_qubits) - else: - self._state_tomography_quantum_program(target, 'cat', n_qubits) - - def time_state_tomography_random(self, n_qubits): - # random target state: first column of a random unitary - target = random_unitary_matrix(pow(2, n_qubits))[0] - if not self.use_quantum_program: - self._state_tomography(target, 'random', n_qubits) - else: - self._state_tomography_quantum_program(target, 'random', n_qubits) - - def _state_tomography_quantum_program(self, target, state, n_qubits, - shots=1): - qp = qiskit.QuantumProgram() - try: - backend = 'local_qiskit_simulator' - qp.get_backend_configuration(backend) - except LookupError: - backend = 'local_qasm_simulator' - - # Prepared target state and assess quality - qp = self.target_prep(state, target, n_qubits, qp=qp) - prep_result = qp.execute(['prep'], - backend=backend, shots=1) - prep_state = prep_result.get_data('prep')['quantum_state'] - F_prep = state_fidelity(prep_state, target) - print('Prepared state fidelity =', F_prep) - - # Run state tomography simulation and fit data to reconstruct circuit - qp, tomo_set, tomo_circuits = self.add_tomo_circuits(qp) - tomo_result = qp.execute(tomo_circuits, backend=backend, shots=shots) - tomo_data = tomo.tomography_data(tomo_result, 'prep', tomo_set) - rho_fit = tomo.fit_tomography_data(tomo_data) - - # calculate fidelity and purity of fitted state - F_fit = state_fidelity(rho_fit, target) - pur = purity(rho_fit) - print('Fitted state fidelity =', F_fit) - print('Fitted state purity =', str(pur)) - - # perform quantum state tomography and assess quality of reconstructed - # vector - def _state_tomography(self, target, state, n_qubits, shots=1): - # Use the local qasm simulator - backend = qiskit.BasicAer.get_backend('statevector_simulator') - - # Prepared target state and assess quality - prep_circ = self.target_prep(state, target, n_qubits) - prep_result = qiskit.execute( - prep_circ, backend=backend).result() - prep_state = prep_result.get_statevector(prep_circ) - F_prep = state_fidelity(prep_state, target) - print('Prepared state fidelity =', F_prep) - - # Run state tomography simulation and fit data to reconstruct circuit - tomo_set, tomo_circuits = self.add_tomo_circuits(prep_circ) + qr = qiskit.QuantumRegister(n_qubits, 'qr') + circ = qiskit.QuantumCircuit(qr, name='cat') + circ.h(qr[0]) + for i in range(1, n_qubits): + circ.cx(qr[0], qr[i]) + psi = qiskit.execute(circ, self.sv_backend).result().get_statevector() + qst_circ = tomo.state_tomography_circuits(circ, qr) tomo_result = qiskit.execute( - tomo_circuits, backend=backend, shots=shots).result() - tomo_data = tomo.tomography_data(tomo_result, prep_circ.name, tomo_set) - rho_fit = tomo.fit_tomography_data(tomo_data) - - # calculate fidelity and purity of fitted state - F_fit = state_fidelity(rho_fit, target) - pur = purity(rho_fit) - print('Fitted state fidelity =', F_fit) - print('Fitted state purity =', str(pur)) + qst_circ, self.qasm_backend, shots=5000).result() + rho = tomo.StateTomographyFitter(tomo_result, qst_circ).fit() + state_fidelity(psi, rho) From d12dcb33cd4671f36f5ba6e63a20a879dd7aec41 Mon Sep 17 00:00:00 2001 From: Kevin Krsulich Date: Sun, 18 Aug 2019 09:42:34 -0400 Subject: [PATCH 15/61] Add single-threaded versions of RB benchmarks. (Qiskit/qiskit-metapackage#396) * Add single-threaded versions of RB benchmarks. * Unset QISKIT_IN_PARALLEL env variable after RB benchmarks. --- test/benchmarks/randomized_benchmarking.py | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/test/benchmarks/randomized_benchmarking.py b/test/benchmarks/randomized_benchmarking.py index 50e4c8480cfb..434b76503aa9 100644 --- a/test/benchmarks/randomized_benchmarking.py +++ b/test/benchmarks/randomized_benchmarking.py @@ -17,6 +17,7 @@ """Module for estimating randomized benchmarking.""" +import os import numpy as np import qiskit.ignis.verification.randomized_benchmarking as rb from qiskit.providers.basicaer import QasmSimulatorPy @@ -77,10 +78,18 @@ def setup(self, rb_pattern): seed=self.seed) self.sim_backend = QasmSimulatorPy() + def teardown(self, _): + os.environ['QISKIT_IN_PARALLEL'] = 'FALSE' + def time_simulator_transpile(self, __): transpile(self.circuits, self.sim_backend, **{TRANSPILER_SEED_KEYWORD: self.seed}) + def time_simulator_transpile_single_thread(self, __): + os.environ['QISKIT_IN_PARALLEL'] = 'TRUE' + transpile(self.circuits, self.sim_backend, + **{TRANSPILER_SEED_KEYWORD: self.seed}) + def time_ibmq_backend_transpile(self, __): # Run with ibmq_16_melbourne configuration coupling_map = [[1, 0], [1, 2], [2, 3], [4, 3], [4, 10], [5, 4], @@ -92,3 +101,17 @@ def time_ibmq_backend_transpile(self, __): basis_gates=['u1', 'u2', 'u3', 'cx', 'id'], coupling_map=coupling_map, **{TRANSPILER_SEED_KEYWORD: self.seed}) + + def time_ibmq_backend_transpile_single_thread(self, __): + os.environ['QISKIT_IN_PARALLEL'] = 'TRUE' + + # Run with ibmq_16_melbourne configuration + coupling_map = [[1, 0], [1, 2], [2, 3], [4, 3], [4, 10], [5, 4], + [5, 6], [5, 9], [6, 8], [7, 8], [9, 8], [9, 10], + [11, 3], [11, 10], [11, 12], [12, 2], [13, 1], + [13, 12]] + + transpile(self.circuits, + basis_gates=['u1', 'u2', 'u3', 'cx', 'id'], + coupling_map=coupling_map, + **{TRANSPILER_SEED_KEYWORD: self.seed}) From 6ba27a85ace7504e4137107fc2862916b0e3b463 Mon Sep 17 00:00:00 2001 From: Kevin Krsulich Date: Tue, 20 Aug 2019 00:42:58 -0400 Subject: [PATCH 16/61] Add timing benchmark for `import qiskit`. (Qiskit/qiskit-metapackage#463) * Add timing benchmark for `import qiskit`. * Update import.py --- test/benchmarks/import.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 test/benchmarks/import.py diff --git a/test/benchmarks/import.py b/test/benchmarks/import.py new file mode 100644 index 000000000000..df7d4d608753 --- /dev/null +++ b/test/benchmarks/import.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- + +# This code is part of Qiskit. +# +# (C) Copyright IBM 2019. +# +# This code is licensed under the Apache License, Version 2.0. You may +# obtain a copy of this license in the LICENSE.txt file in the root directory +# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. +# +# Any modifications or derivative works of this code must retain this +# copyright notice, and modified files need to carry a notice indicating +# that they have been altered from the originals. + +# pylint: disable=no-member,invalid-name,missing-docstring,no-name-in-module +# pylint: disable=attribute-defined-outside-init,unsubscriptable-object + +"""Module for estimating import times.""" + +from sys import executable +from subprocess import call + + +class QiskitImport: + def time_qiskit_import(self): + call((executable, '-c', 'import qiskit')) From c2a01a02bb3e3aeae4c138b9491bb75315ff320e Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Sun, 25 Aug 2019 21:08:55 -0400 Subject: [PATCH 17/61] Bump the ignis version in tomography and RB benchmarks (Qiskit/qiskit-metapackage#491) This commit bumps the ignis version used in the randomized benchmarking and state tomography asv benchmarks. These benchmarks use a pinned version of ignis for consistent results since the benchmarks track terra development. Now that ignis 0.2.0 has been released we should use it to ensure that the benchmarks keep working moving forward. --- test/benchmarks/randomized_benchmarking.py | 2 +- test/benchmarks/state_tomography.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/benchmarks/randomized_benchmarking.py b/test/benchmarks/randomized_benchmarking.py index 434b76503aa9..0116408d20f5 100644 --- a/test/benchmarks/randomized_benchmarking.py +++ b/test/benchmarks/randomized_benchmarking.py @@ -65,7 +65,7 @@ class RandomizedBenchmarkingBenchmark: # parameters for RB (1&2 qubits): params = ([[[0]], [[0, 1]], [[0, 2], [1]]],) param_names = ['rb_pattern'] - version = '0.1.1' + version = '0.2.0' timeout = 600 def setup(self, rb_pattern): diff --git a/test/benchmarks/state_tomography.py b/test/benchmarks/state_tomography.py index e80e340f5a6a..87961b15daa8 100644 --- a/test/benchmarks/state_tomography.py +++ b/test/benchmarks/state_tomography.py @@ -24,7 +24,7 @@ class StateTomographyBench: params = [2, 3, 4, 5] param_names = ['n_qubits'] - version = '0.1.1' + version = '0.2.0' timeout = 120.0 def setup(self, _): From 50dcb25909ab1f58fc4e7c0e4d932c4489adf345 Mon Sep 17 00:00:00 2001 From: itoko Date: Wed, 28 Aug 2019 00:46:39 +0900 Subject: [PATCH 18/61] Add a test to track mapper's performance on CNOT count (Qiskit/qiskit-metapackage#504) Add a test case for tracking CNOT count after mapping to IBM Q 16 Melbourne using isometry circuits so that we can track the quality of mappings by default pass manager. * Add a bench to track mapper's cnot count performance * lint --- test/benchmarks/isometry.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/benchmarks/isometry.py b/test/benchmarks/isometry.py index 23b54d171098..5da0e02a32f0 100644 --- a/test/benchmarks/isometry.py +++ b/test/benchmarks/isometry.py @@ -46,3 +46,13 @@ def track_cnot_counts(self, *unused): counts = circuit.count_ops() cnot_count = counts.get('cx', 0) return cnot_count + + def track_cnot_counts_after_mapping_to_ibmq_16_melbourne(self, *unused): + coupling = [[1, 0], [1, 2], [2, 3], [4, 3], [4, 10], [5, 4], + [5, 6], [5, 9], [6, 8], [7, 8], [9, 8], [9, 10], + [11, 3], [11, 10], [11, 12], [12, 2], [13, 1], [13, 12]] + circuit = transpile(self.circuit, basis_gates=['u1', 'u3', 'u2', 'cx'], + coupling_map=coupling, seed_transpiler=0) + counts = circuit.count_ops() + cnot_count = counts.get('cx', 0) + return cnot_count From 83b178f5ccca6d205b1030ef60173d95d0b234a2 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Wed, 2 Oct 2019 14:42:58 -0400 Subject: [PATCH 19/61] Add benchmarks for different transpiler levels (Qiskit/qiskit-metapackage#603) * Add benchmarks for different transpiler levels This commit adds new benchmarks for testing different transpiler levels. It runs 3 different circuits through both time and depth benchmarks, quantum volume 50x20 with the rochester coupling map, 14x14 with FakeMelbourne (mostly to include the properties snapshot after Qiskit/qiskit-terra#3060 for level 3), and the large qasm example with both a rochester coupling map and FakeMelbourne. Each benchmark is run with optimization level 0, 1, 2, and 3 to have results with more than just the default optimization level. By tracking depth we can also compare the relative effectiveness of each level vs speed. * Inline fake backend with noise from terra This commit inlines the fake melbourne backend from qiskit-terra's test module. We need a local copy of this in the benchmarks that's static for consistency reasons. The fake provider in terra has different values returned depending on where in the git history it is (if it exists at all). This would cause noise in the benchmarks as we're trying to measure the performance of the transpiler not the backends. So to avoid those potential issues this commit adds a local copy that we can keep static independent of terra. If we do need to change it for any reason we can then also update the benchmark version to indicate it's different results. --- test/benchmarks/backends/__init__.py | 0 test/benchmarks/backends/fake_backend.py | 110 ++++++++++ test/benchmarks/backends/fake_job.py | 86 ++++++++ test/benchmarks/backends/fake_melbourne.py | 64 ++++++ test/benchmarks/backends/props_melbourne.json | 1 + test/benchmarks/quantum_volume.py | 27 +-- test/benchmarks/transpiler_levels.py | 199 ++++++++++++++++++ test/benchmarks/utils.py | 41 ++++ 8 files changed, 504 insertions(+), 24 deletions(-) create mode 100644 test/benchmarks/backends/__init__.py create mode 100644 test/benchmarks/backends/fake_backend.py create mode 100644 test/benchmarks/backends/fake_job.py create mode 100644 test/benchmarks/backends/fake_melbourne.py create mode 100644 test/benchmarks/backends/props_melbourne.json create mode 100644 test/benchmarks/transpiler_levels.py create mode 100644 test/benchmarks/utils.py diff --git a/test/benchmarks/backends/__init__.py b/test/benchmarks/backends/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/test/benchmarks/backends/fake_backend.py b/test/benchmarks/backends/fake_backend.py new file mode 100644 index 000000000000..cb05706f7774 --- /dev/null +++ b/test/benchmarks/backends/fake_backend.py @@ -0,0 +1,110 @@ +# -*- coding: utf-8 -*- + +# This code is part of Qiskit. +# +# (C) Copyright IBM 2019. +# +# This code is licensed under the Apache License, Version 2.0. You may +# obtain a copy of this license in the LICENSE.txt file in the root directory +# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. +# +# Any modifications or derivative works of this code must retain this +# copyright notice, and modified files need to carry a notice indicating +# that they have been altered from the originals. + +""" +Base class for dummy backends. +""" + +import uuid +import time + +from qiskit.providers.models import BackendProperties +from qiskit.providers import BaseBackend +from qiskit.result import Result +from .fake_job import FakeJob + + +class FakeBackend(BaseBackend): + """This is a dummy backend just for testing purposes.""" + + def __init__(self, configuration, time_alive=10): + """ + Args: + configuration (BackendConfiguration): backend configuration + time_alive (int): time to wait before returning result + """ + super().__init__(configuration) + self.time_alive = time_alive + + def properties(self): + """Return backend properties""" + coupling_map = self.configuration().coupling_map + unique_qubits = list(set().union(*coupling_map)) + + properties = { + 'backend_name': self.name(), + 'backend_version': self.configuration().backend_version, + 'last_update_date': '2000-01-01 00:00:00Z', + 'qubits': [ + [ + { + "date": "2000-01-01 00:00:00Z", + "name": "T1", + "unit": "\u00b5s", + "value": 0.0 + }, + { + "date": "2000-01-01 00:00:00Z", + "name": "T2", + "unit": "\u00b5s", + "value": 0.0 + }, + { + "date": "2000-01-01 00:00:00Z", + "name": "frequency", + "unit": "GHz", + "value": 0.0 + }, + { + "date": "2000-01-01 00:00:00Z", + "name": "readout_error", + "unit": "", + "value": 0.0 + } + ] for _ in range(len(unique_qubits)) + ], + 'gates': [{ + "gate": "cx", + "name": "CX" + str(pair[0]) + "_" + str(pair[1]), + "parameters": [ + { + "date": "2000-01-01 00:00:00Z", + "name": "gate_error", + "unit": "", + "value": 0.0 + } + ], + "qubits": [ + pair[0], + pair[1] + ] + } for pair in coupling_map], + 'general': [] + } + + return BackendProperties.from_dict(properties) + + def run(self, qobj): + job_id = str(uuid.uuid4()) + job = FakeJob(self, job_id, self.run_job, qobj) + job.submit() + return job + + def run_job(self, job_id, qobj): + """Main dummy run loop""" + del qobj # unused + time.sleep(self.time_alive) + + return Result.from_dict( + {'job_id': job_id, 'result': [], 'status': 'COMPLETED'}) diff --git a/test/benchmarks/backends/fake_job.py b/test/benchmarks/backends/fake_job.py new file mode 100644 index 000000000000..85c7cced828a --- /dev/null +++ b/test/benchmarks/backends/fake_job.py @@ -0,0 +1,86 @@ +# -*- coding: utf-8 -*- + +# This code is part of Qiskit. +# +# (C) Copyright IBM 2019. +# +# This code is licensed under the Apache License, Version 2.0. You may +# obtain a copy of this license in the LICENSE.txt file in the root directory +# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. +# +# Any modifications or derivative works of this code must retain this +# copyright notice, and modified files need to carry a notice indicating +# that they have been altered from the originals. + +""" +Base class for dummy jobs. +""" + + +from concurrent import futures + +from qiskit.providers import BaseJob +from qiskit.providers.jobstatus import JobStatus + + +class FakeJob(BaseJob): + """Fake simulator job""" + _executor = futures.ProcessPoolExecutor() + + def __init__(self, backend, job_id, fn, qobj): + super().__init__(backend, job_id) + self._backend = backend + self._job_id = job_id + self._qobj = qobj + self._future = None + self._future_callback = fn + + def submit(self): + self._future = self._executor.submit(self._future_callback, self._qobj) + + def result(self, timeout=None): + # pylint: disable=arguments-differ + return self._future.result(timeout=timeout) + + def cancel(self): + return self._future.cancel() + + def status(self): + if self._running: + _status = JobStatus.RUNNING + elif not self._done: + _status = JobStatus.QUEUED + elif self._cancelled: + _status = JobStatus.CANCELLED + elif self._done: + _status = JobStatus.DONE + elif self._error: + _status = JobStatus.ERROR + else: + raise Exception('Unexpected state of {0}'.format( + self.__class__.__name__)) + _status_msg = None + return {'status': _status, + 'status_msg': _status_msg} + + def job_id(self): + return self._job_id + + def backend(self): + return self._backend + + @property + def _cancelled(self): + return self._future.cancelled() + + @property + def _done(self): + return self._future.done() + + @property + def _running(self): + return self._future.running() + + @property + def _error(self): + return self._future.exception(timeout=0) diff --git a/test/benchmarks/backends/fake_melbourne.py b/test/benchmarks/backends/fake_melbourne.py new file mode 100644 index 000000000000..fcb6e42c215a --- /dev/null +++ b/test/benchmarks/backends/fake_melbourne.py @@ -0,0 +1,64 @@ +# -*- coding: utf-8 -*- + +# This code is part of Qiskit. +# +# (C) Copyright IBM 2019. +# +# This code is licensed under the Apache License, Version 2.0. You may +# obtain a copy of this license in the LICENSE.txt file in the root directory +# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. +# +# Any modifications or derivative works of this code must retain this +# copyright notice, and modified files need to carry a notice indicating +# that they have been altered from the originals. + +""" +Fake Melbourne device (14 qubit). +""" + +import os +import json + +from qiskit.providers.models import (GateConfig, QasmBackendConfiguration, + BackendProperties) +from .fake_backend import FakeBackend + + +class FakeMelbourne(FakeBackend): + """A fake 14 qubit backend.""" + + def __init__(self): + """ + 0 ← 1 → 2 → 3 ← 4 ← 5 → 6 + ↑ ↑ ↑ ↓ ↓ ↓ + 13 → 12 ← 11 → 10 ← 9 → 8 ← 7 + """ + cmap = [[1, 0], [1, 2], [2, 3], [4, 3], [4, 10], [5, 4], + [5, 6], [5, 9], [6, 8], [7, 8], [9, 8], [9, 10], + [11, 3], [11, 10], [11, 12], [12, 2], [13, 1], [13, 12]] + + configuration = QasmBackendConfiguration( + backend_name='fake_melbourne', + backend_version='0.0.0', + n_qubits=14, + basis_gates=['u1', 'u2', 'u3', 'cx', 'id'], + simulator=False, + local=True, + conditional=False, + open_pulse=False, + memory=False, + max_shots=65536, + gates=[GateConfig(name='TODO', parameters=[], qasm_def='TODO')], + coupling_map=cmap, + ) + + super().__init__(configuration) + + def properties(self): + """Returns a snapshot of device properties as recorded on 8/30/19. + """ + dirname = os.path.dirname(__file__) + filename = "props_melbourne.json" + with open(os.path.join(dirname, filename), "r") as f_prop: + props = json.load(f_prop) + return BackendProperties.from_dict(props) diff --git a/test/benchmarks/backends/props_melbourne.json b/test/benchmarks/backends/props_melbourne.json new file mode 100644 index 000000000000..8db37a5f4611 --- /dev/null +++ b/test/benchmarks/backends/props_melbourne.json @@ -0,0 +1 @@ +{"backend_version": "1.0.0", "general": [], "last_update_date": "2019-08-30T08:40:39+00:00", "backend_name": "ibmq_16_melbourne", "qubits": [[{"date": "2019-08-30T06:25:05+00:00", "unit": "\u00b5s", "value": 50.77314177960378, "name": "T1"}, {"date": "2019-08-30T06:26:18+00:00", "unit": "\u00b5s", "value": 23.26716550447232, "name": "T2"}, {"date": "2019-08-30T08:40:39+00:00", "unit": "GHz", "value": 5.100143648658738, "name": "frequency"}, {"date": "2019-08-30T06:24:42+00:00", "unit": "", "value": 0.0816, "name": "readout_error"}], [{"date": "2019-08-30T06:25:05+00:00", "unit": "\u00b5s", "value": 75.03457165555137, "name": "T1"}, {"date": "2019-08-30T06:27:17+00:00", "unit": "\u00b5s", "value": 123.45446126755621, "name": "T2"}, {"date": "2019-08-30T08:40:39+00:00", "unit": "GHz", "value": 5.238515519242375, "name": "frequency"}, {"date": "2019-08-30T06:24:42+00:00", "unit": "", "value": 0.05669999999999997, "name": "readout_error"}], [{"date": "2019-08-30T06:25:05+00:00", "unit": "\u00b5s", "value": 50.275404762879674, "name": "T1"}, {"date": "2019-08-30T06:28:16+00:00", "unit": "\u00b5s", "value": 97.1824505756254, "name": "T2"}, {"date": "2019-08-30T08:40:39+00:00", "unit": "GHz", "value": 5.0325918748371725, "name": "frequency"}, {"date": "2019-08-30T06:24:42+00:00", "unit": "", "value": 0.03649999999999998, "name": "readout_error"}], [{"date": "2019-08-30T06:25:05+00:00", "unit": "\u00b5s", "value": 77.06523067691023, "name": "T1"}, {"date": "2019-08-30T06:29:16+00:00", "unit": "\u00b5s", "value": 65.88343921328119, "name": "T2"}, {"date": "2019-08-30T08:40:39+00:00", "unit": "GHz", "value": 4.89622995143569, "name": "frequency"}, {"date": "2019-08-30T06:24:42+00:00", "unit": "", "value": 0.033600000000000074, "name": "readout_error"}], [{"date": "2019-08-30T06:25:05+00:00", "unit": "\u00b5s", "value": 48.6121344326565, "name": "T1"}, {"date": "2019-08-30T06:26:18+00:00", "unit": "\u00b5s", "value": 33.43851454952923, "name": "T2"}, {"date": "2019-08-30T08:40:39+00:00", "unit": "GHz", "value": 5.030492276013032, "name": "frequency"}, {"date": "2019-08-30T06:24:42+00:00", "unit": "", "value": 0.06389999999999996, "name": "readout_error"}], [{"date": "2019-08-30T06:25:05+00:00", "unit": "\u00b5s", "value": 27.22545338386326, "name": "T1"}, {"date": "2019-08-30T06:27:17+00:00", "unit": "\u00b5s", "value": 55.30006621968561, "name": "T2"}, {"date": "2019-08-30T08:40:39+00:00", "unit": "GHz", "value": 5.067164115486811, "name": "frequency"}, {"date": "2019-08-30T06:24:42+00:00", "unit": "", "value": 0.05700000000000005, "name": "readout_error"}], [{"date": "2019-08-30T06:25:05+00:00", "unit": "\u00b5s", "value": 62.04463882018325, "name": "T1"}, {"date": "2019-08-30T06:28:16+00:00", "unit": "\u00b5s", "value": 61.95417571799565, "name": "T2"}, {"date": "2019-08-30T08:40:39+00:00", "unit": "GHz", "value": 4.923824384016654, "name": "frequency"}, {"date": "2019-08-30T06:24:42+00:00", "unit": "", "value": 0.07909999999999995, "name": "readout_error"}], [{"date": "2019-08-30T06:25:05+00:00", "unit": "\u00b5s", "value": 43.16853024912021, "name": "T1"}, {"date": "2019-08-30T06:29:16+00:00", "unit": "\u00b5s", "value": 58.427459338851314, "name": "T2"}, {"date": "2019-08-30T08:40:39+00:00", "unit": "GHz", "value": 4.974544202937344, "name": "frequency"}, {"date": "2019-08-30T06:24:42+00:00", "unit": "", "value": 0.06340000000000001, "name": "readout_error"}], [{"date": "2019-08-30T06:25:05+00:00", "unit": "\u00b5s", "value": 63.71797543850963, "name": "T1"}, {"date": "2019-08-30T06:26:18+00:00", "unit": "\u00b5s", "value": 88.67507787276234, "name": "T2"}, {"date": "2019-08-30T08:40:39+00:00", "unit": "GHz", "value": 4.739562250938468, "name": "frequency"}, {"date": "2019-08-30T06:24:42+00:00", "unit": "", "value": 0.034599999999999964, "name": "readout_error"}], [{"date": "2019-08-30T06:25:05+00:00", "unit": "\u00b5s", "value": 46.51934163391105, "name": "T1"}, {"date": "2019-08-30T06:28:16+00:00", "unit": "\u00b5s", "value": 81.94019993440179, "name": "T2"}, {"date": "2019-08-30T08:40:39+00:00", "unit": "GHz", "value": 4.963380996175847, "name": "frequency"}, {"date": "2019-08-30T06:24:42+00:00", "unit": "", "value": 0.034399999999999986, "name": "readout_error"}], [{"date": "2019-08-30T06:25:05+00:00", "unit": "\u00b5s", "value": 41.30403837241326, "name": "T1"}, {"date": "2019-08-30T06:27:17+00:00", "unit": "\u00b5s", "value": 51.44366097786817, "name": "T2"}, {"date": "2019-08-30T08:40:39+00:00", "unit": "GHz", "value": 4.945057612825996, "name": "frequency"}, {"date": "2019-08-30T06:24:42+00:00", "unit": "", "value": 0.062000000000000055, "name": "readout_error"}], [{"date": "2019-08-30T06:25:05+00:00", "unit": "\u00b5s", "value": 68.19724093725696, "name": "T1"}, {"date": "2019-08-30T06:28:16+00:00", "unit": "\u00b5s", "value": 116.05875432702656, "name": "T2"}, {"date": "2019-08-30T08:40:39+00:00", "unit": "GHz", "value": 5.005006866957911, "name": "frequency"}, {"date": "2019-08-30T06:24:42+00:00", "unit": "", "value": 0.03180000000000005, "name": "readout_error"}], [{"date": "2019-08-30T06:25:05+00:00", "unit": "\u00b5s", "value": 42.18872718994089, "name": "T1"}, {"date": "2019-08-30T06:27:17+00:00", "unit": "\u00b5s", "value": 72.39113698104636, "name": "T2"}, {"date": "2019-08-30T08:40:39+00:00", "unit": "GHz", "value": 4.759964985519018, "name": "frequency"}, {"date": "2019-08-30T06:24:42+00:00", "unit": "", "value": 0.05730000000000002, "name": "readout_error"}], [{"date": "2019-08-30T06:25:05+00:00", "unit": "\u00b5s", "value": 23.388913061674028, "name": "T1"}, {"date": "2019-08-30T06:26:18+00:00", "unit": "\u00b5s", "value": 49.568617451351685, "name": "T2"}, {"date": "2019-08-30T08:40:39+00:00", "unit": "GHz", "value": 4.968519920718844, "name": "frequency"}, {"date": "2019-08-30T06:24:42+00:00", "unit": "", "value": 0.05249999999999999, "name": "readout_error"}]], "gates": [{"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0, "name": "gate_error"}], "qubits": [0], "gate": "u1"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0022890476549879413, "name": "gate_error"}], "qubits": [0], "gate": "u2"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0045780953099758825, "name": "gate_error"}], "qubits": [0], "gate": "u3"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0, "name": "gate_error"}], "qubits": [1], "gate": "u1"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.011161011211293481, "name": "gate_error"}], "qubits": [1], "gate": "u2"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.022322022422586962, "name": "gate_error"}], "qubits": [1], "gate": "u3"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0, "name": "gate_error"}], "qubits": [2], "gate": "u1"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.004338853227556672, "name": "gate_error"}], "qubits": [2], "gate": "u2"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.008677706455113343, "name": "gate_error"}], "qubits": [2], "gate": "u3"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0, "name": "gate_error"}], "qubits": [3], "gate": "u1"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0012604117926789393, "name": "gate_error"}], "qubits": [3], "gate": "u2"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0025208235853578786, "name": "gate_error"}], "qubits": [3], "gate": "u3"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0, "name": "gate_error"}], "qubits": [4], "gate": "u1"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.004304021029278404, "name": "gate_error"}], "qubits": [4], "gate": "u2"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.008608042058556808, "name": "gate_error"}], "qubits": [4], "gate": "u3"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0, "name": "gate_error"}], "qubits": [5], "gate": "u1"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0022045855046065044, "name": "gate_error"}], "qubits": [5], "gate": "u2"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.004409171009213009, "name": "gate_error"}], "qubits": [5], "gate": "u3"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0, "name": "gate_error"}], "qubits": [6], "gate": "u1"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.003454676084759689, "name": "gate_error"}], "qubits": [6], "gate": "u2"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.006909352169519378, "name": "gate_error"}], "qubits": [6], "gate": "u3"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0, "name": "gate_error"}], "qubits": [7], "gate": "u1"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0016963998440643335, "name": "gate_error"}], "qubits": [7], "gate": "u2"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.003392799688128667, "name": "gate_error"}], "qubits": [7], "gate": "u3"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0, "name": "gate_error"}], "qubits": [8], "gate": "u1"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0016534919884557686, "name": "gate_error"}], "qubits": [8], "gate": "u2"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0033069839769115372, "name": "gate_error"}], "qubits": [8], "gate": "u3"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0, "name": "gate_error"}], "qubits": [9], "gate": "u1"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.002924197752053881, "name": "gate_error"}], "qubits": [9], "gate": "u2"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.005848395504107762, "name": "gate_error"}], "qubits": [9], "gate": "u3"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0, "name": "gate_error"}], "qubits": [10], "gate": "u1"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0019467418954691729, "name": "gate_error"}], "qubits": [10], "gate": "u2"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0038934837909383457, "name": "gate_error"}], "qubits": [10], "gate": "u3"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0, "name": "gate_error"}], "qubits": [11], "gate": "u1"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0015616057095417801, "name": "gate_error"}], "qubits": [11], "gate": "u2"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0031232114190835603, "name": "gate_error"}], "qubits": [11], "gate": "u3"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0, "name": "gate_error"}], "qubits": [12], "gate": "u1"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0038211298054479648, "name": "gate_error"}], "qubits": [12], "gate": "u2"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0076422596108959295, "name": "gate_error"}], "qubits": [12], "gate": "u3"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0, "name": "gate_error"}], "qubits": [13], "gate": "u1"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.007137874193502647, "name": "gate_error"}], "qubits": [13], "gate": "u2"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.014275748387005294, "name": "gate_error"}], "qubits": [13], "gate": "u3"}, {"parameters": [{"date": "2019-08-30T07:40:28+00:00", "unit": "", "value": 0.06766941423407083, "name": "gate_error"}], "qubits": [1, 0], "gate": "cx", "name": "CX1_0"}, {"parameters": [{"date": "2019-08-29T08:20:16+00:00", "unit": "", "value": 0.03801037092728929, "name": "gate_error"}], "qubits": [1, 2], "gate": "cx", "name": "CX1_2"}, {"parameters": [{"date": "2019-08-30T07:43:40+00:00", "unit": "", "value": 0.04035927412341517, "name": "gate_error"}], "qubits": [2, 3], "gate": "cx", "name": "CX2_3"}, {"parameters": [{"date": "2019-08-30T07:46:54+00:00", "unit": "", "value": 0.06554808443374471, "name": "gate_error"}], "qubits": [4, 3], "gate": "cx", "name": "CX4_3"}, {"parameters": [{"date": "2019-08-30T07:50:12+00:00", "unit": "", "value": 0.11000377135049015, "name": "gate_error"}], "qubits": [4, 10], "gate": "cx", "name": "CX4_10"}, {"parameters": [{"date": "2019-08-30T07:53:32+00:00", "unit": "", "value": 0.082271205303343, "name": "gate_error"}], "qubits": [5, 4], "gate": "cx", "name": "CX5_4"}, {"parameters": [{"date": "2019-08-30T07:56:51+00:00", "unit": "", "value": 0.08000264893528869, "name": "gate_error"}], "qubits": [5, 6], "gate": "cx", "name": "CX5_6"}, {"parameters": [{"date": "2019-08-30T08:00:47+00:00", "unit": "", "value": 0.053982705107386536, "name": "gate_error"}], "qubits": [5, 9], "gate": "cx", "name": "CX5_9"}, {"parameters": [{"date": "2019-08-30T08:04:12+00:00", "unit": "", "value": 0.044040614765997216, "name": "gate_error"}], "qubits": [6, 8], "gate": "cx", "name": "CX6_8"}, {"parameters": [{"date": "2019-08-30T08:07:39+00:00", "unit": "", "value": 0.03259217494162084, "name": "gate_error"}], "qubits": [7, 8], "gate": "cx", "name": "CX7_8"}, {"parameters": [{"date": "2019-08-30T08:10:56+00:00", "unit": "", "value": 0.05439659729448815, "name": "gate_error"}], "qubits": [9, 8], "gate": "cx", "name": "CX9_8"}, {"parameters": [{"date": "2019-08-30T08:15:16+00:00", "unit": "", "value": 0.05590172348391173, "name": "gate_error"}], "qubits": [9, 10], "gate": "cx", "name": "CX9_10"}, {"parameters": [{"date": "2019-08-30T08:25:02+00:00", "unit": "", "value": 0.03230502354557954, "name": "gate_error"}], "qubits": [11, 3], "gate": "cx", "name": "CX11_3"}, {"parameters": [{"date": "2019-08-30T08:18:40+00:00", "unit": "", "value": 0.04992714061173503, "name": "gate_error"}], "qubits": [11, 10], "gate": "cx", "name": "CX11_10"}, {"parameters": [{"date": "2019-08-30T08:21:50+00:00", "unit": "", "value": 0.0577565027812707, "name": "gate_error"}], "qubits": [11, 12], "gate": "cx", "name": "CX11_12"}, {"parameters": [{"date": "2019-08-30T08:28:18+00:00", "unit": "", "value": 0.07996541354812434, "name": "gate_error"}], "qubits": [12, 2], "gate": "cx", "name": "CX12_2"}, {"parameters": [{"date": "2019-08-30T08:32:48+00:00", "unit": "", "value": 0.20353725512052456, "name": "gate_error"}], "qubits": [13, 1], "gate": "cx", "name": "CX13_1"}, {"parameters": [{"date": "2019-08-30T08:36:49+00:00", "unit": "", "value": 0.06325184775759388, "name": "gate_error"}], "qubits": [13, 12], "gate": "cx", "name": "CX13_12"}]} \ No newline at end of file diff --git a/test/benchmarks/quantum_volume.py b/test/benchmarks/quantum_volume.py index d3c50e5bbc4a..56f352c838a0 100644 --- a/test/benchmarks/quantum_volume.py +++ b/test/benchmarks/quantum_volume.py @@ -24,6 +24,7 @@ import numpy as np from qiskit.providers.basicaer import QasmSimulatorPy +from .utils import build_qv_model_circuit try: from qiskit.mapper import two_qubit_kak @@ -41,32 +42,10 @@ except ImportError: from qiskit.transpiler import transpile -if NO_KAK: - from qiskit.quantum_info.random import random_unitary -else: +if not NO_KAK: from qiskit.tools.qi.qi import random_unitary_matrix -def build_model_circuit(width, depth, seed=None): - """ - The model circuits consist of layers of Haar random - elements of SU(4) applied between corresponding pairs - of qubits in a random bipartition. - """ - np.random.seed(seed) - circuit = QuantumCircuit(width) - # For each layer - for _ in range(depth): - # Generate uniformly random permutation Pj of [0...n-1] - perm = np.random.permutation(width) - # For each pair p in Pj, generate Haar random SU(4) - for k in range(int(np.floor(width/2))): - U = random_unitary(4) - pair = int(perm[2*k]), int(perm[2*k+1]) - circuit.append(U, [pair[0], pair[1]]) - return circuit - - def build_model_circuit_kak(width, depth, seed=None): """Create quantum volume model circuit on quantum register qreg of given depth (default depth is equal to width) and random seed. @@ -117,7 +96,7 @@ class QuantumVolumeBenchmark: def setup(self, width, depth): random_seed = np.random.seed(10) if NO_KAK: - self.circuit = build_model_circuit( + self.circuit = build_qv_model_circuit( width=width, depth=depth, seed=random_seed) else: self.circuit = build_model_circuit_kak(width, depth, random_seed) diff --git a/test/benchmarks/transpiler_levels.py b/test/benchmarks/transpiler_levels.py new file mode 100644 index 000000000000..67b6fde93d9c --- /dev/null +++ b/test/benchmarks/transpiler_levels.py @@ -0,0 +1,199 @@ +# -*- coding: utf-8 -*- + +# This code is part of Qiskit. +# +# (C) Copyright IBM 2019. +# +# This code is licensed under the Apache License, Version 2.0. You may +# obtain a copy of this license in the LICENSE.txt file in the root directory +# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. +# +# Any modifications or derivative works of this code must retain this +# copyright notice, and modified files need to carry a notice indicating +# that they have been altered from the originals. + +# pylint: disable=no-member,invalid-name,missing-docstring,no-name-in-module +# pylint: disable=attribute-defined-outside-init,unsubscriptable-object + +import os + +from qiskit.compiler import transpile +from qiskit import QuantumCircuit + +from .backends.fake_melbourne import FakeMelbourne +from .utils import build_qv_model_circuit + + +class TranspilerLevelBenchmarks: + params = [0, 1, 2, 3] + param_names = ['transpiler optimization level'] + timeout = 600 + + def setup(self, _): + self.rochester_coupling_map = [ + [0, 5], + [0, 1], + [1, 2], + [1, 0], + [2, 3], + [2, 1], + [3, 4], + [3, 2], + [4, 6], + [4, 3], + [5, 9], + [5, 0], + [6, 13], + [6, 4], + [7, 16], + [7, 8], + [8, 9], + [8, 7], + [9, 10], + [9, 8], + [9, 5], + [10, 11], + [10, 9], + [11, 17], + [11, 12], + [11, 10], + [12, 13], + [12, 11], + [13, 14], + [13, 12], + [13, 6], + [14, 15], + [14, 13], + [15, 18], + [15, 14], + [16, 19], + [16, 7], + [17, 23], + [17, 11], + [18, 27], + [18, 15], + [19, 20], + [19, 16], + [20, 21], + [20, 19], + [21, 28], + [21, 22], + [21, 20], + [22, 23], + [22, 21], + [23, 24], + [23, 22], + [23, 17], + [24, 25], + [24, 23], + [25, 29], + [25, 26], + [25, 24], + [26, 27], + [26, 25], + [27, 26], + [27, 18], + [28, 32], + [28, 21], + [29, 36], + [29, 25], + [30, 39], + [30, 31], + [31, 32], + [31, 30], + [32, 33], + [32, 31], + [32, 28], + [33, 34], + [33, 32], + [34, 40], + [34, 35], + [34, 33], + [35, 36], + [35, 34], + [36, 37], + [36, 35], + [36, 29], + [37, 38], + [37, 36], + [38, 41], + [38, 37], + [39, 42], + [39, 30], + [40, 46], + [40, 34], + [41, 50], + [41, 38], + [42, 43], + [42, 39], + [43, 44], + [43, 42], + [44, 51], + [44, 45], + [44, 43], + [45, 46], + [45, 44], + [46, 47], + [46, 45], + [46, 40], + [47, 48], + [47, 46], + [48, 52], + [48, 49], + [48, 47], + [49, 50], + [49, 48], + [50, 49], + [50, 41], + [51, 44], + [52, 48]] + self.basis_gates = ['u1', 'u2', 'u3', 'cx', 'id'] + self.qv_50_x_20 = build_qv_model_circuit(50, 20, 0) + self.qv_14_x_14 = build_qv_model_circuit(14, 14, 0) + self.qasm_path = os.path.abspath( + os.path.join(os.path.dirname(__file__), 'qasm')) + large_qasm_path = os.path.join(self.qasm_path, 'test_eoh_qasm.qasm') + self.large_qasm = QuantumCircuit.from_qasm_file(large_qasm_path) + self.melbourne = FakeMelbourne() + + def time_quantum_volume_transpile_50_x_20(self, transpiler_level): + transpile(self.qv_50_x_20, basis_gates=self.basis_gates, + coupling_map=self.rochester_coupling_map, + seed_transpiler=0, + optimization_level=transpiler_level) + + def track_depth_quantum_volume_transpile_50_x_20(self, transpiler_level): + return transpile(self.qv_50_x_20, basis_gates=self.basis_gates, + coupling_map=self.rochester_coupling_map, + seed_transpiler=0, + optimization_level=transpiler_level).depth() + + def time_transpile_from_large_qasm(self, transpiler_level): + transpile(self.large_qasm, basis_gates=self.basis_gates, + coupling_map=self.rochester_coupling_map, + seed_transpiler=0, + optimization_level=transpiler_level) + + def track_depth_transpile_from_large_qasm(self, transpiler_level): + return transpile(self.large_qasm, basis_gates=self.basis_gates, + coupling_map=self.rochester_coupling_map, + seed_transpiler=0, + optimization_level=transpiler_level).depth() + + def time_transpile_from_large_qasm_backend_with_prop(self, + transpiler_level): + transpile(self.large_qasm, self.melbourne, seed_transpiler=0, + optimization_level=transpiler_level) + + def track_depth_transpile_from_large_qasm_backend_with_prop( + self, transpiler_level): + return transpile(self.large_qasm, self.melbourne, seed_transpiler=0, + optimization_level=transpiler_level).depth() + + def time_transpile_qv_14_x_14(self, transpiler_level): + transpile(self.qv_14_x_14, self.melbourne, seed_transpiler=0, + optimization_level=transpiler_level) + + def track_depth_transpile_qv_14_x_14(self, transpiler_level): + return transpile(self.qv_14_x_14, self.melbourne, seed_transpiler=0, + optimization_level=transpiler_level).depth() diff --git a/test/benchmarks/utils.py b/test/benchmarks/utils.py new file mode 100644 index 000000000000..c675a1c3d9ee --- /dev/null +++ b/test/benchmarks/utils.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- + +# This code is part of Qiskit. +# +# (C) Copyright IBM 2019. +# +# This code is licensed under the Apache License, Version 2.0. You may +# obtain a copy of this license in the LICENSE.txt file in the root directory +# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. +# +# Any modifications or derivative works of this code must retain this +# copyright notice, and modified files need to carry a notice indicating +# that they have been altered from the originals. + +# pylint: disable=invalid-name + +"""Benchmark utility functions.""" + +import numpy as np +from qiskit.quantum_info.random import random_unitary +from qiskit import QuantumCircuit + + +def build_qv_model_circuit(width, depth, seed=None): + """ + The model circuits consist of layers of Haar random + elements of SU(4) applied between corresponding pairs + of qubits in a random bipartition. + """ + np.random.seed(seed) + circuit = QuantumCircuit(width) + # For each layer + for _ in range(depth): + # Generate uniformly random permutation Pj of [0...n-1] + perm = np.random.permutation(width) + # For each pair p in Pj, generate Haar random SU(4) + for k in range(int(np.floor(width/2))): + U = random_unitary(4) + pair = int(perm[2*k]), int(perm[2*k+1]) + circuit.append(U, [pair[0], pair[1]]) + return circuit From 826299bdb2a5ba20d58e3c3470300581930d964c Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Tue, 15 Oct 2019 07:59:30 -0400 Subject: [PATCH 20/61] Add benchmarks for converter functions (Qiskit/qiskit-metapackage#628) * Add benchmarks for converter functions This commit adds benchmarks for the converter functions. The converter functions are normally quick to execute but are commonly used as part of other operations. For example circuit_to_dag and dag_to_circuit get called under the covers during transpile() calls. Individually benchmarking the performance of them is useful so we can isolate and track their performance, even if it's normally only a small percentage of a larger operation. * Pivot to use random circuit The benchmarks now use a randomly generated circuit (with a fixed seed for consistency) of varying sizes to test different cases. In the future we can add additional types of circuits to try and test additional worst case edge cases. * Fix lint * Fix lint for real * Add comment about skips --- test/benchmarks/converters.py | 56 +++++++++++++++++++ test/benchmarks/utils.py | 100 +++++++++++++++++++++++++++++++++- 2 files changed, 154 insertions(+), 2 deletions(-) create mode 100644 test/benchmarks/converters.py diff --git a/test/benchmarks/converters.py b/test/benchmarks/converters.py new file mode 100644 index 000000000000..5e6fbc3a94cc --- /dev/null +++ b/test/benchmarks/converters.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- + +# This code is part of Qiskit. +# +# (C) Copyright IBM 2019. +# +# This code is licensed under the Apache License, Version 2.0. You may +# obtain a copy of this license in the LICENSE.txt file in the root directory +# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. +# +# Any modifications or derivative works of this code must retain this +# copyright notice, and modified files need to carry a notice indicating +# that they have been altered from the originals. + +# pylint: disable=no-member,invalid-name,missing-docstring,no-name-in-module +# pylint: disable=attribute-defined-outside-init,unsubscriptable-object + +from qiskit import converters +from qiskit import qasm + +from .utils import random_circuit + + +class ConverterBenchmarks: + params = ([1, 2, 5, 8, 14, 20, 32, 53], [8, 128, 2048, 8192]) + param_names = ['n_qubits', 'depth'] + timeout = 600 + + def setup(self, n_qubits, depth): + seed = 42 + # NOTE: Remove the benchmarks larger than 20x2048 and 14x8192, this is + # a tradeoff for speed of benchmarking, creating circuits this size + # takes more time than is worth it for benchmarks that take a couple + # seconds + if n_qubits >= 20: + if depth >= 2048: + raise NotImplementedError + elif n_qubits == 14: + if depth > 2048: + raise NotImplementedError + self.qc = random_circuit(n_qubits, depth, measure=True, + conditional=True, seed=seed) + self.dag = converters.circuit_to_dag(self.qc) + self.qasm = qasm.Qasm(data=self.qc.qasm()).parse() + + def time_circuit_to_dag(self, *_): + converters.circuit_to_dag(self.qc) + + def time_circuit_to_instruction(self, *_): + converters.circuit_to_instruction(self.qc) + + def time_dag_to_circuit(self, *_): + converters.dag_to_circuit(self.dag) + + def time_ast_to_circuit(self, *_): + converters.ast_to_dag(self.qasm) diff --git a/test/benchmarks/utils.py b/test/benchmarks/utils.py index c675a1c3d9ee..4debae30ee94 100644 --- a/test/benchmarks/utils.py +++ b/test/benchmarks/utils.py @@ -12,13 +12,109 @@ # copyright notice, and modified files need to carry a notice indicating # that they have been altered from the originals. -# pylint: disable=invalid-name +# pylint: disable=invalid-name,no-member """Benchmark utility functions.""" import numpy as np + from qiskit.quantum_info.random import random_unitary -from qiskit import QuantumCircuit +from qiskit.circuit import QuantumRegister, ClassicalRegister, QuantumCircuit +from qiskit.circuit import Reset +from qiskit.extensions import (IdGate, U1Gate, U2Gate, U3Gate, XGate, + YGate, ZGate, HGate, SGate, SdgGate, TGate, + TdgGate, RXGate, RYGate, RZGate, CnotGate, + CyGate, CzGate, CHGate, CrzGate, Cu1Gate, + Cu3Gate, SwapGate, RZZGate, + ToffoliGate, FredkinGate) + + +def random_circuit(n_qubits, depth, max_operands=3, measure=False, + conditional=False, reset=False, seed=None): + """Generate random circuit of arbitrary size and form. + + Args: + n_qubits (int): number of quantum wires + depth (int): layers of operations (i.e. critical path length) + max_operands (int): maximum operands of each gate (between 1 and 3) + measure (bool): if True, measure all qubits at the end + conditional (bool): if True, insert middle measurements and + conditionals + reset (bool): if True, insert middle resets + seed (int): sets random seed (optional) + + Returns: + QuantumCircuit: constructed circuit + + Raises: + Exception: when invalid options given + """ + if max_operands < 1 or max_operands > 3: + raise Exception("max_operands must be between 1 and 3") + + one_q_ops = [IdGate, U1Gate, U2Gate, U3Gate, XGate, YGate, ZGate, + HGate, SGate, SdgGate, TGate, TdgGate, RXGate, RYGate, RZGate] + one_param = [U1Gate, RXGate, RYGate, RZGate, RZZGate, Cu1Gate, CrzGate] + two_param = [U2Gate] + three_param = [U3Gate, Cu3Gate] + two_q_ops = [CnotGate, CyGate, CzGate, CHGate, CrzGate, + Cu1Gate, Cu3Gate, SwapGate, RZZGate] + three_q_ops = [ToffoliGate, FredkinGate] + + qr = QuantumRegister(n_qubits, 'q') + qc = QuantumCircuit(n_qubits) + + if measure or conditional: + cr = ClassicalRegister(n_qubits, 'c') + qc.add_register(cr) + + if reset: + one_q_ops += [Reset] + + if seed is None: + seed = np.random.randint(0, np.iinfo(np.int32).max) + rng = np.random.RandomState(seed) + + # apply arbitrary random operations at every depth + for _ in range(depth): + # choose either 1, 2, or 3 qubits for the operation + remaining_qubits = list(range(n_qubits)) + while remaining_qubits: + max_possible_operands = min(len(remaining_qubits), max_operands) + num_operands = rng.choice(range(max_possible_operands)) + 1 + rng.shuffle(remaining_qubits) + operands = remaining_qubits[:num_operands] + remaining_qubits = [ + q for q in remaining_qubits if q not in operands] + if num_operands == 1: + operation = rng.choice(one_q_ops) + elif num_operands == 2: + operation = rng.choice(two_q_ops) + elif num_operands == 3: + operation = rng.choice(three_q_ops) + if operation in one_param: + num_angles = 1 + elif operation in two_param: + num_angles = 2 + elif operation in three_param: + num_angles = 3 + else: + num_angles = 0 + angles = [rng.uniform(0, 2*np.pi) for x in range(num_angles)] + register_operands = [qr[i] for i in operands] + op = operation(*angles) + + # with some low probability, condition on classical bit values + if conditional and rng.choice(range(10)) == 0: + value = rng.randint(0, np.power(2, n_qubits)) + op.condition = (cr, value) + + qc.append(op, register_operands) + + if measure: + qc.measure(qr, cr) + + return qc def build_qv_model_circuit(width, depth, seed=None): From ceea74373aa79d833dd926b144e6ced1cacd61d5 Mon Sep 17 00:00:00 2001 From: Kevin Krsulich Date: Fri, 25 Oct 2019 08:17:56 -0400 Subject: [PATCH 21/61] Assemble circuits and transpiler peakmem benchmarks (Qiskit/qiskit-metapackage#641) Adds a peakmem tracking for transpiler_level benchmarks, and a benchmark for assemble_circuits. * Add peakmem versions of transpiler level benchmarks. * Add assemble_circuit benchmark. * Import assemble from qiskit.compile. --- test/benchmarks/assembler.py | 35 ++++++++++++++++++++++++++++ test/benchmarks/transpiler_levels.py | 21 +++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 test/benchmarks/assembler.py diff --git a/test/benchmarks/assembler.py b/test/benchmarks/assembler.py new file mode 100644 index 000000000000..1672c694d78e --- /dev/null +++ b/test/benchmarks/assembler.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- + +# This code is part of Qiskit. +# +# (C) Copyright IBM 2019. +# +# This code is licensed under the Apache License, Version 2.0. You may +# obtain a copy of this license in the LICENSE.txt file in the root directory +# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. +# +# Any modifications or derivative works of this code must retain this +# copyright notice, and modified files need to carry a notice indicating +# that they have been altered from the originals. + +# pylint: disable=no-member,invalid-name,missing-docstring,no-name-in-module +# pylint: disable=attribute-defined-outside-init,unsubscriptable-object + +from qiskit.compiler import assemble + +from .utils import random_circuit + + +class AssemblerBenchmarks: + params = ([1, 2, 5, 8], + [8, 128, 1024, 2048, 4096]) + param_names = ['n_qubits', 'depth'] + timeout = 600 + + def setup(self, n_qubits, depth): + seed = 42 + self.circuit = random_circuit(n_qubits, depth, measure=True, + conditional=True, seed=seed) + + def time_assemble_circuit(self, _, __): + assemble(self.circuit) diff --git a/test/benchmarks/transpiler_levels.py b/test/benchmarks/transpiler_levels.py index 67b6fde93d9c..073dae24360f 100644 --- a/test/benchmarks/transpiler_levels.py +++ b/test/benchmarks/transpiler_levels.py @@ -162,6 +162,12 @@ def time_quantum_volume_transpile_50_x_20(self, transpiler_level): seed_transpiler=0, optimization_level=transpiler_level) + def peakmem_quantum_volume_transpile_50_x_20(self, transpiler_level): + transpile(self.qv_50_x_20, basis_gates=self.basis_gates, + coupling_map=self.rochester_coupling_map, + seed_transpiler=0, + optimization_level=transpiler_level) + def track_depth_quantum_volume_transpile_50_x_20(self, transpiler_level): return transpile(self.qv_50_x_20, basis_gates=self.basis_gates, coupling_map=self.rochester_coupling_map, @@ -174,6 +180,12 @@ def time_transpile_from_large_qasm(self, transpiler_level): seed_transpiler=0, optimization_level=transpiler_level) + def peakmem_transpile_from_large_qasm(self, transpiler_level): + transpile(self.large_qasm, basis_gates=self.basis_gates, + coupling_map=self.rochester_coupling_map, + seed_transpiler=0, + optimization_level=transpiler_level) + def track_depth_transpile_from_large_qasm(self, transpiler_level): return transpile(self.large_qasm, basis_gates=self.basis_gates, coupling_map=self.rochester_coupling_map, @@ -185,6 +197,11 @@ def time_transpile_from_large_qasm_backend_with_prop(self, transpile(self.large_qasm, self.melbourne, seed_transpiler=0, optimization_level=transpiler_level) + def peakmem_transpile_from_large_qasm_backend_with_prop(self, + transpiler_level): + transpile(self.large_qasm, self.melbourne, seed_transpiler=0, + optimization_level=transpiler_level) + def track_depth_transpile_from_large_qasm_backend_with_prop( self, transpiler_level): return transpile(self.large_qasm, self.melbourne, seed_transpiler=0, @@ -194,6 +211,10 @@ def time_transpile_qv_14_x_14(self, transpiler_level): transpile(self.qv_14_x_14, self.melbourne, seed_transpiler=0, optimization_level=transpiler_level) + def peakmem_transpile_qv_14_x_14(self, transpiler_level): + transpile(self.qv_14_x_14, self.melbourne, seed_transpiler=0, + optimization_level=transpiler_level) + def track_depth_transpile_qv_14_x_14(self, transpiler_level): return transpile(self.qv_14_x_14, self.melbourne, seed_transpiler=0, optimization_level=transpiler_level).depth() From af652ded8ab74d47c3c3c326d37bced03ff26cf0 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Mon, 25 Nov 2019 23:32:05 +0900 Subject: [PATCH 22/61] Add benchmarks for mapping passes (Qiskit/qiskit-metapackage#699) * Add benchmarks for mapping passes This commit adds new benchmark methods for mapping passes. There are 2 benchmarks for each analysis pass that track the run time of the pass and the memory consumption. Then for transformation passes a third benchmark is added to track the depth after the pass is run. For swap mappers a 4th benchmark also keeping track of how many swap gates are in the circuit. * Fix lint The linter fails because two passes have not been released yet, this commit disables this check for the file so we can run the benchmark for these new passes. * Add python-constraint to asv venv The csp layout pass uses python-constraint which is an optional dependency. This needs to be manually installed to make the csp layout pass benchmarks work, this commit adds it to the list of dependencies installed. --- test/benchmarks/backends/fake_singapore.py | 73 ++++++ test/benchmarks/backends/props_singapore.json | 1 + test/benchmarks/mapping_passes.py | 219 ++++++++++++++++++ 3 files changed, 293 insertions(+) create mode 100644 test/benchmarks/backends/fake_singapore.py create mode 100644 test/benchmarks/backends/props_singapore.json create mode 100644 test/benchmarks/mapping_passes.py diff --git a/test/benchmarks/backends/fake_singapore.py b/test/benchmarks/backends/fake_singapore.py new file mode 100644 index 000000000000..321aaab3361d --- /dev/null +++ b/test/benchmarks/backends/fake_singapore.py @@ -0,0 +1,73 @@ +# -*- coding: utf-8 -*- + +# This code is part of Qiskit. +# +# (C) Copyright IBM 2019. +# +# This code is licensed under the Apache License, Version 2.0. You may +# obtain a copy of this license in the LICENSE.txt file in the root directory +# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. +# +# Any modifications or derivative works of this code must retain this +# copyright notice, and modified files need to carry a notice indicating +# that they have been altered from the originals. + +""" +Fake Boeblingen device (20 qubit). +""" + +import os +import json + +from qiskit.providers.models import (GateConfig, QasmBackendConfiguration, + BackendProperties) +from qiskit.test.mock.fake_backend import FakeBackend + + +class FakeSingapore(FakeBackend): + """A fake Singapore backend.""" + + def __init__(self): + """ + 00 ↔ 01 ↔ 02 ↔ 03 ↔ 04 + ↕ ↕ + 05 ↔ 06 ↔ 07 ↔ 08 ↔ 09 + ↕ ↕ ↕ + 10 ↔ 11 ↔ 12 ↔ 13 ↔ 14 + ↕ ↕ + 15 ↔ 16 ↔ 17 ↔ 18 ↔ 19 + """ + cmap = [[0, 1], [1, 0], [1, 2], [1, 6], [2, 1], [2, 3], [3, 2], + [3, 4], [3, 8], [4, 3], [5, 6], [5, 10], [6, 1], [6, 5], + [6, 7], [7, 6], [7, 8], [7, 12], [8, 3], [8, 7], [8, 9], + [9, 8], [9, 14], [10, 5], [10, 11], [11, 10], [11, 12], + [11, 16], [12, 7], [12, 11], [12, 13], [13, 12], [13, 14], + [13, 18], [14, 9], [14, 13], [15, 16], [16, 11], [16, 15], + [16, 17], [17, 16], [17, 18], [18, 13], [18, 17], [18, 19], + [19, 18]] + + configuration = QasmBackendConfiguration( + backend_name='fake_singapore', + backend_version='0.0.0', + n_qubits=20, + basis_gates=['u1', 'u2', 'u3', 'cx', 'id'], + simulator=False, + local=True, + conditional=False, + open_pulse=False, + memory=True, + max_shots=8192, + gates=[GateConfig(name='TODO', parameters=[], qasm_def='TODO')], + coupling_map=cmap, + ) + + super().__init__(configuration) + + def properties(self): + """Returns a snapshot of device properties as recorded on 10/08/19. + """ + dirname = os.path.dirname(__file__) + filename = "props_singapore.json" + with open(os.path.join(dirname, filename), "r") as f_prop: + props = json.load(f_prop) + return BackendProperties.from_dict(props) diff --git a/test/benchmarks/backends/props_singapore.json b/test/benchmarks/backends/props_singapore.json new file mode 100644 index 000000000000..bd460403197e --- /dev/null +++ b/test/benchmarks/backends/props_singapore.json @@ -0,0 +1 @@ +{"general": [], "qubits": [[{"date": "2019-10-07T10:10:07+00:00", "unit": "\u00b5s", "value": 98.50001846063365, "name": "T1"}, {"date": "2019-10-07T10:11:53+00:00", "unit": "\u00b5s", "value": 142.79433528474766, "name": "T2"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "GHz", "value": 4.676715786802928, "name": "frequency"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.028000000000000025, "name": "readout_error"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.04, "name": "prob_meas0_prep1"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.016000000000000014, "name": "prob_meas1_prep0"}], [{"date": "2019-10-05T10:14:29+00:00", "unit": "\u00b5s", "value": 71.8423910064075, "name": "T1"}, {"date": "2019-10-07T10:13:37+00:00", "unit": "\u00b5s", "value": 86.1000420353437, "name": "T2"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "GHz", "value": 4.782680699300517, "name": "frequency"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.03500000000000003, "name": "readout_error"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.05800000000000005, "name": "prob_meas0_prep1"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.012, "name": "prob_meas1_prep0"}], [{"date": "2019-10-07T10:10:07+00:00", "unit": "\u00b5s", "value": 54.586493833620445, "name": "T1"}, {"date": "2019-10-07T10:11:53+00:00", "unit": "\u00b5s", "value": 64.28987220978689, "name": "T2"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "GHz", "value": 4.685409810699721, "name": "frequency"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.02750000000000008, "name": "readout_error"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.040000000000000036, "name": "prob_meas0_prep1"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.015, "name": "prob_meas1_prep0"}], [{"date": "2019-10-07T10:10:07+00:00", "unit": "\u00b5s", "value": 71.88906145160064, "name": "T1"}, {"date": "2019-10-07T10:13:37+00:00", "unit": "\u00b5s", "value": 100.29926276217378, "name": "T2"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "GHz", "value": 4.716928039422963, "name": "frequency"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.031000000000000028, "name": "readout_error"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.049000000000000044, "name": "prob_meas0_prep1"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.013, "name": "prob_meas1_prep0"}], [{"date": "2019-10-07T10:10:07+00:00", "unit": "\u00b5s", "value": 52.770110881257324, "name": "T1"}, {"date": "2019-10-07T10:11:53+00:00", "unit": "\u00b5s", "value": 61.064644709448174, "name": "T2"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "GHz", "value": 4.564662441799778, "name": "frequency"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.024499999999999966, "name": "readout_error"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.04400000000000004, "name": "prob_meas0_prep1"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.005, "name": "prob_meas1_prep0"}], [{"date": "2019-10-07T10:10:07+00:00", "unit": "\u00b5s", "value": 106.63080350740401, "name": "T1"}, {"date": "2019-10-07T10:11:53+00:00", "unit": "\u00b5s", "value": 63.847221711183266, "name": "T2"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "GHz", "value": 4.3093990890670115, "name": "frequency"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.05049999999999999, "name": "readout_error"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.05700000000000005, "name": "prob_meas0_prep1"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.044, "name": "prob_meas1_prep0"}], [{"date": "2019-10-07T10:10:07+00:00", "unit": "\u00b5s", "value": 53.25798980049998, "name": "T1"}, {"date": "2019-10-07T10:25:34+00:00", "unit": "\u00b5s", "value": 59.50768130704096, "name": "T2"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "GHz", "value": 4.662502738898581, "name": "frequency"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.03500000000000003, "name": "readout_error"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.05300000000000005, "name": "prob_meas0_prep1"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.017, "name": "prob_meas1_prep0"}], [{"date": "2019-10-07T10:10:07+00:00", "unit": "\u00b5s", "value": 70.7178193327572, "name": "T1"}, {"date": "2019-09-30T09:12:16+00:00", "unit": "\u00b5s", "value": 91.5454015797137, "name": "T2"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "GHz", "value": 4.83100170618901, "name": "frequency"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.034499999999999975, "name": "readout_error"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.04400000000000004, "name": "prob_meas0_prep1"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.025, "name": "prob_meas1_prep0"}], [{"date": "2019-10-05T10:14:29+00:00", "unit": "\u00b5s", "value": 81.4823552465602, "name": "T1"}, {"date": "2019-10-07T10:25:34+00:00", "unit": "\u00b5s", "value": 80.29259328068997, "name": "T2"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "GHz", "value": 4.623118095677056, "name": "frequency"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.04200000000000004, "name": "readout_error"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.05700000000000005, "name": "prob_meas0_prep1"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.027, "name": "prob_meas1_prep0"}], [{"date": "2019-10-06T09:52:34+00:00", "unit": "\u00b5s", "value": 75.22358280239378, "name": "T1"}, {"date": "2019-10-04T10:03:13+00:00", "unit": "\u00b5s", "value": 33.6275779166682, "name": "T2"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "GHz", "value": 4.697684600011119, "name": "frequency"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.040000000000000036, "name": "readout_error"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.05600000000000005, "name": "prob_meas0_prep1"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.024, "name": "prob_meas1_prep0"}], [{"date": "2019-10-07T10:10:07+00:00", "unit": "\u00b5s", "value": 70.98747296573573, "name": "T1"}, {"date": "2019-10-07T10:13:37+00:00", "unit": "\u00b5s", "value": 113.20586880438636, "name": "T2"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "GHz", "value": 4.424172526087491, "name": "frequency"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.02849999999999997, "name": "readout_error"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.04500000000000004, "name": "prob_meas0_prep1"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.012, "name": "prob_meas1_prep0"}], [{"date": "2019-10-07T10:10:07+00:00", "unit": "\u00b5s", "value": 49.81041273082784, "name": "T1"}, {"date": "2019-10-07T10:11:53+00:00", "unit": "\u00b5s", "value": 72.19589834748233, "name": "T2"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "GHz", "value": 4.521513114099939, "name": "frequency"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.03400000000000003, "name": "readout_error"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.061, "name": "prob_meas0_prep1"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.007000000000000006, "name": "prob_meas1_prep0"}], [{"date": "2019-10-07T10:10:07+00:00", "unit": "\u00b5s", "value": 82.5827071619044, "name": "T1"}, {"date": "2019-10-07T10:13:37+00:00", "unit": "\u00b5s", "value": 141.83075197141548, "name": "T2"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "GHz", "value": 4.603498735627486, "name": "frequency"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.034499999999999975, "name": "readout_error"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.05500000000000005, "name": "prob_meas0_prep1"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.014, "name": "prob_meas1_prep0"}], [{"date": "2019-10-07T10:10:07+00:00", "unit": "\u00b5s", "value": 95.85019354756015, "name": "T1"}, {"date": "2019-10-07T10:11:53+00:00", "unit": "\u00b5s", "value": 131.6531371896787, "name": "T2"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "GHz", "value": 4.624418341917924, "name": "frequency"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.027000000000000024, "name": "readout_error"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.03500000000000003, "name": "prob_meas0_prep1"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.019, "name": "prob_meas1_prep0"}], [{"date": "2019-10-07T10:10:07+00:00", "unit": "\u00b5s", "value": 35.88916991811218, "name": "T1"}, {"date": "2019-10-07T10:13:37+00:00", "unit": "\u00b5s", "value": 62.03490787220797, "name": "T2"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "GHz", "value": 4.757476384494219, "name": "frequency"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.024499999999999966, "name": "readout_error"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.03700000000000003, "name": "prob_meas0_prep1"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.012, "name": "prob_meas1_prep0"}], [{"date": "2019-10-06T09:52:34+00:00", "unit": "\u00b5s", "value": 104.68198729947855, "name": "T1"}, {"date": "2019-10-07T10:11:53+00:00", "unit": "\u00b5s", "value": 57.97422234961757, "name": "T2"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "GHz", "value": 4.488504164049106, "name": "frequency"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.033500000000000085, "name": "readout_error"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.05600000000000005, "name": "prob_meas0_prep1"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.011, "name": "prob_meas1_prep0"}], [{"date": "2019-10-07T10:10:07+00:00", "unit": "\u00b5s", "value": 92.36366680998361, "name": "T1"}, {"date": "2019-10-07T10:13:37+00:00", "unit": "\u00b5s", "value": 94.59861170877572, "name": "T2"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "GHz", "value": 4.738439313844244, "name": "frequency"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.027000000000000024, "name": "readout_error"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.039000000000000035, "name": "prob_meas0_prep1"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.015, "name": "prob_meas1_prep0"}], [{"date": "2019-10-07T10:10:07+00:00", "unit": "\u00b5s", "value": 107.49950920916586, "name": "T1"}, {"date": "2019-10-07T10:11:53+00:00", "unit": "\u00b5s", "value": 133.11941489971574, "name": "T2"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "GHz", "value": 4.8824966313847975, "name": "frequency"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.03049999999999997, "name": "readout_error"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.04700000000000004, "name": "prob_meas0_prep1"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.014, "name": "prob_meas1_prep0"}], [{"date": "2019-10-03T09:48:38+00:00", "unit": "\u00b5s", "value": 105.19080597037585, "name": "T1"}, {"date": "2019-10-07T10:13:37+00:00", "unit": "\u00b5s", "value": 111.7410815464684, "name": "T2"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "GHz", "value": 4.5284500512834285, "name": "frequency"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.08450000000000002, "name": "readout_error"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.101, "name": "prob_meas0_prep1"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.06799999999999995, "name": "prob_meas1_prep0"}], [{"date": "2019-10-04T10:01:26+00:00", "unit": "\u00b5s", "value": 129.411447716364, "name": "T1"}, {"date": "2019-10-04T10:03:13+00:00", "unit": "\u00b5s", "value": 94.47076929782332, "name": "T2"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "GHz", "value": 4.6976528478044095, "name": "frequency"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.04200000000000004, "name": "readout_error"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.06499999999999995, "name": "prob_meas0_prep1"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.019, "name": "prob_meas1_prep0"}]], "gates": [{"qubits": [0], "gate": "id", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0005688851193218149, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "id_0"}, {"qubits": [0], "gate": "u1", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 0.0, "name": "gate_length"}], "name": "u1_0"}, {"qubits": [0], "gate": "u2", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0005688851193218149, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "u2_0"}, {"qubits": [0], "gate": "u3", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0011377702386436298, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 71.11111111111111, "name": "gate_length"}], "name": "u3_0"}, {"qubits": [1], "gate": "id", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.0005995105803450207, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "id_1"}, {"qubits": [1], "gate": "u1", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.0, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 0.0, "name": "gate_length"}], "name": "u1_1"}, {"qubits": [1], "gate": "u2", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.0005995105803450207, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "u2_1"}, {"qubits": [1], "gate": "u3", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.0011990211606900413, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 71.11111111111111, "name": "gate_length"}], "name": "u3_1"}, {"qubits": [2], "gate": "id", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0022127694703092497, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "id_2"}, {"qubits": [2], "gate": "u1", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 0.0, "name": "gate_length"}], "name": "u1_2"}, {"qubits": [2], "gate": "u2", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0022127694703092497, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "u2_2"}, {"qubits": [2], "gate": "u3", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0044255389406184995, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 71.11111111111111, "name": "gate_length"}], "name": "u3_2"}, {"qubits": [3], "gate": "id", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.0009010448455703253, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "id_3"}, {"qubits": [3], "gate": "u1", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.0, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 0.0, "name": "gate_length"}], "name": "u1_3"}, {"qubits": [3], "gate": "u2", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.0009010448455703253, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "u2_3"}, {"qubits": [3], "gate": "u3", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.0018020896911406506, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 71.11111111111111, "name": "gate_length"}], "name": "u3_3"}, {"qubits": [4], "gate": "id", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.00022510791737658382, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "id_4"}, {"qubits": [4], "gate": "u1", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 0.0, "name": "gate_length"}], "name": "u1_4"}, {"qubits": [4], "gate": "u2", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.00022510791737658382, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "u2_4"}, {"qubits": [4], "gate": "u3", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.00045021583475316764, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 71.11111111111111, "name": "gate_length"}], "name": "u3_4"}, {"qubits": [5], "gate": "id", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.00037422191608514393, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "id_5"}, {"qubits": [5], "gate": "u1", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 0.0, "name": "gate_length"}], "name": "u1_5"}, {"qubits": [5], "gate": "u2", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.00037422191608514393, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "u2_5"}, {"qubits": [5], "gate": "u3", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0007484438321702879, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 71.11111111111111, "name": "gate_length"}], "name": "u3_5"}, {"qubits": [6], "gate": "id", "parameters": [{"date": "2019-10-07T10:41:33+00:00", "unit": "", "value": 0.000378362284572259, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "id_6"}, {"qubits": [6], "gate": "u1", "parameters": [{"date": "2019-10-07T10:41:33+00:00", "unit": "", "value": 0.0, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 0.0, "name": "gate_length"}], "name": "u1_6"}, {"qubits": [6], "gate": "u2", "parameters": [{"date": "2019-10-07T10:41:33+00:00", "unit": "", "value": 0.000378362284572259, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "u2_6"}, {"qubits": [6], "gate": "u3", "parameters": [{"date": "2019-10-07T10:41:33+00:00", "unit": "", "value": 0.000756724569144518, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 71.11111111111111, "name": "gate_length"}], "name": "u3_6"}, {"qubits": [7], "gate": "id", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0004125770256412488, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "id_7"}, {"qubits": [7], "gate": "u1", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 0.0, "name": "gate_length"}], "name": "u1_7"}, {"qubits": [7], "gate": "u2", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0004125770256412488, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "u2_7"}, {"qubits": [7], "gate": "u3", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0008251540512824976, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 71.11111111111111, "name": "gate_length"}], "name": "u3_7"}, {"qubits": [8], "gate": "id", "parameters": [{"date": "2019-10-07T10:41:33+00:00", "unit": "", "value": 0.0005417535111698166, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "id_8"}, {"qubits": [8], "gate": "u1", "parameters": [{"date": "2019-10-07T10:41:33+00:00", "unit": "", "value": 0.0, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 0.0, "name": "gate_length"}], "name": "u1_8"}, {"qubits": [8], "gate": "u2", "parameters": [{"date": "2019-10-07T10:41:33+00:00", "unit": "", "value": 0.0005417535111698166, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "u2_8"}, {"qubits": [8], "gate": "u3", "parameters": [{"date": "2019-10-07T10:41:33+00:00", "unit": "", "value": 0.0010835070223396332, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 71.11111111111111, "name": "gate_length"}], "name": "u3_8"}, {"qubits": [9], "gate": "id", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0003155501728177163, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "id_9"}, {"qubits": [9], "gate": "u1", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 0.0, "name": "gate_length"}], "name": "u1_9"}, {"qubits": [9], "gate": "u2", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0003155501728177163, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "u2_9"}, {"qubits": [9], "gate": "u3", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0006311003456354326, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 71.11111111111111, "name": "gate_length"}], "name": "u3_9"}, {"qubits": [10], "gate": "id", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.0005368264006968577, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "id_10"}, {"qubits": [10], "gate": "u1", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.0, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 0.0, "name": "gate_length"}], "name": "u1_10"}, {"qubits": [10], "gate": "u2", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.0005368264006968577, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "u2_10"}, {"qubits": [10], "gate": "u3", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.0010736528013937153, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 71.11111111111111, "name": "gate_length"}], "name": "u3_10"}, {"qubits": [11], "gate": "id", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0004105472539004482, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "id_11"}, {"qubits": [11], "gate": "u1", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 0.0, "name": "gate_length"}], "name": "u1_11"}, {"qubits": [11], "gate": "u2", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0004105472539004482, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "u2_11"}, {"qubits": [11], "gate": "u3", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0008210945078008964, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 71.11111111111111, "name": "gate_length"}], "name": "u3_11"}, {"qubits": [12], "gate": "id", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.0027345208771739214, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "id_12"}, {"qubits": [12], "gate": "u1", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.0, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 0.0, "name": "gate_length"}], "name": "u1_12"}, {"qubits": [12], "gate": "u2", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.0027345208771739214, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "u2_12"}, {"qubits": [12], "gate": "u3", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.005469041754347843, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 71.11111111111111, "name": "gate_length"}], "name": "u3_12"}, {"qubits": [13], "gate": "id", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0034136411938485564, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "id_13"}, {"qubits": [13], "gate": "u1", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 0.0, "name": "gate_length"}], "name": "u1_13"}, {"qubits": [13], "gate": "u2", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0034136411938485564, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "u2_13"}, {"qubits": [13], "gate": "u3", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.006827282387697113, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 71.11111111111111, "name": "gate_length"}], "name": "u3_13"}, {"qubits": [14], "gate": "id", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.0003519344587204795, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "id_14"}, {"qubits": [14], "gate": "u1", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.0, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 0.0, "name": "gate_length"}], "name": "u1_14"}, {"qubits": [14], "gate": "u2", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.0003519344587204795, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "u2_14"}, {"qubits": [14], "gate": "u3", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.000703868917440959, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 71.11111111111111, "name": "gate_length"}], "name": "u3_14"}, {"qubits": [15], "gate": "id", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0016090282661921586, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "id_15"}, {"qubits": [15], "gate": "u1", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 0.0, "name": "gate_length"}], "name": "u1_15"}, {"qubits": [15], "gate": "u2", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0016090282661921586, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "u2_15"}, {"qubits": [15], "gate": "u3", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.003218056532384317, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 71.11111111111111, "name": "gate_length"}], "name": "u3_15"}, {"qubits": [16], "gate": "id", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.00036655471720775684, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "id_16"}, {"qubits": [16], "gate": "u1", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.0, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 0.0, "name": "gate_length"}], "name": "u1_16"}, {"qubits": [16], "gate": "u2", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.00036655471720775684, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "u2_16"}, {"qubits": [16], "gate": "u3", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.0007331094344155137, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 71.11111111111111, "name": "gate_length"}], "name": "u3_16"}, {"qubits": [17], "gate": "id", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.00028697003074466967, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "id_17"}, {"qubits": [17], "gate": "u1", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 0.0, "name": "gate_length"}], "name": "u1_17"}, {"qubits": [17], "gate": "u2", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.00028697003074466967, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "u2_17"}, {"qubits": [17], "gate": "u3", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0005739400614893393, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 71.11111111111111, "name": "gate_length"}], "name": "u3_17"}, {"qubits": [18], "gate": "id", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.0003816864785326346, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "id_18"}, {"qubits": [18], "gate": "u1", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.0, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 0.0, "name": "gate_length"}], "name": "u1_18"}, {"qubits": [18], "gate": "u2", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.0003816864785326346, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "u2_18"}, {"qubits": [18], "gate": "u3", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.0007633729570652692, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 71.11111111111111, "name": "gate_length"}], "name": "u3_18"}, {"qubits": [19], "gate": "id", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0003179681265439094, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "id_19"}, {"qubits": [19], "gate": "u1", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 0.0, "name": "gate_length"}], "name": "u1_19"}, {"qubits": [19], "gate": "u2", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0003179681265439094, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "u2_19"}, {"qubits": [19], "gate": "u3", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0006359362530878187, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 71.11111111111111, "name": "gate_length"}], "name": "u3_19"}, {"qubits": [0, 1], "gate": "cx", "parameters": [{"date": "2019-10-07T10:56:40+00:00", "unit": "", "value": 0.016951800122571692, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 504.88888888888886, "name": "gate_length"}], "name": "cx0_1"}, {"qubits": [1, 0], "gate": "cx", "parameters": [{"date": "2019-10-07T10:56:40+00:00", "unit": "", "value": 0.016951800122571692, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 504.88888888888886, "name": "gate_length"}], "name": "cx1_0"}, {"qubits": [1, 2], "gate": "cx", "parameters": [{"date": "2019-10-07T11:13:55+00:00", "unit": "", "value": 0.03515653355748438, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 440.88888888888886, "name": "gate_length"}], "name": "cx1_2"}, {"qubits": [1, 6], "gate": "cx", "parameters": [{"date": "2019-10-07T11:20:02+00:00", "unit": "", "value": 0.015497896558171687, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 398.2222222222222, "name": "gate_length"}], "name": "cx1_6"}, {"qubits": [2, 1], "gate": "cx", "parameters": [{"date": "2019-10-07T11:13:55+00:00", "unit": "", "value": 0.03515653355748438, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 440.88888888888886, "name": "gate_length"}], "name": "cx2_1"}, {"qubits": [2, 3], "gate": "cx", "parameters": [{"date": "2019-10-07T11:37:38+00:00", "unit": "", "value": 0.0160990621644867, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 405.3333333333333, "name": "gate_length"}], "name": "cx2_3"}, {"qubits": [3, 2], "gate": "cx", "parameters": [{"date": "2019-10-07T11:37:38+00:00", "unit": "", "value": 0.0160990621644867, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 405.3333333333333, "name": "gate_length"}], "name": "cx3_2"}, {"qubits": [3, 4], "gate": "cx", "parameters": [{"date": "2019-10-07T11:55:00+00:00", "unit": "", "value": 0.011826337096007389, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 568.8888888888889, "name": "gate_length"}], "name": "cx3_4"}, {"qubits": [3, 8], "gate": "cx", "parameters": [{"date": "2019-10-07T12:12:23+00:00", "unit": "", "value": 0.02454490012996005, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 419.55555555555554, "name": "gate_length"}], "name": "cx3_8"}, {"qubits": [4, 3], "gate": "cx", "parameters": [{"date": "2019-10-07T11:55:00+00:00", "unit": "", "value": 0.011826337096007389, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 568.8888888888889, "name": "gate_length"}], "name": "cx4_3"}, {"qubits": [5, 6], "gate": "cx", "parameters": [{"date": "2019-10-07T12:29:49+00:00", "unit": "", "value": 0.02021153777322543, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 590.2222222222222, "name": "gate_length"}], "name": "cx5_6"}, {"qubits": [5, 10], "gate": "cx", "parameters": [{"date": "2019-10-07T14:13:49+00:00", "unit": "", "value": 0.015922830657213644, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 711.1111111111111, "name": "gate_length"}], "name": "cx5_10"}, {"qubits": [6, 1], "gate": "cx", "parameters": [{"date": "2019-10-07T11:20:02+00:00", "unit": "", "value": 0.015497896558171687, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 398.2222222222222, "name": "gate_length"}], "name": "cx6_1"}, {"qubits": [6, 5], "gate": "cx", "parameters": [{"date": "2019-10-07T12:29:49+00:00", "unit": "", "value": 0.02021153777322543, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 590.2222222222222, "name": "gate_length"}], "name": "cx6_5"}, {"qubits": [6, 7], "gate": "cx", "parameters": [{"date": "2019-10-07T12:47:04+00:00", "unit": "", "value": 0.013273348749692243, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 540.4444444444445, "name": "gate_length"}], "name": "cx6_7"}, {"qubits": [7, 6], "gate": "cx", "parameters": [{"date": "2019-10-07T12:47:04+00:00", "unit": "", "value": 0.013273348749692243, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 540.4444444444445, "name": "gate_length"}], "name": "cx7_6"}, {"qubits": [7, 8], "gate": "cx", "parameters": [{"date": "2019-10-07T13:04:16+00:00", "unit": "", "value": 0.016090620555644725, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 462.2222222222222, "name": "gate_length"}], "name": "cx7_8"}, {"qubits": [7, 12], "gate": "cx", "parameters": [{"date": "2019-10-07T13:21:38+00:00", "unit": "", "value": 0.011384053501933722, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 490.66666666666663, "name": "gate_length"}], "name": "cx7_12"}, {"qubits": [8, 3], "gate": "cx", "parameters": [{"date": "2019-10-07T12:12:23+00:00", "unit": "", "value": 0.02454490012996005, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 419.55555555555554, "name": "gate_length"}], "name": "cx8_3"}, {"qubits": [8, 7], "gate": "cx", "parameters": [{"date": "2019-10-07T13:04:16+00:00", "unit": "", "value": 0.016090620555644725, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 462.2222222222222, "name": "gate_length"}], "name": "cx8_7"}, {"qubits": [8, 9], "gate": "cx", "parameters": [{"date": "2019-10-07T13:39:02+00:00", "unit": "", "value": 0.014462795657984778, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 248.88888888888889, "name": "gate_length"}], "name": "cx8_9"}, {"qubits": [9, 8], "gate": "cx", "parameters": [{"date": "2019-10-07T13:39:02+00:00", "unit": "", "value": 0.014462795657984778, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 248.88888888888889, "name": "gate_length"}], "name": "cx9_8"}, {"qubits": [9, 14], "gate": "cx", "parameters": [{"date": "2019-10-07T13:56:21+00:00", "unit": "", "value": 0.010910395045313853, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 348.4444444444444, "name": "gate_length"}], "name": "cx9_14"}, {"qubits": [10, 5], "gate": "cx", "parameters": [{"date": "2019-10-07T14:13:49+00:00", "unit": "", "value": 0.015922830657213644, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 711.1111111111111, "name": "gate_length"}], "name": "cx10_5"}, {"qubits": [10, 11], "gate": "cx", "parameters": [{"date": "2019-10-07T14:35:42+00:00", "unit": "", "value": 0.010285529834766077, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 426.66666666666663, "name": "gate_length"}], "name": "cx10_11"}, {"qubits": [11, 10], "gate": "cx", "parameters": [{"date": "2019-10-07T14:35:42+00:00", "unit": "", "value": 0.010285529834766077, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 426.66666666666663, "name": "gate_length"}], "name": "cx11_10"}, {"qubits": [11, 12], "gate": "cx", "parameters": [{"date": "2019-10-07T14:57:14+00:00", "unit": "", "value": 0.02382591530175221, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 440.88888888888886, "name": "gate_length"}], "name": "cx11_12"}, {"qubits": [11, 16], "gate": "cx", "parameters": [{"date": "2019-10-07T16:09:43+00:00", "unit": "", "value": 0.01296503598444329, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 533.3333333333333, "name": "gate_length"}], "name": "cx11_16"}, {"qubits": [12, 7], "gate": "cx", "parameters": [{"date": "2019-10-07T13:21:38+00:00", "unit": "", "value": 0.011384053501933722, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 490.66666666666663, "name": "gate_length"}], "name": "cx12_7"}, {"qubits": [12, 11], "gate": "cx", "parameters": [{"date": "2019-10-07T14:57:14+00:00", "unit": "", "value": 0.02382591530175221, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 440.88888888888886, "name": "gate_length"}], "name": "cx12_11"}, {"qubits": [12, 13], "gate": "cx", "parameters": [{"date": "2019-10-07T15:14:44+00:00", "unit": "", "value": 0.0634606351390915, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 1045.3333333333333, "name": "gate_length"}], "name": "cx12_13"}, {"qubits": [13, 12], "gate": "cx", "parameters": [{"date": "2019-10-07T15:14:44+00:00", "unit": "", "value": 0.0634606351390915, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 1045.3333333333333, "name": "gate_length"}], "name": "cx13_12"}, {"qubits": [13, 14], "gate": "cx", "parameters": [{"date": "2019-10-07T15:50:34+00:00", "unit": "", "value": 0.02584357040051538, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 369.77777777777777, "name": "gate_length"}], "name": "cx13_14"}, {"qubits": [13, 18], "gate": "cx", "parameters": [{"date": "2019-10-07T15:33:08+00:00", "unit": "", "value": 0.02862492489048793, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 568.8888888888889, "name": "gate_length"}], "name": "cx13_18"}, {"qubits": [14, 9], "gate": "cx", "parameters": [{"date": "2019-10-07T13:56:21+00:00", "unit": "", "value": 0.010910395045313853, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 348.4444444444444, "name": "gate_length"}], "name": "cx14_9"}, {"qubits": [14, 13], "gate": "cx", "parameters": [{"date": "2019-10-07T15:50:34+00:00", "unit": "", "value": 0.02584357040051538, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 369.77777777777777, "name": "gate_length"}], "name": "cx14_13"}, {"qubits": [15, 16], "gate": "cx", "parameters": [{"date": "2019-10-07T16:32:14+00:00", "unit": "", "value": 0.013742969331295318, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 391.1111111111111, "name": "gate_length"}], "name": "cx15_16"}, {"qubits": [16, 11], "gate": "cx", "parameters": [{"date": "2019-10-07T16:09:43+00:00", "unit": "", "value": 0.01296503598444329, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 533.3333333333333, "name": "gate_length"}], "name": "cx16_11"}, {"qubits": [16, 15], "gate": "cx", "parameters": [{"date": "2019-10-07T16:32:14+00:00", "unit": "", "value": 0.013742969331295318, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 391.1111111111111, "name": "gate_length"}], "name": "cx16_15"}, {"qubits": [16, 17], "gate": "cx", "parameters": [{"date": "2019-10-07T16:49:53+00:00", "unit": "", "value": 0.012724327435765598, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 554.6666666666666, "name": "gate_length"}], "name": "cx16_17"}, {"qubits": [17, 16], "gate": "cx", "parameters": [{"date": "2019-10-07T16:49:53+00:00", "unit": "", "value": 0.012724327435765598, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 554.6666666666666, "name": "gate_length"}], "name": "cx17_16"}, {"qubits": [17, 18], "gate": "cx", "parameters": [{"date": "2019-10-07T17:07:15+00:00", "unit": "", "value": 0.0116296454858979, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 760.8888888888888, "name": "gate_length"}], "name": "cx17_18"}, {"qubits": [18, 13], "gate": "cx", "parameters": [{"date": "2019-10-07T15:33:08+00:00", "unit": "", "value": 0.02862492489048793, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 568.8888888888889, "name": "gate_length"}], "name": "cx18_13"}, {"qubits": [18, 17], "gate": "cx", "parameters": [{"date": "2019-10-07T17:07:15+00:00", "unit": "", "value": 0.0116296454858979, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 760.8888888888888, "name": "gate_length"}], "name": "cx18_17"}, {"qubits": [18, 19], "gate": "cx", "parameters": [{"date": "2019-10-07T17:24:07+00:00", "unit": "", "value": 0.009729516587356962, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 533.3333333333333, "name": "gate_length"}], "name": "cx18_19"}, {"qubits": [19, 18], "gate": "cx", "parameters": [{"date": "2019-10-07T17:24:07+00:00", "unit": "", "value": 0.009729516587356962, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 533.3333333333333, "name": "gate_length"}], "name": "cx19_18"}], "backend_version": "1.0.10", "backend_name": "ibmq_singapore", "last_update_date": "2019-10-07T17:24:07+00:00"} \ No newline at end of file diff --git a/test/benchmarks/mapping_passes.py b/test/benchmarks/mapping_passes.py new file mode 100644 index 000000000000..b84390d32046 --- /dev/null +++ b/test/benchmarks/mapping_passes.py @@ -0,0 +1,219 @@ +# -*- coding: utf-8 -*- + +# This code is part of Qiskit. +# +# (C) Copyright IBM 2019. +# +# This code is licensed under the Apache License, Version 2.0. You may +# obtain a copy of this license in the LICENSE.txt file in the root directory +# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. +# +# Any modifications or derivative works of this code must retain this +# copyright notice, and modified files need to carry a notice indicating +# that they have been altered from the originals. + +# pylint: disable=no-member,invalid-name,missing-docstring,no-name-in-module +# pylint: disable=attribute-defined-outside-init,unsubscriptable-object +# pylint: disable=unused-wildcard-import,wildcard-import,undefined-variable + +from qiskit.transpiler import CouplingMap +from qiskit.transpiler.passes import * +from qiskit.converters import circuit_to_dag + +from .backends import fake_singapore +from .utils import random_circuit + + +class PassBenchmarks: + + params = ([1, 2, 5, 8, 14, 20], + [8, 128, 1024]) + + param_names = ['n_qubits', 'depth'] + timeout = 300 + + def setup(self, n_qubits, depth): + seed = 42 + self.circuit = random_circuit(n_qubits, depth, measure=True, + conditional=True, reset=True, seed=seed, + max_operands=2) + self.fresh_dag = circuit_to_dag(self.circuit) + self.basis_gates = ['u1', 'u2', 'u3', 'cx', 'iid'] + self.cmap = [[0, 1], [1, 0], [1, 2], [1, 6], [2, 1], [2, 3], [3, 2], + [3, 4], [3, 8], [4, 3], [5, 6], [5, 10], [6, 1], [6, 5], + [6, 7], [7, 6], [7, 8], [7, 12], [8, 3], [8, 7], [8, 9], + [9, 8], [9, 14], [10, 5], [10, 11], [11, 10], [11, 12], + [11, 16], [12, 7], [12, 11], [12, 13], [13, 12], [13, 14], + [13, 18], [14, 9], [14, 13], [15, 16], [16, 11], [16, 15], + [16, 17], [17, 16], [17, 18], [18, 13], [18, 17], + [18, 19], [19, 18]] + self.coupling_map = CouplingMap(self.cmap) + + layout_pass = DenseLayout(self.coupling_map) + layout_pass.run(self.fresh_dag) + self.layout = layout_pass.property_set['layout'] + full_ancilla_pass = FullAncillaAllocation(self.coupling_map) + full_ancilla_pass.property_set['layout'] = self.layout + self.full_ancilla_dag = full_ancilla_pass.run(self.fresh_dag) + enlarge_pass = EnlargeWithAncilla() + enlarge_pass.property_set['layout'] = self.layout + self.enlarge_dag = enlarge_pass.run(self.full_ancilla_dag) + apply_pass = ApplyLayout() + apply_pass.property_set['layout'] = self.layout + self.dag = apply_pass.run(self.enlarge_dag) + self.backend_props = fake_singapore.FakeSingapore().properties() + + def time_stochastic_swap(self, _, __): + swap = StochasticSwap(self.coupling_map, seed=42) + swap.property_set['layout'] = self.layout + swap.run(self.dag) + + def peakmem_stochastic_swap(self, _, __): + swap = StochasticSwap(self.coupling_map, seed=42) + swap.property_set['layout'] = self.layout + swap.run(self.dag) + + def track_stochastic_swap_depth(self, _, __): + swap = StochasticSwap(self.coupling_map, seed=42) + swap.property_set['layout'] = self.layout + return swap.run(self.dag).depth() + + def track_stochastic_swap_swap_count(self, _, __): + swap = StochasticSwap(self.coupling_map, seed=42) + swap.property_set['layout'] = self.layout + return swap.run(self.dag).count_ops().get('swap') + + def time_lookahead_swap(self, _, __): + swap = LookaheadSwap(self.coupling_map) + swap.property_set['layout'] = self.layout + swap.run(self.dag) + + def peakmem_lookahead_swap(self, _, __): + swap = LookaheadSwap(self.coupling_map) + swap.property_set['layout'] = self.layout + swap.run(self.dag) + + def track_lookahead_swap_depth(self, _, __): + swap = LookaheadSwap(self.coupling_map) + swap.property_set['layout'] = self.layout + return swap.run(self.dag).depth() + + def track_lookahead_swap_swap_count(self, _, __): + swap = LookaheadSwap(self.coupling_map) + swap.property_set['layout'] = self.layout + return swap.run(self.dag).depth().count_ops().get('swap') + + def time_basic_swap(self, _, __): + swap = BasicSwap(self.coupling_map) + swap.property_set['layout'] = self.layout + swap.run(self.dag) + + def peakmem_basic_swap(self, _, __): + swap = BasicSwap(self.coupling_map) + swap.property_set['layout'] = self.layout + swap.run(self.dag) + + def track_basic_swap_depth(self, _, __): + swap = BasicSwap(self.coupling_map) + swap.property_set['layout'] = self.layout + return swap.run(self.dag).depth() + + def track_basic_swap_swap_count(self, _, __): + swap = BasicSwap(self.coupling_map) + swap.property_set['layout'] = self.layout + return swap.run(self.dag).depth().count_ops().get('swap') + + def time_csp_layout(self, _, __): + CSPLayout(self.coupling_map, seed=42).run(self.fresh_dag) + + def peakmem_csp_layout(self, _, __): + CSPLayout(self.coupling_map, seed=42).run(self.fresh_dag) + + def time_dense_layout(self, _, __): + DenseLayout(self.coupling_map).run(self.fresh_dag) + + def peakmem_dense_layout(self, _, __): + DenseLayout(self.coupling_map).run(self.fresh_dag) + + def time_layout_2q_distance(self, _, __): + layout = Layout2qDistance(self.coupling_map) + layout.property_set['layout'] = self.layout + layout.run(self.dag) + + def peakmem_layout_2q_distance(self, _, __): + layout = Layout2qDistance(self.coupling_map) + layout.property_set['layout'] = self.layout + layout.run(self.dag) + + def time_cxdirection(self, _, __): + CXDirection(self.coupling_map).run(self.dag) + + def peakmem_cxdirection(self, _, __): + CXDirection(self.coupling_map).run(self.dag) + + def track_cxdirection_depth(self, _, __): + return CXDirection(self.coupling_map).run(self.dag).depth() + + def track_cxdirection_cnot_count(self, _, __): + return CXDirection( + self.coupling_map).run(self.dag).count_ops().get('cx') + + def time_apply_layout(self, _, __): + layout = ApplyLayout() + layout.property_set['layout'] = self.layout + layout.run(self.dag) + + def peakmem_apply_layout(self, _, __): + layout = ApplyLayout() + layout.property_set['layout'] = self.layout + layout.run(self.dag) + + def time_full_ancilla_allocation(self, _, __): + ancilla = FullAncillaAllocation(self.coupling_map) + ancilla.property_set['layout'] = self.layout + ancilla.run(self.fresh_dag) + + def peakmem_full_ancilla_allocation(self, _, __): + ancilla = FullAncillaAllocation(self.coupling_map) + ancilla.property_set['layout'] = self.layout + ancilla.run(self.fresh_dag) + + def time_enlarge_with_ancilla(self, _, __): + ancilla = EnlargeWithAncilla() + ancilla.property_set['layout'] = self.layout + ancilla.run(self.full_ancilla_dag) + + def peakmem_enlarge_with_ancilla(self, _, __): + ancilla = EnlargeWithAncilla() + ancilla.property_set['layout'] = self.layout + ancilla.run(self.full_ancilla_dag) + + def time_check_map(self, _, __): + CheckMap(self.coupling_map).run(self.dag) + + def peakmem_check_map(self, _, __): + CheckMap(self.coupling_map).run(self.dag) + + def time_check_cx_direction(self, _, __): + CheckCXDirection(self.coupling_map).run(self.dag) + + def peakmem_check_cx_direction(self, _, __): + CheckCXDirection(self.coupling_map).run(self.dag) + + def time_trivial_layout(self, _, __): + TrivialLayout(self.coupling_map).run(self.fresh_dag) + + def peakmem_trivial_layout(self, _, __): + TrivialLayout(self.coupling_map).run(self.fresh_dag) + + def time_set_layout(self, _, __): + SetLayout(self.layout).run(self.fresh_dag) + + def peakmem_set_layout(self, _, __): + SetLayout(self.layout).run(self.fresh_dag) + + def time_noise_adaptive_layout(self, _, __): + NoiseAdaptiveLayout(self.backend_props).run(self.fresh_dag) + + def peakmem_noise_adaptive_layout(self, _, __): + NoiseAdaptiveLayout(self.backend_props).run(self.fresh_dag) From 33548ba716752783dc81aac6998d8e35ae04b533 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Mon, 25 Nov 2019 23:43:35 +0900 Subject: [PATCH 23/61] Add benchmark for non-mapping passes (Qiskit/qiskit-metapackage#697) * Add benchmark for non-mapping passes This commit adds new benchmark methods for each non-mapping pass. There are 2 benchmarks for each analysis pass that track the run time of the pass and the memory consumption, for tranformation passes a third benchmark is added to track the depth after the pass is run. The next stage here will be to add benchmarks for mapping passes. * Fix lint --- test/benchmarks/passes.py | 231 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 231 insertions(+) create mode 100644 test/benchmarks/passes.py diff --git a/test/benchmarks/passes.py b/test/benchmarks/passes.py new file mode 100644 index 000000000000..72033e6b07a9 --- /dev/null +++ b/test/benchmarks/passes.py @@ -0,0 +1,231 @@ +# -*- coding: utf-8 -*- + +# This code is part of Qiskit. +# +# (C) Copyright IBM 2019. +# +# This code is licensed under the Apache License, Version 2.0. You may +# obtain a copy of this license in the LICENSE.txt file in the root directory +# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. +# +# Any modifications or derivative works of this code must retain this +# copyright notice, and modified files need to carry a notice indicating +# that they have been altered from the originals. + +# pylint: disable=no-member,invalid-name,missing-docstring,no-name-in-module +# pylint: disable=attribute-defined-outside-init,unsubscriptable-object +# pylint: disable=unused-wildcard-import,wildcard-import + + +from qiskit.transpiler.passes import * +from qiskit.converters import circuit_to_dag + +from .utils import random_circuit + + +class PassBenchmarks: + + params = ([1, 2, 5, 8, 14, 20], + [8, 128, 1024]) + + param_names = ['n_qubits', 'depth'] + timeout = 300 + + def setup(self, n_qubits, depth): + seed = 42 + self.circuit = random_circuit(n_qubits, depth, measure=True, + conditional=True, reset=True, seed=seed) + self.dag = circuit_to_dag(self.circuit) + self.basis_gates = ['u1', 'u2', 'u3', 'cx', 'id'] + self.unrolled_dag = Unroller(self.basis_gates).run(self.dag) + commutative_analysis = CommutationAnalysis() + commutative_analysis.run( + self.dag) + self.commutation_set = commutative_analysis.property_set[ + 'commutation_set'] + collect_blocks = Collect2qBlocks() + collect_blocks.run(self.dag) + self.block_list = collect_blocks.property_set['block_list'] + + def time_unroller(self, _, __): + Unroller(self.basis_gates).run(self.dag) + + def peakmem_unroller(self, _, __): + Unroller(self.basis_gates).run(self.dag) + + def track_unroller_depth(self, _, __): + return Unroller(self.basis_gates).run(self.dag).depth() + + def time_depth_pass(self, _, __): + Depth().run(self.dag) + + def peakmem_depth_pass(self, _, __): + Depth().run(self.dag) + + def time_size_pass(self, _, __): + Size().run(self.dag) + + def peakmem_size_pass(self, _, __): + Size().run(self.dag) + + def time_width_pass(self, _, __): + Width().run(self.dag) + + def peakmem_width_pass(self, _, __): + Width().run(self.dag) + + def time_count_ops_pass(self, _, __): + CountOps().run(self.dag) + + def peakemem_count_ops_pass(self, _, __): + CountOps().run(self.dag) + + def time_count_ops_longest_path(self, _, __): + CountOpsLongestPath().run(self.dag) + + def peakmem_count_ops_longest_path(self, _, __): + CountOpsLongestPath().run(self.dag) + + def time_num_tensor_factors(self, _, __): + NumTensorFactors().run(self.dag) + + def peakmem_num_tensor_factors(self, _, __): + NumTensorFactors().run(self.dag) + + def time_resource_optimization(self, _, __): + ResourceEstimation().run(self.dag) + + def peakmem_resoure_optimization(self, _, __): + ResourceEstimation().run(self.dag) + + def time_cx_cancellation(self, _, __): + CXCancellation().run(self.dag) + + def peakmem_cx_cancellation(self, _, __): + CXCancellation().run(self.dag) + + def time_dag_longest_path(self, _, __): + DAGLongestPath().run(self.dag) + + def peakmem_dag_longest_path(self, _, __): + DAGLongestPath().run(self.dag) + + def time_merge_adjacent_barriers(self, _, __): + MergeAdjacentBarriers().run(self.dag) + + def peakmem_merge_adjacent_barriers(self, _, __): + MergeAdjacentBarriers().run(self.dag) + + def time_optimize_1q(self, _, __): + Optimize1qGates().run(self.unrolled_dag) + + def peakmem_optimize_1q(self, _, __): + Optimize1qGates().run(self.unrolled_dag) + + def track_optimize_1q_depth(self, _, __): + return Optimize1qGates().run(self.unrolled_dag).depth() + + def time_decompose_pass(self, _, __): + Decompose().run(self.dag) + + def peakmem_decompose_pass(self, _, __): + Decompose().run(self.dag) + + def track_decompose_depth(self, _, __): + return Decompose().run(self.dag).depth() + + def time_unroll_3q_or_more(self, _, __): + Unroll3qOrMore().run(self.dag) + + def peakmem_unroll_3q_or_more(self, _, __): + Unroll3qOrMore().run(self.dag) + + def track_unroll_3q_or_more_depth(self, _, __): + return Unroll3qOrMore().run(self.dag).depth() + + def time_commutation_analysis(self, _, __): + CommutationAnalysis().run(self.dag) + + def peakmem_commutation_analysis(self, _, __): + CommutationAnalysis().run(self.dag) + + def time_remove_reset_in_zero_state(self, _, __): + RemoveResetInZeroState().run(self.dag) + + def peakemem_remove_reset_in_zero_state(self, _, __): + RemoveResetInZeroState().run(self.dag) + + def track_remove_reset_in_zero_state(self, _, __): + return RemoveResetInZeroState().run(self.dag).depth() + + def time_collect_2q_blocks(self, _, __): + Collect2qBlocks().run(self.dag) + + def peakmem_collect_2q_blocks(self, _, __): + Collect2qBlocks().run(self.dag) + + def time_commutative_cancellation(self, _, __): + _pass = CommutativeCancellation() + _pass.property_set['commutation_set'] = self.commutation_set + _pass.run(self.dag) + + def peakmem_commutative_cancellation(self, _, __): + _pass = CommutativeCancellation() + _pass.property_set['commutation_set'] = self.commutation_set + _pass.run(self.dag) + + def track_commutative_cancellation_depth(self, _, __): + _pass = CommutativeCancellation() + _pass.property_set['commutation_set'] = self.commutation_set + return _pass.run(self.dag).depth() + + def time_optimize_swap_before_measure(self, _, __): + OptimizeSwapBeforeMeasure().run(self.dag) + + def peakmem_optimize_swap_before_measure(self, _, __): + OptimizeSwapBeforeMeasure().run(self.dag) + + def track_optimize_swap_before_measure_depth(self, _, __): + return OptimizeSwapBeforeMeasure().run(self.dag).depth() + + def time_consolidate_blocks(self, _, __): + _pass = ConsolidateBlocks() + _pass.property_set['block_list'] = self.block_list + _pass.run(self.dag) + + def peakmem_consolidate_blocks(self, _, __): + _pass = ConsolidateBlocks() + _pass.property_set['block_list'] = self.block_list + _pass.run(self.dag) + + def track_consolidate_blocks_depth(self, _, __): + _pass = ConsolidateBlocks() + _pass.property_set['block_list'] = self.block_list + return _pass.run(self.dag).depth() + + def time_barrier_before_final_measurements(self, _, __): + BarrierBeforeFinalMeasurements().run(self.dag) + + def peakmem_barrier_before_final_measurement(self, _, __): + BarrierBeforeFinalMeasurements().run(self.dag) + + def track_barrier_before_final_measurement(self, _, __): + BarrierBeforeFinalMeasurements().run(self.dag).depth() + + def time_remove_diagonal_gates_before_measurement(self, _, __): + RemoveDiagonalGatesBeforeMeasure().run(self.dag) + + def peakmem_remove_diagonal_gates_before_measurement(self, _, __): + RemoveDiagonalGatesBeforeMeasure().run(self.dag) + + def track_remove_diagonal_gates_before_measurement(self, _, __): + return RemoveDiagonalGatesBeforeMeasure().run(self.dag).run() + + def time_remove_final_measurements(self, _, __): + RemoveFinalMeasurements().run(self.dag) + + def peakmem_remove_final_measurements(self, _, __): + RemoveFinalMeasurements().run(self.dag) + + def track_remove_final_measurements_depth(self, _, __): + return RemoveFinalMeasurements().run(self.dag).depth() From 8ff4a426cef13696e7f4382c07b2bbd669b7caf4 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Wed, 4 Dec 2019 07:36:06 -0500 Subject: [PATCH 24/61] Reorganize passes benchmarks (Qiskit/qiskit-metapackage#714) This commit reorganizes the passes benchmarks to better measure memory consumption and decrease the amount of time spent in setup. There are tests for 3 passes: ConsolidateBlocks, CommutativeCancellation, and Optimize1qGates that depended on either an analysis pass or tranformation pass to be run before they can work or are effective. To isolate the benchmarking of these passes those prequesite passes were run in setup and then could be accessed by the benchmark methods for those passes. However this had a cost, it makes the setup for every benchmark slower because we have to run these extra passes even if the results are not used. This has a big impact for peakmem benchmarks though, because the peakmem includes the setup() function there are cases where the results of peakmem could be skewed by these passes. To fix this this commit splits benchmarks into classes that run the extra passes to isolate the setup cost to only those benchmarks which actually need the extra passes. --- test/benchmarks/passes.py | 134 +++++++++++++++++++++++++------------- 1 file changed, 88 insertions(+), 46 deletions(-) diff --git a/test/benchmarks/passes.py b/test/benchmarks/passes.py index 72033e6b07a9..5edb5913e725 100644 --- a/test/benchmarks/passes.py +++ b/test/benchmarks/passes.py @@ -23,8 +23,39 @@ from .utils import random_circuit -class PassBenchmarks: +class Collect2QPassBenchmarks: + params = ([1, 2, 5, 8, 14, 20], + [8, 128, 1024]) + param_names = ['n_qubits', 'depth'] + timeout = 300 + + def setup(self, n_qubits, depth): + seed = 42 + self.circuit = random_circuit(n_qubits, depth, measure=True, + conditional=True, reset=True, seed=seed) + self.dag = circuit_to_dag(self.circuit) + collect_blocks = Collect2qBlocks() + collect_blocks.run(self.dag) + self.block_list = collect_blocks.property_set['block_list'] + + def time_consolidate_blocks(self, _, __): + _pass = ConsolidateBlocks() + _pass.property_set['block_list'] = self.block_list + _pass.run(self.dag) + + def peakmem_consolidate_blocks(self, _, __): + _pass = ConsolidateBlocks() + _pass.property_set['block_list'] = self.block_list + _pass.run(self.dag) + + def track_consolidate_blocks_depth(self, _, __): + _pass = ConsolidateBlocks() + _pass.property_set['block_list'] = self.block_list + return _pass.run(self.dag).depth() + + +class CommutativeAnalysisPassBenchmarks: params = ([1, 2, 5, 8, 14, 20], [8, 128, 1024]) @@ -36,16 +67,66 @@ def setup(self, n_qubits, depth): self.circuit = random_circuit(n_qubits, depth, measure=True, conditional=True, reset=True, seed=seed) self.dag = circuit_to_dag(self.circuit) - self.basis_gates = ['u1', 'u2', 'u3', 'cx', 'id'] - self.unrolled_dag = Unroller(self.basis_gates).run(self.dag) commutative_analysis = CommutationAnalysis() commutative_analysis.run( self.dag) self.commutation_set = commutative_analysis.property_set[ 'commutation_set'] - collect_blocks = Collect2qBlocks() - collect_blocks.run(self.dag) - self.block_list = collect_blocks.property_set['block_list'] + + def time_commutative_cancellation(self, _, __): + _pass = CommutativeCancellation() + _pass.property_set['commutation_set'] = self.commutation_set + _pass.run(self.dag) + + def peakmem_commutative_cancellation(self, _, __): + _pass = CommutativeCancellation() + _pass.property_set['commutation_set'] = self.commutation_set + _pass.run(self.dag) + + def track_commutative_cancellation_depth(self, _, __): + _pass = CommutativeCancellation() + _pass.property_set['commutation_set'] = self.commutation_set + return _pass.run(self.dag).depth() + + +class UnrolledPassBenchmarks: + params = ([1, 2, 5, 8, 14, 20], + [8, 128, 1024]) + + param_names = ['n_qubits', 'depth'] + timeout = 300 + + def setup(self, n_qubits, depth): + seed = 42 + self.circuit = random_circuit(n_qubits, depth, measure=True, + conditional=True, reset=True, seed=seed) + self.dag = circuit_to_dag(self.circuit) + self.basis_gates = ['u1', 'u2', 'u3', 'cx', 'id'] + self.unrolled_dag = Unroller(self.basis_gates).run(self.dag) + + def time_optimize_1q(self, _, __): + Optimize1qGates().run(self.unrolled_dag) + + def peakmem_optimize_1q(self, _, __): + Optimize1qGates().run(self.unrolled_dag) + + def track_optimize_1q_depth(self, _, __): + return Optimize1qGates().run(self.unrolled_dag).depth() + + +class PassBenchmarks: + params = ([1, 2, 5, 8, 14, 20], + [8, 128, 1024]) + + param_names = ['n_qubits', 'depth'] + timeout = 300 + + def setup(self, n_qubits, depth): + seed = 42 + self.circuit = random_circuit(n_qubits, depth, measure=True, + conditional=True, reset=True, seed=seed) + self.dag = circuit_to_dag(self.circuit) + self.basis_gates = ['u1', 'u2', 'u3', 'cx', 'id'] def time_unroller(self, _, __): Unroller(self.basis_gates).run(self.dag) @@ -116,15 +197,6 @@ def time_merge_adjacent_barriers(self, _, __): def peakmem_merge_adjacent_barriers(self, _, __): MergeAdjacentBarriers().run(self.dag) - def time_optimize_1q(self, _, __): - Optimize1qGates().run(self.unrolled_dag) - - def peakmem_optimize_1q(self, _, __): - Optimize1qGates().run(self.unrolled_dag) - - def track_optimize_1q_depth(self, _, __): - return Optimize1qGates().run(self.unrolled_dag).depth() - def time_decompose_pass(self, _, __): Decompose().run(self.dag) @@ -164,21 +236,6 @@ def time_collect_2q_blocks(self, _, __): def peakmem_collect_2q_blocks(self, _, __): Collect2qBlocks().run(self.dag) - def time_commutative_cancellation(self, _, __): - _pass = CommutativeCancellation() - _pass.property_set['commutation_set'] = self.commutation_set - _pass.run(self.dag) - - def peakmem_commutative_cancellation(self, _, __): - _pass = CommutativeCancellation() - _pass.property_set['commutation_set'] = self.commutation_set - _pass.run(self.dag) - - def track_commutative_cancellation_depth(self, _, __): - _pass = CommutativeCancellation() - _pass.property_set['commutation_set'] = self.commutation_set - return _pass.run(self.dag).depth() - def time_optimize_swap_before_measure(self, _, __): OptimizeSwapBeforeMeasure().run(self.dag) @@ -188,21 +245,6 @@ def peakmem_optimize_swap_before_measure(self, _, __): def track_optimize_swap_before_measure_depth(self, _, __): return OptimizeSwapBeforeMeasure().run(self.dag).depth() - def time_consolidate_blocks(self, _, __): - _pass = ConsolidateBlocks() - _pass.property_set['block_list'] = self.block_list - _pass.run(self.dag) - - def peakmem_consolidate_blocks(self, _, __): - _pass = ConsolidateBlocks() - _pass.property_set['block_list'] = self.block_list - _pass.run(self.dag) - - def track_consolidate_blocks_depth(self, _, __): - _pass = ConsolidateBlocks() - _pass.property_set['block_list'] = self.block_list - return _pass.run(self.dag).depth() - def time_barrier_before_final_measurements(self, _, __): BarrierBeforeFinalMeasurements().run(self.dag) @@ -219,7 +261,7 @@ def peakmem_remove_diagonal_gates_before_measurement(self, _, __): RemoveDiagonalGatesBeforeMeasure().run(self.dag) def track_remove_diagonal_gates_before_measurement(self, _, __): - return RemoveDiagonalGatesBeforeMeasure().run(self.dag).run() + return RemoveDiagonalGatesBeforeMeasure().run(self.dag).depth() def time_remove_final_measurements(self, _, __): RemoveFinalMeasurements().run(self.dag) From e57379108ab353efb4ea72a7b21989138417422d Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Tue, 3 Mar 2020 11:49:35 -0500 Subject: [PATCH 25/61] Reduce number of parameters on pass benchmarks (Qiskit/qiskit-metapackage#837) Right now the dedicated benchmark machine is spending too much time and has a growing backlog of commits to benchmark. Part of this is the introduction of the pass benchmarks which run over a wide sweep of parameters which results in 18 different permustations of the benchmark. This ends up being a large portion of the time spent benchmarking. This commit decreases the number of parameters to be a single circuit depth and only 3 qubit counts. This reduces the number of permutations from 18 to 3. --- test/benchmarks/mapping_passes.py | 4 ++-- test/benchmarks/passes.py | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/test/benchmarks/mapping_passes.py b/test/benchmarks/mapping_passes.py index b84390d32046..465f323a137d 100644 --- a/test/benchmarks/mapping_passes.py +++ b/test/benchmarks/mapping_passes.py @@ -26,8 +26,8 @@ class PassBenchmarks: - params = ([1, 2, 5, 8, 14, 20], - [8, 128, 1024]) + params = ([5, 14, 20], + [1024]) param_names = ['n_qubits', 'depth'] timeout = 300 diff --git a/test/benchmarks/passes.py b/test/benchmarks/passes.py index 5edb5913e725..39e4c5f5cc2d 100644 --- a/test/benchmarks/passes.py +++ b/test/benchmarks/passes.py @@ -24,8 +24,8 @@ class Collect2QPassBenchmarks: - params = ([1, 2, 5, 8, 14, 20], - [8, 128, 1024]) + params = ([5, 14, 20], + [1024]) param_names = ['n_qubits', 'depth'] timeout = 300 @@ -56,8 +56,8 @@ def track_consolidate_blocks_depth(self, _, __): class CommutativeAnalysisPassBenchmarks: - params = ([1, 2, 5, 8, 14, 20], - [8, 128, 1024]) + params = ([5, 14, 20], + [1024]) param_names = ['n_qubits', 'depth'] timeout = 300 @@ -90,8 +90,8 @@ def track_commutative_cancellation_depth(self, _, __): class UnrolledPassBenchmarks: - params = ([1, 2, 5, 8, 14, 20], - [8, 128, 1024]) + params = ([5, 14, 20], + [1024]) param_names = ['n_qubits', 'depth'] timeout = 300 @@ -115,8 +115,8 @@ def track_optimize_1q_depth(self, _, __): class PassBenchmarks: - params = ([1, 2, 5, 8, 14, 20], - [8, 128, 1024]) + params = ([5, 14, 20], + [1024]) param_names = ['n_qubits', 'depth'] timeout = 300 From db2f1c8774722bc4652a040e94699aa5b2dfa4f0 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Wed, 4 Mar 2020 14:11:01 -0500 Subject: [PATCH 26/61] Add QuantumCircuit.copy() benchmark. (Qiskit/qiskit-metapackage#838) * Add QuantumCircuit.copy() benchmark. * Update test/benchmarks/circuit_construction.py --- test/benchmarks/circuit_construction.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/benchmarks/circuit_construction.py b/test/benchmarks/circuit_construction.py index edba37f66ddf..50698901fc0a 100644 --- a/test/benchmarks/circuit_construction.py +++ b/test/benchmarks/circuit_construction.py @@ -45,3 +45,6 @@ def time_circuit_construction(self, width, gates): def time_circuit_extend(self, _, __): self.empty_circuit.extend(self.sample_circuit) + + def time_circuit_copy(self, _, __): + self.sample_circuit.copy() From d3a36d45ac5571de8f5e6c5ccc76a374eeac86da Mon Sep 17 00:00:00 2001 From: Kevin Krsulich Date: Fri, 13 Mar 2020 10:58:48 -0400 Subject: [PATCH 27/61] Disable LookaheadSwap mapping benchmarks due to timeout. (Qiskit/qiskit-metapackage#845) The lookahead swap mapping passes timeout consistently and have generated no data (likely due to Qiskit/qiskit-terra#2171 ) but cost roughly an hour of benchmarking runtime per terra commit. This commit disables these benchmarks while the problems are investigated. --- test/benchmarks/mapping_passes.py | 39 ++++++++++++++++--------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/test/benchmarks/mapping_passes.py b/test/benchmarks/mapping_passes.py index 465f323a137d..7213e881e94e 100644 --- a/test/benchmarks/mapping_passes.py +++ b/test/benchmarks/mapping_passes.py @@ -83,25 +83,26 @@ def track_stochastic_swap_swap_count(self, _, __): swap.property_set['layout'] = self.layout return swap.run(self.dag).count_ops().get('swap') - def time_lookahead_swap(self, _, __): - swap = LookaheadSwap(self.coupling_map) - swap.property_set['layout'] = self.layout - swap.run(self.dag) - - def peakmem_lookahead_swap(self, _, __): - swap = LookaheadSwap(self.coupling_map) - swap.property_set['layout'] = self.layout - swap.run(self.dag) - - def track_lookahead_swap_depth(self, _, __): - swap = LookaheadSwap(self.coupling_map) - swap.property_set['layout'] = self.layout - return swap.run(self.dag).depth() - - def track_lookahead_swap_swap_count(self, _, __): - swap = LookaheadSwap(self.coupling_map) - swap.property_set['layout'] = self.layout - return swap.run(self.dag).depth().count_ops().get('swap') + # Disable lookahead swap benchmarks due to timeout. + # def time_lookahead_swap(self, _, __): + # swap = LookaheadSwap(self.coupling_map) + # swap.property_set['layout'] = self.layout + # swap.run(self.dag) + + # def peakmem_lookahead_swap(self, _, __): + # swap = LookaheadSwap(self.coupling_map) + # swap.property_set['layout'] = self.layout + # swap.run(self.dag) + + # def track_lookahead_swap_depth(self, _, __): + # swap = LookaheadSwap(self.coupling_map) + # swap.property_set['layout'] = self.layout + # return swap.run(self.dag).depth() + + # def track_lookahead_swap_swap_count(self, _, __): + # swap = LookaheadSwap(self.coupling_map) + # swap.property_set['layout'] = self.layout + # return swap.run(self.dag).depth().count_ops().get('swap') def time_basic_swap(self, _, __): swap = BasicSwap(self.coupling_map) From 0500a27e2f9604092d37c568967028a9d22562d2 Mon Sep 17 00:00:00 2001 From: Kevin Krsulich Date: Fri, 13 Mar 2020 13:49:16 -0400 Subject: [PATCH 28/61] Add ripple adder construction and transpilation benchmarks. (Qiskit/qiskit-metapackage#844) --- test/benchmarks/ripple_adder.py | 80 +++++++++++++++++++++++++++++++++ test/benchmarks/utils.py | 51 +++++++++++++++++++++ 2 files changed, 131 insertions(+) create mode 100644 test/benchmarks/ripple_adder.py diff --git a/test/benchmarks/ripple_adder.py b/test/benchmarks/ripple_adder.py new file mode 100644 index 000000000000..c6390da12ddd --- /dev/null +++ b/test/benchmarks/ripple_adder.py @@ -0,0 +1,80 @@ +# -*- coding: utf-8 -*- + +# This code is part of Qiskit. +# +# (C) Copyright IBM 2019. +# +# This code is licensed under the Apache License, Version 2.0. You may +# obtain a copy of this license in the LICENSE.txt file in the root directory +# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. +# +# Any modifications or derivative works of this code must retain this +# copyright notice, and modified files need to carry a notice indicating +# that they have been altered from the originals. + +# pylint: disable=no-member,invalid-name,missing-docstring,no-name-in-module +# pylint: disable=attribute-defined-outside-init,unsubscriptable-object + +from qiskit import transpile +from qiskit.transpiler import CouplingMap + +from qiskit.providers.basicaer import QasmSimulatorPy + +from .utils import build_ripple_adder_circuit + + +class RippleAdderConstruction: + params = ([10, 50, 100, 200, 500],) + param_names = ['size'] + version = 1 + timeout = 600 + + def time_build_ripple_adder(self, size): + build_ripple_adder_circuit(size) + + def peakmem_build_ripple_adder(self, size): + build_ripple_adder_circuit(size) + + +class RippleAdderTranspile: + params = ([10, 20], + [0, 1, 2, 3]) + param_names = ['size', 'level'] + version = 1 + timeout = 600 + + def setup(self, size, _): + edge_len = int((2*size + 2)**0.5)+1 + self.coupling_map = CouplingMap.from_grid(edge_len, edge_len) + self.sim_backend = QasmSimulatorPy() + self.circuit = build_ripple_adder_circuit(size) + + def time_transpile_simulator_ripple_adder(self, _, level): + transpile(self.circuit, self.sim_backend, + optimization_level=level) + + def peakmem_transpile_simulator_ripple_adder(self, _, level): + transpile(self.circuit, self.sim_backend, + optimization_level=level) + + def track_depth_transpile_simulator_ripple_adder(self, _, level): + return transpile(self.circuit, self.sim_backend, + optimization_level=level).depth() + + def time_transpile_square_grid_ripple_adder(self, _, level): + transpile(self.circuit, + coupling_map=self.coupling_map, + basis_gates=['u1', 'u2', 'u3', 'cx', 'id'], + optimization_level=level) + + def peakmem_transpile_square_grid_ripple_adder(self, _, level): + transpile(self.circuit, + coupling_map=self.coupling_map, + basis_gates=['u1', 'u2', 'u3', 'cx', 'id'], + optimization_level=level) + + def track_depth_transpile_square_grid_ripple_adder(self, _, level): + return transpile(self.circuit, + coupling_map=self.coupling_map, + basis_gates=['u1', 'u2', 'u3', 'cx', 'id'], + optimization_level=level).depth() diff --git a/test/benchmarks/utils.py b/test/benchmarks/utils.py index 4debae30ee94..5a30db37d94e 100644 --- a/test/benchmarks/utils.py +++ b/test/benchmarks/utils.py @@ -135,3 +135,54 @@ def build_qv_model_circuit(width, depth, seed=None): pair = int(perm[2*k]), int(perm[2*k+1]) circuit.append(U, [pair[0], pair[1]]) return circuit + + +def build_ripple_adder_circuit(size): + """ + Builds a ripple adder of a given size. + """ + n = size + a = QuantumRegister(n, "a") + b = QuantumRegister(n, "b") + cin = QuantumRegister(1, "cin") + cout = QuantumRegister(1, "cout") + ans = ClassicalRegister(n+1, "ans") + qc = QuantumCircuit(a, b, cin, cout, ans, name="rippleadd") + + def majority(p, a, b, c): + """Majority gate.""" + p.cx(c, b) + p.cx(c, a) + p.ccx(a, b, c) + + def unmajority(p, a, b, c): + """Unmajoritygate.""" + p.ccx(a, b, c) + p.cx(c, a) + p.cx(a, b) + + # Build a temporary subcircuitthat adds a to b, + # storing the result in b + adder_subcircuit = QuantumCircuit(cin, a, b, cout) + majority(adder_subcircuit, cin[0], b[0], a[0]) + for j in range(n - 1): + majority(adder_subcircuit, a[j], b[j + 1], a[j + 1]) + + adder_subcircuit.cx(a[n - 1], cout[0]) + + for j in reversed(range(n - 1)): + unmajority(adder_subcircuit, a[j], b[j + 1], a[j + 1]) + unmajority(adder_subcircuit, cin[0], b[0], a[0]) + + # Set the inputs to the adder + qc.x(a[0]) # Set input a = 0...0001 + qc.x(b) # Set input b = 1...1111 + # Apply the adder + qc += adder_subcircuit + + # Measure the output register in the computational basis + for j in range(n): + qc.measure(b[j], ans[j]) + qc.measure(cout[0], ans[n]) + + return qc From 6f1e9d402552ebc6c652e081e1f56355747949cd Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Tue, 17 Mar 2020 10:05:07 -0400 Subject: [PATCH 29/61] Add disassemble benchmarks and more permutations to assemble (Qiskit/qiskit-metapackage#846) * Add disassemble benchmarks and more permutations to assemble This commit expands our coverage of the assemble benchmarks by adding assembly cases with >1 circuit. At the same time this adds a second benchmark class which adds coverage for qobj disassemble. * Update test/benchmarks/assembler.py Co-Authored-By: Kevin Krsulich * Add new version to assembler benchmark Co-authored-by: Kevin Krsulich Co-authored-by: Kevin Krsulich --- test/benchmarks/assembler.py | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/test/benchmarks/assembler.py b/test/benchmarks/assembler.py index 1672c694d78e..d27fe8a7a96f 100644 --- a/test/benchmarks/assembler.py +++ b/test/benchmarks/assembler.py @@ -16,20 +16,42 @@ # pylint: disable=attribute-defined-outside-init,unsubscriptable-object from qiskit.compiler import assemble +from qiskit.assembler import disassemble from .utils import random_circuit class AssemblerBenchmarks: params = ([1, 2, 5, 8], - [8, 128, 1024, 2048, 4096]) - param_names = ['n_qubits', 'depth'] + [8, 128, 1024, 2048, 4096], + [1, 5, 10, 50, 100]) + param_names = ['n_qubits', 'depth', 'number of circuits'] timeout = 600 + version = 2 - def setup(self, n_qubits, depth): + def setup(self, n_qubits, depth, number_of_circuits): seed = 42 self.circuit = random_circuit(n_qubits, depth, measure=True, conditional=True, seed=seed) + self.circuits = [self.circuit] * number_of_circuits - def time_assemble_circuit(self, _, __): - assemble(self.circuit) + def time_assemble_circuit(self, _, __, ___): + assemble(self.circuits) + + +class DisassemblerBenchmarks: + params = ([1, 2, 5, 8], + [8, 128, 1024, 2048, 4096], + [1, 5, 10, 50, 100]) + param_names = ['n_qubits', 'depth', 'number of circuits'] + timeout = 600 + + def setup(self, n_qubits, depth, number_of_circuits): + seed = 424242 + self.circuit = random_circuit(n_qubits, depth, measure=True, + conditional=True, seed=seed) + self.circuits = [self.circuit] * number_of_circuits + self.qobj = assemble(self.circuits) + + def time_disassemble_circuit(self, _, __, ___): + disassemble(self.qobj) From f0118d58dfd6d7bf897b768448ffd1f95e873494 Mon Sep 17 00:00:00 2001 From: SooluThomas Date: Fri, 10 Apr 2020 10:05:33 -0400 Subject: [PATCH 30/61] Add Qiskit Pulse Benchmarks (Qiskit/qiskit-metapackage#848) Partially fixes Qiskit/qiskit-metapackage#794. * first commit * Fixed some typos * More fixes * Add benchmark to insert instruction from left to right * Fix Lints * Add hardcorded parametic pulse and sample pulse * reduce params * Fix lint * review suggestions * Instruction to schedule * review suggestions * Rename due to lint restrictions number_of_unique_pulses -> unique_pulses and number_of_channels -> channels * review suggestions * Seperate inst_add and sched.union * Remove unwanted imports * lint * Update code * Fix lint * separate instruction to sched conversion and union of sched * uncomment code * Lint * move benchmark functions with similar setup.py to a different file * lint * Move time_union_of_schedules to schedule construction class * Add Open Pulse backend in backends/ * lint * Add Play * Add Play * Remove union union is deprecated * lint --- test/benchmarks/backends/fake_openpulse.py | 305 ++++++++++++++++++ test/benchmarks/pulse/__init__.py | 0 .../benchmarks/pulse/schedule_construction.py | 69 ++++ .../schedule_to_instruction_conversion.py | 54 ++++ 4 files changed, 428 insertions(+) create mode 100644 test/benchmarks/backends/fake_openpulse.py create mode 100644 test/benchmarks/pulse/__init__.py create mode 100644 test/benchmarks/pulse/schedule_construction.py create mode 100644 test/benchmarks/pulse/schedule_to_instruction_conversion.py diff --git a/test/benchmarks/backends/fake_openpulse.py b/test/benchmarks/backends/fake_openpulse.py new file mode 100644 index 000000000000..57b37efb0b39 --- /dev/null +++ b/test/benchmarks/backends/fake_openpulse.py @@ -0,0 +1,305 @@ +# -*- coding: utf-8 -*- + +# This code is part of Qiskit. +# +# (C) Copyright IBM 2019. +# +# This code is licensed under the Apache License, Version 2.0. You may +# obtain a copy of this license in the LICENSE.txt file in the root directory +# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. +# +# Any modifications or derivative works of this code must retain this +# copyright notice, and modified files need to carry a notice indicating +# that they have been altered from the originals. + +""" +Fake Open Pulse (2 qubit). +""" + +import datetime +from qiskit.providers.models import (GateConfig, PulseBackendConfiguration, + PulseDefaults, Command, UchannelLO) +from qiskit.providers.models.backendproperties import (Nduv, Gate, + BackendProperties) +from qiskit.qobj import PulseQobjInstruction +from qiskit.test.mock.fake_backend import FakeBackend + + +class FakeOpenPulse2Q(FakeBackend): + """A fake open pulse backend.""" + + def __init__(self): + configuration = PulseBackendConfiguration( + backend_name='fake_openpulse', + backend_version='0.0.0', + n_qubits=2, + meas_levels=[0, 1, 2], + basis_gates=['u1', 'u2', 'u3', 'cx', 'id'], + simulator=False, + local=True, + conditional=True, + open_pulse=True, + memory=False, + max_shots=65536, + gates=[GateConfig(name='TODO', parameters=[], qasm_def='TODO')], + coupling_map=[[0, 1]], + n_registers=2, + n_uchannels=2, + u_channel_lo=[ + [UchannelLO(q=0, scale=1. + 0.j)], + [UchannelLO(q=0, scale=-1. + 0.j), + UchannelLO(q=1, scale=1. + 0.j)] + ], + meas_level=[1, 2], + qubit_lo_range=[[4.5, 5.5], [4.5, 5.5]], + meas_lo_range=[[6.0, 7.0], [6.0, 7.0]], + dt=1.3333, + dtm=10.5, + rep_times=[100, 250, 500, 1000], + meas_map=[[0, 1]], + channel_bandwidth=[ + [-0.2, 0.4], [-0.3, 0.3], [-0.3, 0.3], + [-0.02, 0.02], [-0.02, 0.02], [-0.02, 0.02] + ], + meas_kernels=['kernel1'], + discriminators=['max_1Q_fidelity'], + acquisition_latency=[[100, 100], [100, 100]], + conditional_latency=[ + [100, 1000], [1000, 100], [100, 1000], + [1000, 100], [100, 1000], [1000, 100] + ], + hamiltonian={ + 'h_str': ["np.pi*(2*v0-alpha0)*O0", "np.pi*alpha0*O0*O0", + "2*np.pi*r*X0||D0", "2*np.pi*r*X0||U1", + "2*np.pi*r*X1||U0", "np.pi*(2*v1-alpha1)*O1", + "np.pi*alpha1*O1*O1", "2*np.pi*r*X1||D1", + "2*np.pi*j*(Sp0*Sm1+Sm0*Sp1)"], + 'description': "A hamiltonian for a mocked 2Q device, with 1Q\ + and 2Q terms.", + 'qub': {'0': 3, '1': 3}, + 'vars': {'v0': 5.00, + 'v1': 5.1, + 'j': 0.01, + 'r': 0.02, + 'alpha0': -0.33, + 'alpha1': -0.33} + }, + channels={ + 'acquire0': { + 'operates': {'qubits': [0]}, + 'purpose': 'acquire', + 'type': 'acquire' + }, + 'acquire1': { + 'operates': {'qubits': [1]}, + 'purpose': 'acquire', + 'type': 'acquire' + }, + 'd0': { + 'operates': {'qubits': [0]}, + 'purpose': 'drive', + 'type': 'drive' + }, + 'd1': { + 'operates': {'qubits': [1]}, + 'purpose': 'drive', + 'type': 'drive' + }, + 'm0': { + 'type': 'measure', + 'purpose': 'measure', + 'operates': {'qubits': [0]} + }, + 'm1': { + 'type': 'measure', + 'purpose': 'measure', + 'operates': {'qubits': [1]} + }, + 'u0': { + 'operates': {'qubits': [0, 1]}, + 'purpose': 'cross-resonance', + 'type': 'control' + }, + 'u1': { + 'operates': {'qubits': [1, 0]}, + 'purpose': 'cross-resonance', + 'type': 'control' + } + } + ) + + self._defaults = PulseDefaults.from_dict({ + 'qubit_freq_est': [4.9, 5.0], + 'meas_freq_est': [6.5, 6.6], + 'buffer': 10, + 'pulse_library': [ + { + 'name': 'test_pulse_1', + 'samples': [[0.0, 0.0], [0.0, 0.1]] + }, + { + 'name': 'test_pulse_2', + 'samples': [[0.0, 0.0], [0.0, 0.1], [0.0, 1.0]] + }, + { + 'name': 'test_pulse_3', + 'samples': [[0.0, 0.0], [0.0, 0.1], [0.0, 1.0], [0.5, 0.0]] + }, + { + 'name': 'test_pulse_4', + 'samples': 7 * [ + [0.0, 0.0], [0.0, 0.1], [0.0, 1.0], [0.5, 0.0] + ] + } + ], + 'cmd_def': [ + Command.from_dict({ + 'name': 'u1', + 'qubits': [0], + 'sequence': [ + PulseQobjInstruction(name='fc', ch='d0', + t0=0, phase='-P0').to_dict() + ]}).to_dict(), + Command.from_dict({ + 'name': 'u1', + 'qubits': [1], + 'sequence': [ + PulseQobjInstruction(name='fc', ch='d1', + t0=0, phase='-P0').to_dict() + ]}).to_dict(), + Command.from_dict({ + 'name': 'u2', + 'qubits': [0], + 'sequence': [ + PulseQobjInstruction(name='fc', ch='d0', + t0=0, + phase='-P1').to_dict(), + PulseQobjInstruction(name='test_pulse_4', ch='d0', + t0=0).to_dict(), + PulseQobjInstruction(name='fc', ch='d0', t0=0, + phase='-P0').to_dict() + ]}).to_dict(), + Command.from_dict({ + 'name': 'u2', + 'qubits': [1], + 'sequence': [ + PulseQobjInstruction(name='fc', ch='d1', t0=0, + phase='-P1').to_dict(), + PulseQobjInstruction(name='test_pulse_4', + ch='d1', t0=0).to_dict(), + PulseQobjInstruction(name='fc', ch='d1', + t0=0, phase='-P0').to_dict() + ]}).to_dict(), + Command.from_dict({ + 'name': 'u3', + 'qubits': [0], + 'sequence': [ + PulseQobjInstruction(name='test_pulse_1', ch='d0', + t0=0).to_dict() + ]}).to_dict(), + Command.from_dict({ + 'name': 'u3', + 'qubits': [1], + 'sequence': [ + PulseQobjInstruction(name='test_pulse_3', ch='d1', + t0=0).to_dict() + ]}).to_dict(), + Command.from_dict({ + 'name': 'cx', + 'qubits': [0, 1], + 'sequence': [ + PulseQobjInstruction(name='test_pulse_1', ch='d0', + t0=0).to_dict(), + PulseQobjInstruction(name='test_pulse_2', ch='u0', + t0=10).to_dict(), + PulseQobjInstruction(name='test_pulse_1', ch='d1', + t0=20).to_dict(), + PulseQobjInstruction(name='fc', ch='d1', + t0=20, phase=2.1).to_dict() + ]}).to_dict(), + Command.from_dict({ + 'name': 'ParametrizedGate', + 'qubits': [0, 1], + 'sequence': [ + PulseQobjInstruction(name='test_pulse_1', ch='d0', + t0=0).to_dict(), + PulseQobjInstruction(name='test_pulse_2', ch='u0', + t0=10).to_dict(), + PulseQobjInstruction(name='pv', ch='d1', + t0=2, val='cos(P2)').to_dict(), + PulseQobjInstruction(name='test_pulse_1', ch='d1', + t0=20).to_dict(), + PulseQobjInstruction(name='fc', ch='d1', + t0=20, phase=2.1).to_dict() + ]}).to_dict(), + Command.from_dict({ + 'name': 'measure', + 'qubits': [0, 1], + 'sequence': [ + PulseQobjInstruction(name='test_pulse_1', ch='m0', + t0=0).to_dict(), + PulseQobjInstruction(name='test_pulse_1', ch='m1', + t0=0).to_dict(), + PulseQobjInstruction(name='acquire', duration=10, t0=0, + qubits=[0, 1], + memory_slot=[0, 1]).to_dict() + ]}).to_dict() + ] + }) + + mock_time = datetime.datetime.now() + dt = 1.3333 # pylint: disable=invalid-name + self._properties = BackendProperties( + backend_name='fake_openpulse_2q', + backend_version='0.0.0', + last_update_date=mock_time, + qubits=[ + [Nduv(date=mock_time, name='T1', unit='µs', + value=71.9500421005539), + Nduv(date=mock_time, name='frequency', unit='MHz', + value=4919.96800692)], + [Nduv(date=mock_time, name='T1', unit='µs', + value=81.9500421005539), + Nduv(date=mock_time, name='frequency', unit='GHz', + value=5.01996800692)] + ], + gates=[ + Gate(gate='u1', name='u1_0', qubits=[0], + parameters=[ + Nduv(date=mock_time, name='gate_error', unit='', + value=0.06), + Nduv(date=mock_time, name='gate_length', unit='ns', + value=0.)]), + Gate(gate='u3', name='u3_0', qubits=[0], + parameters=[ + Nduv(date=mock_time, name='gate_error', unit='', + value=0.06), + Nduv(date=mock_time, name='gate_length', unit='ns', + value=2 * dt)]), + Gate(gate='u3', name='u3_1', qubits=[1], + parameters=[ + Nduv(date=mock_time, name='gate_error', unit='', + value=0.06), + Nduv(date=mock_time, name='gate_length', unit='ns', + value=4 * dt)]), + Gate(gate='cx', name='cx0_1', qubits=[0, 1], + parameters=[ + Nduv(date=mock_time, name='gate_error', unit='', + value=1.0), + Nduv(date=mock_time, name='gate_length', unit='ns', + value=22 * dt)]), + ], + general=[] + ) + + super().__init__(configuration) + + def defaults(self): + """Return the default pulse-related settings provided by the backend + (such as gate to Schedule mappings). + """ + return self._defaults + + def properties(self): + """Return the measured characteristics of the backend.""" + return self._properties diff --git a/test/benchmarks/pulse/__init__.py b/test/benchmarks/pulse/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/test/benchmarks/pulse/schedule_construction.py b/test/benchmarks/pulse/schedule_construction.py new file mode 100644 index 000000000000..584cb975ea6d --- /dev/null +++ b/test/benchmarks/pulse/schedule_construction.py @@ -0,0 +1,69 @@ +# -*- coding: utf-8 -* + +# This code is part of Qiskit. +# +# (C) Copyright IBM 2020. +# +# This code is licensed under the Apache License, Version 2.0. You may +# obtain a copy of this license in the LICENSE.txt file in the root directory +# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. +# +# Any modifications or derivative works of this code must retain this +# copyright notice, and modified files need to carry a notice indicating +# that they have been altered from the originals. + +# pylint: disable=missing-docstring,invalid-name,no-member +# pylint: disable=attribute-defined-outside-init + +import numpy as np +from qiskit.pulse import Schedule, Gaussian, DriveChannel, SamplePulse, Play + + +def build_sample_pulse_schedule(number_of_unique_pulses, number_of_channels): + rng = np.random.RandomState(42) + sched = Schedule() + for _ in range(number_of_unique_pulses): + for channel in range(number_of_channels): + sched.append(Play(SamplePulse(rng.random(50)), + DriveChannel(channel))) + return sched + + +def build_parametric_pulse_schedule(number_of_unique_pulses, + number_of_channels): + sched = Schedule() + for _ in range(number_of_unique_pulses): + for channel in range(number_of_channels): + sched.append(Play(Gaussian(duration=25, sigma=4, amp=0.5j), + DriveChannel(channel))) + return sched + + +class ScheduleConstructionBench: + params = ([1, 2, 5], [8, 128, 2048]) + param_names = ['number_of_unique_pulses', 'number_of_channels'] + timeout = 600 + + def setup(self, unique_pulses, channels): + self.sample_sched = build_sample_pulse_schedule(unique_pulses, + channels) + self.parametric_sched = build_parametric_pulse_schedule(unique_pulses, + channels) + + def time_sample_pulse_schedule_construction(self, + unique_pulses, + channels): + build_sample_pulse_schedule(unique_pulses, channels) + + def time_parametric_pulse_schedule_construction(self, + unique_pulses, + channels): + build_parametric_pulse_schedule(unique_pulses, channels) + + def time_append_instruction(self, _, __): + self.sample_sched.append(self.parametric_sched) + + def time_insert_instruction_left_to_right(self, _, __): + sched = self.sample_sched.shift(self.parametric_sched.stop_time) + sched.insert(self.parametric_sched.start_time, + self.parametric_sched) diff --git a/test/benchmarks/pulse/schedule_to_instruction_conversion.py b/test/benchmarks/pulse/schedule_to_instruction_conversion.py new file mode 100644 index 000000000000..ed32e6c6bb3b --- /dev/null +++ b/test/benchmarks/pulse/schedule_to_instruction_conversion.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -* + +# This code is part of Qiskit. +# +# (C) Copyright IBM 2020. +# +# This code is licensed under the Apache License, Version 2.0. You may +# obtain a copy of this license in the LICENSE.txt file in the root directory +# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. +# +# Any modifications or derivative works of this code must retain this +# copyright notice, and modified files need to carry a notice indicating +# that they have been altered from the originals. + +# pylint: disable=missing-docstring,invalid-name,no-member +# pylint: disable=attribute-defined-outside-init + +from qiskit import schedule, QuantumCircuit, QuantumRegister +from qiskit.circuit import Gate +from qiskit.pulse import Schedule, Gaussian, DriveChannel, Play +from ..backends.fake_openpulse import FakeOpenPulse2Q + + +def build_parametric_pulse_schedule(number_of_unique_pulses, + number_of_channels): + sched = Schedule() + for _ in range(number_of_unique_pulses): + for channel in range(number_of_channels): + sched.append(Play(Gaussian(duration=25, sigma=4, amp=0.5j), + DriveChannel(channel))) + return sched + + +class ScheduleToInstructionBench: + params = ([1, 2, 5], [8, 128, 2048]) + param_names = ['number_of_unique_pulses', 'number_of_channels'] + timeout = 600 + + def setup(self, unique_pulses, channels): + self.parametric_sched = build_parametric_pulse_schedule(unique_pulses, + channels) + qr = QuantumRegister(1) + self.qc = QuantumCircuit(qr) + self.qc.append(Gate('my_pulse', 1, []), qargs=[qr[0]]) + self.backend = FakeOpenPulse2Q() + self.inst_map = self.backend.defaults().instruction_schedule_map + self.add_inst_map = self.inst_map + self.add_inst_map.add('my_pulse', [0], self.parametric_sched) + + def time_build_instruction(self, _, __): + self.inst_map.add('my_pulse', [0], self.parametric_sched) + + def time_instruction_to_schedule(self, _, __): + schedule(self.qc, self.backend, inst_map=self.add_inst_map) From 35e291c6b9aa17355f4cb03521b9373caf7b5d2e Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Sat, 25 Apr 2020 00:04:05 -0400 Subject: [PATCH 31/61] Add benchmarks for bind_parameters (Qiskit/qiskit-metapackage#896) * Add benchmarks for bind_parameters This commit adds a synthetic benchmark for running bind_parameters on a parameterized circuit. It is basically a dual of the circuit construction benchmark except that it adds a sweep on the number of parameters. * Reduce number of permutations * Add parameterized construction bench and fix lint Co-authored-by: Paul Nation Co-authored-by: Jay Gambetta --- test/benchmarks/circuit_construction.py | 52 +++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/test/benchmarks/circuit_construction.py b/test/benchmarks/circuit_construction.py index 50698901fc0a..5960f1bc1b97 100644 --- a/test/benchmarks/circuit_construction.py +++ b/test/benchmarks/circuit_construction.py @@ -15,7 +15,10 @@ # pylint: disable=missing-docstring,invalid-name,no-member # pylint: disable=attribute-defined-outside-init +import itertools + from qiskit import QuantumRegister, QuantumCircuit +from qiskit.circuit import Parameter def build_circuit(width, gates): @@ -48,3 +51,52 @@ def time_circuit_extend(self, _, __): def time_circuit_copy(self, _, __): self.sample_circuit.copy() + + +def build_parameterized_circuit(width, gates, param_count): + params = [Parameter('param-%s' % x) for x in range(param_count)] + param_iter = itertools.cycle(params) + + qr = QuantumRegister(width) + qc = QuantumCircuit(qr) + + while len(qc) < gates: + for k in range(width): + param = next(param_iter) + qc.u2(0, param, qr[k]) + for k in range(width-1): + param = next(param_iter) + qc.crx(param, qr[k], qr[k+1]) + + return qc, params + + +class ParameterizedCircuitConstructionBench: + params = ([20], [8, 128, 2048, 8192, 32768, 131072], + [8, 128, 2048, 8192, 32768, 131072]) + param_names = ['width', 'gates', 'number of params'] + timeout = 600 + + def setup(self, _, gates, params): + if params > gates: + raise NotImplementedError + + def time_build_parameterized_circuit(self, width, gates, params): + build_parameterized_circuit(width, gates, params) + + +class ParameterizedCircuitBindBench: + params = ([20], [8, 128, 2048, 8192, 32768, 131072], + [8, 128, 2048, 8192, 32768, 131072]) + param_names = ['width', 'gates', 'number of params'] + timeout = 600 + + def setup(self, width, gates, params): + if params > gates: + raise NotImplementedError + self.circuit, self.params = build_parameterized_circuit(width, + gates, + params) + + def time_bind_params(self, _, __, ___): + self.circuit.bind_parameters({x: 3.14 for x in self.params}) From 287135c279b4b1505e1904546eac9fcdd1bdea99 Mon Sep 17 00:00:00 2001 From: Kazuaki Ishizaki Date: Fri, 1 May 2020 05:14:44 +0900 Subject: [PATCH 32/61] Fix typo in files under docs and test (Qiskit/qiskit-metapackage#751) Fix typo and spelling in rst files under docs directory and in python file under test directory * fix typo * revert changes based on comment * correct peake_... since they were not executed --- test/benchmarks/passes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/benchmarks/passes.py b/test/benchmarks/passes.py index 39e4c5f5cc2d..bd0563d23483 100644 --- a/test/benchmarks/passes.py +++ b/test/benchmarks/passes.py @@ -158,7 +158,7 @@ def peakmem_width_pass(self, _, __): def time_count_ops_pass(self, _, __): CountOps().run(self.dag) - def peakemem_count_ops_pass(self, _, __): + def peakmem_count_ops_pass(self, _, __): CountOps().run(self.dag) def time_count_ops_longest_path(self, _, __): @@ -224,7 +224,7 @@ def peakmem_commutation_analysis(self, _, __): def time_remove_reset_in_zero_state(self, _, __): RemoveResetInZeroState().run(self.dag) - def peakemem_remove_reset_in_zero_state(self, _, __): + def peakmem_remove_reset_in_zero_state(self, _, __): RemoveResetInZeroState().run(self.dag) def track_remove_reset_in_zero_state(self, _, __): From 7df66364eafd97b05a31cac6f8ad82b39856b24b Mon Sep 17 00:00:00 2001 From: qiskit-bot <54866446+qiskit-bot@users.noreply.github.com> Date: Thu, 30 Apr 2020 23:52:17 -0400 Subject: [PATCH 33/61] Bump Meta (Qiskit/qiskit-metapackage#908) * Bump version for qiskit-terra==0.14.0 Bump the meta repo version to include: qiskit-terra==0.14.0 * Add terra release notes * Bump version for qiskit-ibmq-provider==0.7.0 * Add placeholder for other elements * Add aqua release notes prelude * qiskit-ibmq-provider release note (Qiskit/qiskit-metapackage#909) * Workaround terra backwards compat bug This commit works around an issue introduce in the most recent terra release where the deprecated gate classes are no longer being exported, see Qiskit/qiskit-terra#4365 for more details. This will be fixed soon in a followup 0.14.1 release but until that time this commit makes the necessary change to the benchmarks so they'll work with the 0.14.0 release. * Fix title level * Bump version for qiskit-aqua==0.7.0 Bump the meta repo version to include: qiskit-aqua==0.7.0 Co-authored-by: Matthew Treinish Co-authored-by: Jessie Yu --- test/benchmarks/utils.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/test/benchmarks/utils.py b/test/benchmarks/utils.py index 5a30db37d94e..d084c1ba9635 100644 --- a/test/benchmarks/utils.py +++ b/test/benchmarks/utils.py @@ -21,12 +21,12 @@ from qiskit.quantum_info.random import random_unitary from qiskit.circuit import QuantumRegister, ClassicalRegister, QuantumCircuit from qiskit.circuit import Reset -from qiskit.extensions import (IdGate, U1Gate, U2Gate, U3Gate, XGate, - YGate, ZGate, HGate, SGate, SdgGate, TGate, - TdgGate, RXGate, RYGate, RZGate, CnotGate, - CyGate, CzGate, CHGate, CrzGate, Cu1Gate, - Cu3Gate, SwapGate, RZZGate, - ToffoliGate, FredkinGate) +from qiskit.circuit.library import (IGate, U1Gate, U2Gate, U3Gate, XGate, + YGate, ZGate, HGate, SGate, SdgGate, TGate, + TdgGate, RXGate, RYGate, RZGate, CXGate, + CYGate, CZGate, CHGate, CRZGate, CU1Gate, + CU3Gate, SwapGate, RZZGate, + CCXGate, CSwapGate) def random_circuit(n_qubits, depth, max_operands=3, measure=False, @@ -52,14 +52,14 @@ def random_circuit(n_qubits, depth, max_operands=3, measure=False, if max_operands < 1 or max_operands > 3: raise Exception("max_operands must be between 1 and 3") - one_q_ops = [IdGate, U1Gate, U2Gate, U3Gate, XGate, YGate, ZGate, + one_q_ops = [IGate, U1Gate, U2Gate, U3Gate, XGate, YGate, ZGate, HGate, SGate, SdgGate, TGate, TdgGate, RXGate, RYGate, RZGate] - one_param = [U1Gate, RXGate, RYGate, RZGate, RZZGate, Cu1Gate, CrzGate] + one_param = [U1Gate, RXGate, RYGate, RZGate, RZZGate, CU1Gate, CRZGate] two_param = [U2Gate] - three_param = [U3Gate, Cu3Gate] - two_q_ops = [CnotGate, CyGate, CzGate, CHGate, CrzGate, - Cu1Gate, Cu3Gate, SwapGate, RZZGate] - three_q_ops = [ToffoliGate, FredkinGate] + three_param = [U3Gate, CU3Gate] + two_q_ops = [CXGate, CYGate, CZGate, CHGate, CRZGate, + CYGate, CU3Gate, SwapGate, RZZGate] + three_q_ops = [CCXGate, CSwapGate] qr = QuantumRegister(n_qubits, 'q') qc = QuantumCircuit(n_qubits) From c7b132bd0c5ca4754acd0245048a71fb6d11e1e7 Mon Sep 17 00:00:00 2001 From: qiskit-bot <54866446+qiskit-bot@users.noreply.github.com> Date: Mon, 10 Aug 2020 15:16:36 -0400 Subject: [PATCH 34/61] Bump Meta (Qiskit/qiskit-metapackage#998) * Bump version for qiskit-terra==0.15.0 Bump the meta repo version to include: qiskit-terra==0.15.0 * Add terra release notes * Bump version for qiskit-ignis==0.4.0 Bump the meta repo version to include: qiskit-ignis==0.4.0 * Add ignis release notes * Bump version for qiskit-ibmq-provider==0.8.0 Bump the meta repo version to include: qiskit-ibmq-provider==0.8.0 * Bump version for qiskit-aqua==0.7.4 Bump the meta repo version to include: qiskit-aqua==0.7.4 * Fix lint * Add pyscf to tutorials job * Add missing quotes from pyscf * Fix broken release note * Remove faulty qubits release note This feature is being reverted so lets not include the release note, also it was failing lint. * Add release notes for provider 0.8 (Qiskit/qiskit-metapackage#999) * add provider 0.8 release notes * remove header * retrigger check * Add aqua release notes * Fix doc8 lint * Bump version for qiskit-aer==0.6.0 Bump the meta repo version to include: qiskit-aer==0.6.0 * Add aer release notes * Remove duplicated aer release notes * Bump version for qiskit-aqua==0.7.5 Bump the meta repo version to include: qiskit-aqua==0.7.5 * Add release notes for aqua 0.7.5 release * Apply suggestions from code review Co-authored-by: Luciano Bello * Update docs/release_notes.rst Co-authored-by: Luciano Bello * Add conc to aer 0.6.0 release notes Adds conan release notes for aer 0.6.0 which were added in Qiskit/qiskit-aer#870. * Bump version for qiskit-terra==0.15.1 Bump the meta repo version to include: qiskit-terra==0.15.1 * Bump version for qiskit-aer==0.6.1 Bump the meta repo version to include: qiskit-aer==0.6.1 * Bump Terra and Aer release note versions Co-authored-by: Matthew Treinish Co-authored-by: Jessie Yu Co-authored-by: Luciano Bello --- test/benchmarks/quantum_volume.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/benchmarks/quantum_volume.py b/test/benchmarks/quantum_volume.py index 56f352c838a0..ddad889b1ea9 100644 --- a/test/benchmarks/quantum_volume.py +++ b/test/benchmarks/quantum_volume.py @@ -43,7 +43,7 @@ from qiskit.transpiler import transpile if not NO_KAK: - from qiskit.tools.qi.qi import random_unitary_matrix + from qiskit.quantum_info import random_unitary as random_unitary_matrix def build_model_circuit_kak(width, depth, seed=None): From 3a559a1b5764162f4db9c20b521d815908dd27ad Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Wed, 21 Oct 2020 16:24:47 -0400 Subject: [PATCH 35/61] Remove peakmem benchmarks from the benchmark suite (Qiskit/qiskit-metapackage#1069) This commit removes all the peakmem benchmarks from the benchmark suite. The peakmem benchmarks have proven to be unreliable in practice and are prone to inaccurately flag large regressions in the amount of memory used (see Qiskit/qiskit-terra#4689 and Qiskit/qiskit-terra#5247) which are unreproduceable and also don't match what running processes on the benchmark show. This might be an artifact of the asv launch method used, but either way if we can't rely on the benchmarks to provide a consistent baseline running benchmarks to measure memory consumption is a waste of CPU time that could be spent providing wider benchmarking coverage. --- test/benchmarks/mapping_passes.py | 59 ---------------------- test/benchmarks/passes.py | 73 ---------------------------- test/benchmarks/ripple_adder.py | 13 ----- test/benchmarks/transpiler_levels.py | 21 -------- 4 files changed, 166 deletions(-) diff --git a/test/benchmarks/mapping_passes.py b/test/benchmarks/mapping_passes.py index 7213e881e94e..d07734ce537e 100644 --- a/test/benchmarks/mapping_passes.py +++ b/test/benchmarks/mapping_passes.py @@ -68,11 +68,6 @@ def time_stochastic_swap(self, _, __): swap.property_set['layout'] = self.layout swap.run(self.dag) - def peakmem_stochastic_swap(self, _, __): - swap = StochasticSwap(self.coupling_map, seed=42) - swap.property_set['layout'] = self.layout - swap.run(self.dag) - def track_stochastic_swap_depth(self, _, __): swap = StochasticSwap(self.coupling_map, seed=42) swap.property_set['layout'] = self.layout @@ -89,11 +84,6 @@ def track_stochastic_swap_swap_count(self, _, __): # swap.property_set['layout'] = self.layout # swap.run(self.dag) - # def peakmem_lookahead_swap(self, _, __): - # swap = LookaheadSwap(self.coupling_map) - # swap.property_set['layout'] = self.layout - # swap.run(self.dag) - # def track_lookahead_swap_depth(self, _, __): # swap = LookaheadSwap(self.coupling_map) # swap.property_set['layout'] = self.layout @@ -109,11 +99,6 @@ def time_basic_swap(self, _, __): swap.property_set['layout'] = self.layout swap.run(self.dag) - def peakmem_basic_swap(self, _, __): - swap = BasicSwap(self.coupling_map) - swap.property_set['layout'] = self.layout - swap.run(self.dag) - def track_basic_swap_depth(self, _, __): swap = BasicSwap(self.coupling_map) swap.property_set['layout'] = self.layout @@ -127,31 +112,17 @@ def track_basic_swap_swap_count(self, _, __): def time_csp_layout(self, _, __): CSPLayout(self.coupling_map, seed=42).run(self.fresh_dag) - def peakmem_csp_layout(self, _, __): - CSPLayout(self.coupling_map, seed=42).run(self.fresh_dag) - def time_dense_layout(self, _, __): DenseLayout(self.coupling_map).run(self.fresh_dag) - def peakmem_dense_layout(self, _, __): - DenseLayout(self.coupling_map).run(self.fresh_dag) - def time_layout_2q_distance(self, _, __): layout = Layout2qDistance(self.coupling_map) layout.property_set['layout'] = self.layout layout.run(self.dag) - def peakmem_layout_2q_distance(self, _, __): - layout = Layout2qDistance(self.coupling_map) - layout.property_set['layout'] = self.layout - layout.run(self.dag) - def time_cxdirection(self, _, __): CXDirection(self.coupling_map).run(self.dag) - def peakmem_cxdirection(self, _, __): - CXDirection(self.coupling_map).run(self.dag) - def track_cxdirection_depth(self, _, __): return CXDirection(self.coupling_map).run(self.dag).depth() @@ -164,57 +135,27 @@ def time_apply_layout(self, _, __): layout.property_set['layout'] = self.layout layout.run(self.dag) - def peakmem_apply_layout(self, _, __): - layout = ApplyLayout() - layout.property_set['layout'] = self.layout - layout.run(self.dag) - def time_full_ancilla_allocation(self, _, __): ancilla = FullAncillaAllocation(self.coupling_map) ancilla.property_set['layout'] = self.layout ancilla.run(self.fresh_dag) - def peakmem_full_ancilla_allocation(self, _, __): - ancilla = FullAncillaAllocation(self.coupling_map) - ancilla.property_set['layout'] = self.layout - ancilla.run(self.fresh_dag) - def time_enlarge_with_ancilla(self, _, __): ancilla = EnlargeWithAncilla() ancilla.property_set['layout'] = self.layout ancilla.run(self.full_ancilla_dag) - def peakmem_enlarge_with_ancilla(self, _, __): - ancilla = EnlargeWithAncilla() - ancilla.property_set['layout'] = self.layout - ancilla.run(self.full_ancilla_dag) - def time_check_map(self, _, __): CheckMap(self.coupling_map).run(self.dag) - def peakmem_check_map(self, _, __): - CheckMap(self.coupling_map).run(self.dag) - def time_check_cx_direction(self, _, __): CheckCXDirection(self.coupling_map).run(self.dag) - def peakmem_check_cx_direction(self, _, __): - CheckCXDirection(self.coupling_map).run(self.dag) - def time_trivial_layout(self, _, __): TrivialLayout(self.coupling_map).run(self.fresh_dag) - def peakmem_trivial_layout(self, _, __): - TrivialLayout(self.coupling_map).run(self.fresh_dag) - def time_set_layout(self, _, __): SetLayout(self.layout).run(self.fresh_dag) - def peakmem_set_layout(self, _, __): - SetLayout(self.layout).run(self.fresh_dag) - def time_noise_adaptive_layout(self, _, __): NoiseAdaptiveLayout(self.backend_props).run(self.fresh_dag) - - def peakmem_noise_adaptive_layout(self, _, __): - NoiseAdaptiveLayout(self.backend_props).run(self.fresh_dag) diff --git a/test/benchmarks/passes.py b/test/benchmarks/passes.py index bd0563d23483..f5a779f353aa 100644 --- a/test/benchmarks/passes.py +++ b/test/benchmarks/passes.py @@ -44,11 +44,6 @@ def time_consolidate_blocks(self, _, __): _pass.property_set['block_list'] = self.block_list _pass.run(self.dag) - def peakmem_consolidate_blocks(self, _, __): - _pass = ConsolidateBlocks() - _pass.property_set['block_list'] = self.block_list - _pass.run(self.dag) - def track_consolidate_blocks_depth(self, _, __): _pass = ConsolidateBlocks() _pass.property_set['block_list'] = self.block_list @@ -78,11 +73,6 @@ def time_commutative_cancellation(self, _, __): _pass.property_set['commutation_set'] = self.commutation_set _pass.run(self.dag) - def peakmem_commutative_cancellation(self, _, __): - _pass = CommutativeCancellation() - _pass.property_set['commutation_set'] = self.commutation_set - _pass.run(self.dag) - def track_commutative_cancellation_depth(self, _, __): _pass = CommutativeCancellation() _pass.property_set['commutation_set'] = self.commutation_set @@ -107,9 +97,6 @@ def setup(self, n_qubits, depth): def time_optimize_1q(self, _, __): Optimize1qGates().run(self.unrolled_dag) - def peakmem_optimize_1q(self, _, __): - Optimize1qGates().run(self.unrolled_dag) - def track_optimize_1q_depth(self, _, __): return Optimize1qGates().run(self.unrolled_dag).depth() @@ -131,143 +118,83 @@ def setup(self, n_qubits, depth): def time_unroller(self, _, __): Unroller(self.basis_gates).run(self.dag) - def peakmem_unroller(self, _, __): - Unroller(self.basis_gates).run(self.dag) - def track_unroller_depth(self, _, __): return Unroller(self.basis_gates).run(self.dag).depth() def time_depth_pass(self, _, __): Depth().run(self.dag) - def peakmem_depth_pass(self, _, __): - Depth().run(self.dag) - def time_size_pass(self, _, __): Size().run(self.dag) - def peakmem_size_pass(self, _, __): - Size().run(self.dag) - def time_width_pass(self, _, __): Width().run(self.dag) - def peakmem_width_pass(self, _, __): - Width().run(self.dag) - def time_count_ops_pass(self, _, __): CountOps().run(self.dag) - def peakmem_count_ops_pass(self, _, __): - CountOps().run(self.dag) - def time_count_ops_longest_path(self, _, __): CountOpsLongestPath().run(self.dag) - def peakmem_count_ops_longest_path(self, _, __): - CountOpsLongestPath().run(self.dag) - def time_num_tensor_factors(self, _, __): NumTensorFactors().run(self.dag) - def peakmem_num_tensor_factors(self, _, __): - NumTensorFactors().run(self.dag) - def time_resource_optimization(self, _, __): ResourceEstimation().run(self.dag) - def peakmem_resoure_optimization(self, _, __): - ResourceEstimation().run(self.dag) - def time_cx_cancellation(self, _, __): CXCancellation().run(self.dag) - def peakmem_cx_cancellation(self, _, __): - CXCancellation().run(self.dag) - def time_dag_longest_path(self, _, __): DAGLongestPath().run(self.dag) - def peakmem_dag_longest_path(self, _, __): - DAGLongestPath().run(self.dag) - def time_merge_adjacent_barriers(self, _, __): MergeAdjacentBarriers().run(self.dag) - def peakmem_merge_adjacent_barriers(self, _, __): - MergeAdjacentBarriers().run(self.dag) - def time_decompose_pass(self, _, __): Decompose().run(self.dag) - def peakmem_decompose_pass(self, _, __): - Decompose().run(self.dag) - def track_decompose_depth(self, _, __): return Decompose().run(self.dag).depth() def time_unroll_3q_or_more(self, _, __): Unroll3qOrMore().run(self.dag) - def peakmem_unroll_3q_or_more(self, _, __): - Unroll3qOrMore().run(self.dag) - def track_unroll_3q_or_more_depth(self, _, __): return Unroll3qOrMore().run(self.dag).depth() def time_commutation_analysis(self, _, __): CommutationAnalysis().run(self.dag) - def peakmem_commutation_analysis(self, _, __): - CommutationAnalysis().run(self.dag) - def time_remove_reset_in_zero_state(self, _, __): RemoveResetInZeroState().run(self.dag) - def peakmem_remove_reset_in_zero_state(self, _, __): - RemoveResetInZeroState().run(self.dag) - def track_remove_reset_in_zero_state(self, _, __): return RemoveResetInZeroState().run(self.dag).depth() def time_collect_2q_blocks(self, _, __): Collect2qBlocks().run(self.dag) - def peakmem_collect_2q_blocks(self, _, __): - Collect2qBlocks().run(self.dag) - def time_optimize_swap_before_measure(self, _, __): OptimizeSwapBeforeMeasure().run(self.dag) - def peakmem_optimize_swap_before_measure(self, _, __): - OptimizeSwapBeforeMeasure().run(self.dag) - def track_optimize_swap_before_measure_depth(self, _, __): return OptimizeSwapBeforeMeasure().run(self.dag).depth() def time_barrier_before_final_measurements(self, _, __): BarrierBeforeFinalMeasurements().run(self.dag) - def peakmem_barrier_before_final_measurement(self, _, __): - BarrierBeforeFinalMeasurements().run(self.dag) - def track_barrier_before_final_measurement(self, _, __): BarrierBeforeFinalMeasurements().run(self.dag).depth() def time_remove_diagonal_gates_before_measurement(self, _, __): RemoveDiagonalGatesBeforeMeasure().run(self.dag) - def peakmem_remove_diagonal_gates_before_measurement(self, _, __): - RemoveDiagonalGatesBeforeMeasure().run(self.dag) - def track_remove_diagonal_gates_before_measurement(self, _, __): return RemoveDiagonalGatesBeforeMeasure().run(self.dag).depth() def time_remove_final_measurements(self, _, __): RemoveFinalMeasurements().run(self.dag) - def peakmem_remove_final_measurements(self, _, __): - RemoveFinalMeasurements().run(self.dag) - def track_remove_final_measurements_depth(self, _, __): return RemoveFinalMeasurements().run(self.dag).depth() diff --git a/test/benchmarks/ripple_adder.py b/test/benchmarks/ripple_adder.py index c6390da12ddd..7fe078bab076 100644 --- a/test/benchmarks/ripple_adder.py +++ b/test/benchmarks/ripple_adder.py @@ -32,9 +32,6 @@ class RippleAdderConstruction: def time_build_ripple_adder(self, size): build_ripple_adder_circuit(size) - def peakmem_build_ripple_adder(self, size): - build_ripple_adder_circuit(size) - class RippleAdderTranspile: params = ([10, 20], @@ -53,10 +50,6 @@ def time_transpile_simulator_ripple_adder(self, _, level): transpile(self.circuit, self.sim_backend, optimization_level=level) - def peakmem_transpile_simulator_ripple_adder(self, _, level): - transpile(self.circuit, self.sim_backend, - optimization_level=level) - def track_depth_transpile_simulator_ripple_adder(self, _, level): return transpile(self.circuit, self.sim_backend, optimization_level=level).depth() @@ -67,12 +60,6 @@ def time_transpile_square_grid_ripple_adder(self, _, level): basis_gates=['u1', 'u2', 'u3', 'cx', 'id'], optimization_level=level) - def peakmem_transpile_square_grid_ripple_adder(self, _, level): - transpile(self.circuit, - coupling_map=self.coupling_map, - basis_gates=['u1', 'u2', 'u3', 'cx', 'id'], - optimization_level=level) - def track_depth_transpile_square_grid_ripple_adder(self, _, level): return transpile(self.circuit, coupling_map=self.coupling_map, diff --git a/test/benchmarks/transpiler_levels.py b/test/benchmarks/transpiler_levels.py index 073dae24360f..67b6fde93d9c 100644 --- a/test/benchmarks/transpiler_levels.py +++ b/test/benchmarks/transpiler_levels.py @@ -162,12 +162,6 @@ def time_quantum_volume_transpile_50_x_20(self, transpiler_level): seed_transpiler=0, optimization_level=transpiler_level) - def peakmem_quantum_volume_transpile_50_x_20(self, transpiler_level): - transpile(self.qv_50_x_20, basis_gates=self.basis_gates, - coupling_map=self.rochester_coupling_map, - seed_transpiler=0, - optimization_level=transpiler_level) - def track_depth_quantum_volume_transpile_50_x_20(self, transpiler_level): return transpile(self.qv_50_x_20, basis_gates=self.basis_gates, coupling_map=self.rochester_coupling_map, @@ -180,12 +174,6 @@ def time_transpile_from_large_qasm(self, transpiler_level): seed_transpiler=0, optimization_level=transpiler_level) - def peakmem_transpile_from_large_qasm(self, transpiler_level): - transpile(self.large_qasm, basis_gates=self.basis_gates, - coupling_map=self.rochester_coupling_map, - seed_transpiler=0, - optimization_level=transpiler_level) - def track_depth_transpile_from_large_qasm(self, transpiler_level): return transpile(self.large_qasm, basis_gates=self.basis_gates, coupling_map=self.rochester_coupling_map, @@ -197,11 +185,6 @@ def time_transpile_from_large_qasm_backend_with_prop(self, transpile(self.large_qasm, self.melbourne, seed_transpiler=0, optimization_level=transpiler_level) - def peakmem_transpile_from_large_qasm_backend_with_prop(self, - transpiler_level): - transpile(self.large_qasm, self.melbourne, seed_transpiler=0, - optimization_level=transpiler_level) - def track_depth_transpile_from_large_qasm_backend_with_prop( self, transpiler_level): return transpile(self.large_qasm, self.melbourne, seed_transpiler=0, @@ -211,10 +194,6 @@ def time_transpile_qv_14_x_14(self, transpiler_level): transpile(self.qv_14_x_14, self.melbourne, seed_transpiler=0, optimization_level=transpiler_level) - def peakmem_transpile_qv_14_x_14(self, transpiler_level): - transpile(self.qv_14_x_14, self.melbourne, seed_transpiler=0, - optimization_level=transpiler_level) - def track_depth_transpile_qv_14_x_14(self, transpiler_level): return transpile(self.qv_14_x_14, self.melbourne, seed_transpiler=0, optimization_level=transpiler_level).depth() From 24480ba3ce473408a43cc81efd79fff6139b9e19 Mon Sep 17 00:00:00 2001 From: Anton Dekusar <62334182+adekusar-drl@users.noreply.github.com> Date: Wed, 28 Oct 2020 21:04:39 +0000 Subject: [PATCH 36/61] Qualitative transpiler benchmarks using different layouts, routing methods, optimization levels (Qiskit/qiskit-metapackage#1072) * qualitative benchmarks * fix lint * fix lint * review updates * fix lint (can we have 100 chars everywhere?) Co-authored-by: Matthew Treinish --- test/benchmarks/qasm/depth_4gt10-v1_81.qasm | 152 ++++++ test/benchmarks/qasm/depth_4mod5-v0_19.qasm | 39 ++ test/benchmarks/qasm/depth_mod8-10_178.qasm | 346 +++++++++++++ test/benchmarks/qasm/time_cnt3-5_179.qasm | 179 +++++++ test/benchmarks/qasm/time_cnt3-5_180.qasm | 489 +++++++++++++++++++ test/benchmarks/qasm/time_qft_16.qasm | 516 ++++++++++++++++++++ test/benchmarks/transpiler_qualitative.py | 98 ++++ 7 files changed, 1819 insertions(+) create mode 100644 test/benchmarks/qasm/depth_4gt10-v1_81.qasm create mode 100644 test/benchmarks/qasm/depth_4mod5-v0_19.qasm create mode 100644 test/benchmarks/qasm/depth_mod8-10_178.qasm create mode 100644 test/benchmarks/qasm/time_cnt3-5_179.qasm create mode 100644 test/benchmarks/qasm/time_cnt3-5_180.qasm create mode 100644 test/benchmarks/qasm/time_qft_16.qasm create mode 100644 test/benchmarks/transpiler_qualitative.py diff --git a/test/benchmarks/qasm/depth_4gt10-v1_81.qasm b/test/benchmarks/qasm/depth_4gt10-v1_81.qasm new file mode 100644 index 000000000000..8db19386f9f6 --- /dev/null +++ b/test/benchmarks/qasm/depth_4gt10-v1_81.qasm @@ -0,0 +1,152 @@ +OPENQASM 2.0; +include "qelib1.inc"; +qreg q[16]; +creg c[16]; +x q[0]; +h q[1]; +t q[2]; +t q[3]; +t q[1]; +cx q[3],q[2]; +cx q[1],q[3]; +cx q[2],q[1]; +tdg q[3]; +cx q[2],q[3]; +tdg q[2]; +tdg q[3]; +t q[1]; +cx q[1],q[3]; +cx q[2],q[1]; +cx q[3],q[2]; +h q[1]; +h q[3]; +t q[0]; +t q[4]; +t q[3]; +cx q[4],q[0]; +cx q[3],q[4]; +cx q[0],q[3]; +tdg q[4]; +cx q[0],q[4]; +tdg q[0]; +tdg q[4]; +t q[3]; +cx q[3],q[4]; +cx q[0],q[3]; +cx q[4],q[0]; +h q[3]; +h q[1]; +t q[2]; +t q[3]; +t q[1]; +cx q[3],q[2]; +cx q[1],q[3]; +cx q[2],q[1]; +tdg q[3]; +cx q[2],q[3]; +tdg q[2]; +tdg q[3]; +t q[1]; +cx q[1],q[3]; +cx q[2],q[1]; +cx q[3],q[2]; +h q[1]; +h q[3]; +t q[0]; +t q[4]; +t q[3]; +cx q[4],q[0]; +cx q[3],q[4]; +cx q[0],q[3]; +tdg q[4]; +cx q[0],q[4]; +tdg q[0]; +tdg q[4]; +t q[3]; +cx q[3],q[4]; +cx q[0],q[3]; +cx q[4],q[0]; +h q[3]; +cx q[2],q[0]; +h q[2]; +t q[3]; +t q[0]; +t q[2]; +cx q[0],q[3]; +cx q[2],q[0]; +cx q[3],q[2]; +tdg q[0]; +cx q[3],q[0]; +tdg q[3]; +tdg q[0]; +t q[2]; +cx q[2],q[0]; +cx q[3],q[2]; +cx q[0],q[3]; +h q[2]; +h q[0]; +t q[1]; +t q[4]; +t q[0]; +cx q[4],q[1]; +cx q[0],q[4]; +cx q[1],q[0]; +tdg q[4]; +cx q[1],q[4]; +tdg q[1]; +tdg q[4]; +t q[0]; +cx q[0],q[4]; +cx q[1],q[0]; +cx q[4],q[1]; +h q[0]; +h q[2]; +t q[3]; +t q[0]; +t q[2]; +cx q[0],q[3]; +cx q[2],q[0]; +cx q[3],q[2]; +tdg q[0]; +cx q[3],q[0]; +tdg q[3]; +tdg q[0]; +t q[2]; +cx q[2],q[0]; +cx q[3],q[2]; +cx q[0],q[3]; +h q[2]; +h q[0]; +t q[1]; +t q[4]; +t q[0]; +cx q[4],q[1]; +cx q[0],q[4]; +cx q[1],q[0]; +tdg q[4]; +cx q[1],q[4]; +tdg q[1]; +tdg q[4]; +t q[0]; +cx q[0],q[4]; +cx q[1],q[0]; +cx q[4],q[1]; +h q[0]; +cx q[1],q[4]; +cx q[4],q[2]; +h q[4]; +t q[2]; +t q[0]; +t q[4]; +cx q[0],q[2]; +cx q[4],q[0]; +cx q[2],q[4]; +tdg q[0]; +cx q[2],q[0]; +tdg q[2]; +tdg q[0]; +t q[4]; +cx q[4],q[0]; +cx q[2],q[4]; +cx q[0],q[2]; +h q[4]; diff --git a/test/benchmarks/qasm/depth_4mod5-v0_19.qasm b/test/benchmarks/qasm/depth_4mod5-v0_19.qasm new file mode 100644 index 000000000000..c402a60948e5 --- /dev/null +++ b/test/benchmarks/qasm/depth_4mod5-v0_19.qasm @@ -0,0 +1,39 @@ +OPENQASM 2.0; +include "qelib1.inc"; +qreg q[16]; +creg c[16]; +x q[3]; +cx q[1],q[3]; +cx q[3],q[4]; +h q[4]; +t q[3]; +t q[2]; +t q[4]; +cx q[2],q[3]; +cx q[4],q[2]; +cx q[3],q[4]; +tdg q[2]; +cx q[3],q[2]; +tdg q[3]; +tdg q[2]; +t q[4]; +cx q[4],q[2]; +cx q[3],q[4]; +cx q[2],q[3]; +h q[4]; +h q[4]; +t q[3]; +t q[0]; +t q[4]; +cx q[0],q[3]; +cx q[4],q[0]; +cx q[3],q[4]; +tdg q[0]; +cx q[3],q[0]; +tdg q[3]; +tdg q[0]; +t q[4]; +cx q[4],q[0]; +cx q[3],q[4]; +cx q[0],q[3]; +h q[4]; diff --git a/test/benchmarks/qasm/depth_mod8-10_178.qasm b/test/benchmarks/qasm/depth_mod8-10_178.qasm new file mode 100644 index 000000000000..090258d1a91c --- /dev/null +++ b/test/benchmarks/qasm/depth_mod8-10_178.qasm @@ -0,0 +1,346 @@ +OPENQASM 2.0; +include "qelib1.inc"; +qreg q[16]; +creg c[16]; +h q[2]; +t q[4]; +t q[3]; +t q[2]; +cx q[3],q[4]; +cx q[2],q[3]; +cx q[4],q[2]; +tdg q[3]; +cx q[4],q[3]; +tdg q[4]; +tdg q[3]; +t q[2]; +cx q[2],q[3]; +cx q[4],q[2]; +cx q[3],q[4]; +h q[2]; +cx q[4],q[2]; +cx q[1],q[3]; +h q[5]; +t q[4]; +t q[3]; +t q[5]; +cx q[3],q[4]; +cx q[5],q[3]; +cx q[4],q[5]; +tdg q[3]; +cx q[4],q[3]; +tdg q[4]; +tdg q[3]; +t q[5]; +cx q[5],q[3]; +cx q[4],q[5]; +cx q[3],q[4]; +h q[5]; +h q[1]; +t q[5]; +t q[4]; +t q[1]; +cx q[4],q[5]; +cx q[1],q[4]; +cx q[5],q[1]; +tdg q[4]; +cx q[5],q[4]; +tdg q[5]; +tdg q[4]; +t q[1]; +cx q[1],q[4]; +cx q[5],q[1]; +cx q[4],q[5]; +h q[1]; +h q[4]; +t q[2]; +t q[0]; +t q[4]; +cx q[0],q[2]; +cx q[4],q[0]; +cx q[2],q[4]; +tdg q[0]; +cx q[2],q[0]; +tdg q[2]; +tdg q[0]; +t q[4]; +cx q[4],q[0]; +cx q[2],q[4]; +cx q[0],q[2]; +h q[4]; +h q[1]; +t q[5]; +t q[4]; +t q[1]; +cx q[4],q[5]; +cx q[1],q[4]; +cx q[5],q[1]; +tdg q[4]; +cx q[5],q[4]; +tdg q[5]; +tdg q[4]; +t q[1]; +cx q[1],q[4]; +cx q[5],q[1]; +cx q[4],q[5]; +h q[1]; +h q[4]; +t q[2]; +t q[0]; +t q[4]; +cx q[0],q[2]; +cx q[4],q[0]; +cx q[2],q[4]; +tdg q[0]; +cx q[2],q[0]; +tdg q[2]; +tdg q[0]; +t q[4]; +cx q[4],q[0]; +cx q[2],q[4]; +cx q[0],q[2]; +h q[4]; +h q[5]; +t q[4]; +t q[3]; +t q[5]; +cx q[3],q[4]; +cx q[5],q[3]; +cx q[4],q[5]; +tdg q[3]; +cx q[4],q[3]; +tdg q[4]; +tdg q[3]; +t q[5]; +cx q[5],q[3]; +cx q[4],q[5]; +cx q[3],q[4]; +h q[5]; +h q[1]; +t q[5]; +t q[4]; +t q[1]; +cx q[4],q[5]; +cx q[1],q[4]; +cx q[5],q[1]; +tdg q[4]; +cx q[5],q[4]; +tdg q[5]; +tdg q[4]; +t q[1]; +cx q[1],q[4]; +cx q[5],q[1]; +cx q[4],q[5]; +h q[1]; +h q[4]; +t q[2]; +t q[0]; +t q[4]; +cx q[0],q[2]; +cx q[4],q[0]; +cx q[2],q[4]; +tdg q[0]; +cx q[2],q[0]; +tdg q[2]; +tdg q[0]; +t q[4]; +cx q[4],q[0]; +cx q[2],q[4]; +cx q[0],q[2]; +h q[4]; +h q[1]; +t q[5]; +t q[4]; +t q[1]; +cx q[4],q[5]; +cx q[1],q[4]; +cx q[5],q[1]; +tdg q[4]; +cx q[5],q[4]; +tdg q[5]; +tdg q[4]; +t q[1]; +cx q[1],q[4]; +cx q[5],q[1]; +cx q[4],q[5]; +h q[1]; +h q[4]; +t q[2]; +t q[0]; +t q[4]; +cx q[0],q[2]; +cx q[4],q[0]; +cx q[2],q[4]; +tdg q[0]; +cx q[2],q[0]; +tdg q[2]; +tdg q[0]; +t q[4]; +cx q[4],q[0]; +cx q[2],q[4]; +cx q[0],q[2]; +h q[4]; +cx q[1],q[3]; +h q[5]; +t q[4]; +t q[2]; +t q[5]; +cx q[2],q[4]; +cx q[5],q[2]; +cx q[4],q[5]; +tdg q[2]; +cx q[4],q[2]; +tdg q[4]; +tdg q[2]; +t q[5]; +cx q[5],q[2]; +cx q[4],q[5]; +cx q[2],q[4]; +h q[5]; +h q[3]; +t q[5]; +t q[4]; +t q[3]; +cx q[4],q[5]; +cx q[3],q[4]; +cx q[5],q[3]; +tdg q[4]; +cx q[5],q[4]; +tdg q[5]; +tdg q[4]; +t q[3]; +cx q[3],q[4]; +cx q[5],q[3]; +cx q[4],q[5]; +h q[3]; +h q[4]; +t q[1]; +t q[0]; +t q[4]; +cx q[0],q[1]; +cx q[4],q[0]; +cx q[1],q[4]; +tdg q[0]; +cx q[1],q[0]; +tdg q[1]; +tdg q[0]; +t q[4]; +cx q[4],q[0]; +cx q[1],q[4]; +cx q[0],q[1]; +h q[4]; +h q[3]; +t q[5]; +t q[4]; +t q[3]; +cx q[4],q[5]; +cx q[3],q[4]; +cx q[5],q[3]; +tdg q[4]; +cx q[5],q[4]; +tdg q[5]; +tdg q[4]; +t q[3]; +cx q[3],q[4]; +cx q[5],q[3]; +cx q[4],q[5]; +h q[3]; +h q[4]; +t q[1]; +t q[0]; +t q[4]; +cx q[0],q[1]; +cx q[4],q[0]; +cx q[1],q[4]; +tdg q[0]; +cx q[1],q[0]; +tdg q[1]; +tdg q[0]; +t q[4]; +cx q[4],q[0]; +cx q[1],q[4]; +cx q[0],q[1]; +h q[4]; +h q[5]; +t q[4]; +t q[2]; +t q[5]; +cx q[2],q[4]; +cx q[5],q[2]; +cx q[4],q[5]; +tdg q[2]; +cx q[4],q[2]; +tdg q[4]; +tdg q[2]; +t q[5]; +cx q[5],q[2]; +cx q[4],q[5]; +cx q[2],q[4]; +h q[5]; +h q[3]; +t q[5]; +t q[4]; +t q[3]; +cx q[4],q[5]; +cx q[3],q[4]; +cx q[5],q[3]; +tdg q[4]; +cx q[5],q[4]; +tdg q[5]; +tdg q[4]; +t q[3]; +cx q[3],q[4]; +cx q[5],q[3]; +cx q[4],q[5]; +h q[3]; +h q[4]; +t q[1]; +t q[0]; +t q[4]; +cx q[0],q[1]; +cx q[4],q[0]; +cx q[1],q[4]; +tdg q[0]; +cx q[1],q[0]; +tdg q[1]; +tdg q[0]; +t q[4]; +cx q[4],q[0]; +cx q[1],q[4]; +cx q[0],q[1]; +h q[4]; +h q[3]; +t q[5]; +t q[4]; +t q[3]; +cx q[4],q[5]; +cx q[3],q[4]; +cx q[5],q[3]; +tdg q[4]; +cx q[5],q[4]; +tdg q[5]; +tdg q[4]; +t q[3]; +cx q[3],q[4]; +cx q[5],q[3]; +cx q[4],q[5]; +h q[3]; +h q[4]; +t q[1]; +t q[0]; +t q[4]; +cx q[0],q[1]; +cx q[4],q[0]; +cx q[1],q[4]; +tdg q[0]; +cx q[1],q[0]; +tdg q[1]; +tdg q[0]; +t q[4]; +cx q[4],q[0]; +cx q[1],q[4]; +cx q[0],q[1]; +h q[4]; +cx q[4],q[3]; +cx q[4],q[2]; +x q[4]; diff --git a/test/benchmarks/qasm/time_cnt3-5_179.qasm b/test/benchmarks/qasm/time_cnt3-5_179.qasm new file mode 100644 index 000000000000..8ab1eb252015 --- /dev/null +++ b/test/benchmarks/qasm/time_cnt3-5_179.qasm @@ -0,0 +1,179 @@ +OPENQASM 2.0; +include "qelib1.inc"; +qreg q[16]; +creg c[16]; +cx q[12],q[15]; +h q[12]; +t q[14]; +t q[13]; +t q[12]; +cx q[13],q[14]; +cx q[12],q[13]; +cx q[14],q[12]; +tdg q[13]; +cx q[14],q[13]; +tdg q[14]; +tdg q[13]; +t q[12]; +cx q[12],q[13]; +cx q[14],q[12]; +cx q[13],q[14]; +h q[12]; +cx q[12],q[15]; +h q[14]; +t q[15]; +t q[13]; +t q[14]; +cx q[13],q[15]; +cx q[14],q[13]; +cx q[15],q[14]; +tdg q[13]; +cx q[15],q[13]; +tdg q[15]; +tdg q[13]; +t q[14]; +cx q[14],q[13]; +cx q[15],q[14]; +cx q[13],q[15]; +h q[14]; +cx q[13],q[15]; +cx q[9],q[11]; +h q[9]; +t q[10]; +t q[12]; +t q[9]; +cx q[12],q[10]; +cx q[9],q[12]; +cx q[10],q[9]; +tdg q[12]; +cx q[10],q[12]; +tdg q[10]; +tdg q[12]; +t q[9]; +cx q[9],q[12]; +cx q[10],q[9]; +cx q[12],q[10]; +h q[9]; +cx q[9],q[11]; +h q[10]; +t q[11]; +t q[12]; +t q[10]; +cx q[12],q[11]; +cx q[10],q[12]; +cx q[11],q[10]; +tdg q[12]; +cx q[11],q[12]; +tdg q[11]; +tdg q[12]; +t q[10]; +cx q[10],q[12]; +cx q[11],q[10]; +cx q[12],q[11]; +h q[10]; +cx q[12],q[11]; +cx q[6],q[8]; +h q[6]; +t q[7]; +t q[9]; +t q[6]; +cx q[9],q[7]; +cx q[6],q[9]; +cx q[7],q[6]; +tdg q[9]; +cx q[7],q[9]; +tdg q[7]; +tdg q[9]; +t q[6]; +cx q[6],q[9]; +cx q[7],q[6]; +cx q[9],q[7]; +h q[6]; +cx q[6],q[8]; +h q[7]; +t q[8]; +t q[9]; +t q[7]; +cx q[9],q[8]; +cx q[7],q[9]; +cx q[8],q[7]; +tdg q[9]; +cx q[8],q[9]; +tdg q[8]; +tdg q[9]; +t q[7]; +cx q[7],q[9]; +cx q[8],q[7]; +cx q[9],q[8]; +h q[7]; +cx q[9],q[8]; +cx q[3],q[5]; +h q[3]; +t q[4]; +t q[6]; +t q[3]; +cx q[6],q[4]; +cx q[3],q[6]; +cx q[4],q[3]; +tdg q[6]; +cx q[4],q[6]; +tdg q[4]; +tdg q[6]; +t q[3]; +cx q[3],q[6]; +cx q[4],q[3]; +cx q[6],q[4]; +h q[3]; +cx q[3],q[5]; +h q[4]; +t q[5]; +t q[6]; +t q[4]; +cx q[6],q[5]; +cx q[4],q[6]; +cx q[5],q[4]; +tdg q[6]; +cx q[5],q[6]; +tdg q[5]; +tdg q[6]; +t q[4]; +cx q[4],q[6]; +cx q[5],q[4]; +cx q[6],q[5]; +h q[4]; +cx q[6],q[5]; +cx q[0],q[2]; +h q[0]; +t q[1]; +t q[3]; +t q[0]; +cx q[3],q[1]; +cx q[0],q[3]; +cx q[1],q[0]; +tdg q[3]; +cx q[1],q[3]; +tdg q[1]; +tdg q[3]; +t q[0]; +cx q[0],q[3]; +cx q[1],q[0]; +cx q[3],q[1]; +h q[0]; +cx q[0],q[2]; +h q[1]; +t q[2]; +t q[3]; +t q[1]; +cx q[3],q[2]; +cx q[1],q[3]; +cx q[2],q[1]; +tdg q[3]; +cx q[2],q[3]; +tdg q[2]; +tdg q[3]; +t q[1]; +cx q[1],q[3]; +cx q[2],q[1]; +cx q[3],q[2]; +h q[1]; +cx q[3],q[2]; diff --git a/test/benchmarks/qasm/time_cnt3-5_180.qasm b/test/benchmarks/qasm/time_cnt3-5_180.qasm new file mode 100644 index 000000000000..7fdc0f0c90f4 --- /dev/null +++ b/test/benchmarks/qasm/time_cnt3-5_180.qasm @@ -0,0 +1,489 @@ +OPENQASM 2.0; +include "qelib1.inc"; +qreg q[16]; +creg c[16]; +h q[15]; +t q[13]; +t q[14]; +t q[15]; +cx q[14],q[13]; +cx q[15],q[14]; +cx q[13],q[15]; +tdg q[14]; +cx q[13],q[14]; +tdg q[13]; +tdg q[14]; +t q[15]; +cx q[15],q[14]; +cx q[13],q[15]; +cx q[14],q[13]; +h q[15]; +h q[12]; +t q[13]; +t q[11]; +t q[12]; +cx q[11],q[13]; +cx q[12],q[11]; +cx q[13],q[12]; +tdg q[11]; +cx q[13],q[11]; +tdg q[13]; +tdg q[11]; +t q[12]; +cx q[12],q[11]; +cx q[13],q[12]; +cx q[11],q[13]; +h q[12]; +h q[11]; +t q[15]; +t q[14]; +t q[11]; +cx q[14],q[15]; +cx q[11],q[14]; +cx q[15],q[11]; +tdg q[14]; +cx q[15],q[14]; +tdg q[15]; +tdg q[14]; +t q[11]; +cx q[11],q[14]; +cx q[15],q[11]; +cx q[14],q[15]; +h q[11]; +h q[12]; +t q[13]; +t q[11]; +t q[12]; +cx q[11],q[13]; +cx q[12],q[11]; +cx q[13],q[12]; +tdg q[11]; +cx q[13],q[11]; +tdg q[13]; +tdg q[11]; +t q[12]; +cx q[12],q[11]; +cx q[13],q[12]; +cx q[11],q[13]; +h q[12]; +h q[11]; +t q[15]; +t q[14]; +t q[11]; +cx q[14],q[15]; +cx q[11],q[14]; +cx q[15],q[11]; +tdg q[14]; +cx q[15],q[14]; +tdg q[15]; +tdg q[14]; +t q[11]; +cx q[11],q[14]; +cx q[15],q[11]; +cx q[14],q[15]; +h q[11]; +h q[14]; +t q[15]; +t q[13]; +t q[14]; +cx q[13],q[15]; +cx q[14],q[13]; +cx q[15],q[14]; +tdg q[13]; +cx q[15],q[13]; +tdg q[15]; +tdg q[13]; +t q[14]; +cx q[14],q[13]; +cx q[15],q[14]; +cx q[13],q[15]; +h q[14]; +cx q[13],q[15]; +h q[11]; +t q[12]; +t q[10]; +t q[11]; +cx q[10],q[12]; +cx q[11],q[10]; +cx q[12],q[11]; +tdg q[10]; +cx q[12],q[10]; +tdg q[12]; +tdg q[10]; +t q[11]; +cx q[11],q[10]; +cx q[12],q[11]; +cx q[10],q[12]; +h q[11]; +h q[9]; +t q[12]; +t q[15]; +t q[9]; +cx q[15],q[12]; +cx q[9],q[15]; +cx q[12],q[9]; +tdg q[15]; +cx q[12],q[15]; +tdg q[12]; +tdg q[15]; +t q[9]; +cx q[9],q[15]; +cx q[12],q[9]; +cx q[15],q[12]; +h q[9]; +h q[15]; +t q[11]; +t q[10]; +t q[15]; +cx q[10],q[11]; +cx q[15],q[10]; +cx q[11],q[15]; +tdg q[10]; +cx q[11],q[10]; +tdg q[11]; +tdg q[10]; +t q[15]; +cx q[15],q[10]; +cx q[11],q[15]; +cx q[10],q[11]; +h q[15]; +h q[9]; +t q[12]; +t q[15]; +t q[9]; +cx q[15],q[12]; +cx q[9],q[15]; +cx q[12],q[9]; +tdg q[15]; +cx q[12],q[15]; +tdg q[12]; +tdg q[15]; +t q[9]; +cx q[9],q[15]; +cx q[12],q[9]; +cx q[15],q[12]; +h q[9]; +h q[15]; +t q[11]; +t q[10]; +t q[15]; +cx q[10],q[11]; +cx q[15],q[10]; +cx q[11],q[15]; +tdg q[10]; +cx q[11],q[10]; +tdg q[11]; +tdg q[10]; +t q[15]; +cx q[15],q[10]; +cx q[11],q[15]; +cx q[10],q[11]; +h q[15]; +h q[10]; +t q[11]; +t q[12]; +t q[10]; +cx q[12],q[11]; +cx q[10],q[12]; +cx q[11],q[10]; +tdg q[12]; +cx q[11],q[12]; +tdg q[11]; +tdg q[12]; +t q[10]; +cx q[10],q[12]; +cx q[11],q[10]; +cx q[12],q[11]; +h q[10]; +cx q[12],q[11]; +h q[8]; +t q[9]; +t q[7]; +t q[8]; +cx q[7],q[9]; +cx q[8],q[7]; +cx q[9],q[8]; +tdg q[7]; +cx q[9],q[7]; +tdg q[9]; +tdg q[7]; +t q[8]; +cx q[8],q[7]; +cx q[9],q[8]; +cx q[7],q[9]; +h q[8]; +h q[6]; +t q[9]; +t q[15]; +t q[6]; +cx q[15],q[9]; +cx q[6],q[15]; +cx q[9],q[6]; +tdg q[15]; +cx q[9],q[15]; +tdg q[9]; +tdg q[15]; +t q[6]; +cx q[6],q[15]; +cx q[9],q[6]; +cx q[15],q[9]; +h q[6]; +h q[15]; +t q[8]; +t q[7]; +t q[15]; +cx q[7],q[8]; +cx q[15],q[7]; +cx q[8],q[15]; +tdg q[7]; +cx q[8],q[7]; +tdg q[8]; +tdg q[7]; +t q[15]; +cx q[15],q[7]; +cx q[8],q[15]; +cx q[7],q[8]; +h q[15]; +h q[6]; +t q[9]; +t q[15]; +t q[6]; +cx q[15],q[9]; +cx q[6],q[15]; +cx q[9],q[6]; +tdg q[15]; +cx q[9],q[15]; +tdg q[9]; +tdg q[15]; +t q[6]; +cx q[6],q[15]; +cx q[9],q[6]; +cx q[15],q[9]; +h q[6]; +h q[15]; +t q[8]; +t q[7]; +t q[15]; +cx q[7],q[8]; +cx q[15],q[7]; +cx q[8],q[15]; +tdg q[7]; +cx q[8],q[7]; +tdg q[8]; +tdg q[7]; +t q[15]; +cx q[15],q[7]; +cx q[8],q[15]; +cx q[7],q[8]; +h q[15]; +h q[7]; +t q[8]; +t q[9]; +t q[7]; +cx q[9],q[8]; +cx q[7],q[9]; +cx q[8],q[7]; +tdg q[9]; +cx q[8],q[9]; +tdg q[8]; +tdg q[9]; +t q[7]; +cx q[7],q[9]; +cx q[8],q[7]; +cx q[9],q[8]; +h q[7]; +cx q[9],q[8]; +h q[5]; +t q[6]; +t q[4]; +t q[5]; +cx q[4],q[6]; +cx q[5],q[4]; +cx q[6],q[5]; +tdg q[4]; +cx q[6],q[4]; +tdg q[6]; +tdg q[4]; +t q[5]; +cx q[5],q[4]; +cx q[6],q[5]; +cx q[4],q[6]; +h q[5]; +h q[3]; +t q[6]; +t q[15]; +t q[3]; +cx q[15],q[6]; +cx q[3],q[15]; +cx q[6],q[3]; +tdg q[15]; +cx q[6],q[15]; +tdg q[6]; +tdg q[15]; +t q[3]; +cx q[3],q[15]; +cx q[6],q[3]; +cx q[15],q[6]; +h q[3]; +h q[15]; +t q[5]; +t q[4]; +t q[15]; +cx q[4],q[5]; +cx q[15],q[4]; +cx q[5],q[15]; +tdg q[4]; +cx q[5],q[4]; +tdg q[5]; +tdg q[4]; +t q[15]; +cx q[15],q[4]; +cx q[5],q[15]; +cx q[4],q[5]; +h q[15]; +h q[3]; +t q[6]; +t q[15]; +t q[3]; +cx q[15],q[6]; +cx q[3],q[15]; +cx q[6],q[3]; +tdg q[15]; +cx q[6],q[15]; +tdg q[6]; +tdg q[15]; +t q[3]; +cx q[3],q[15]; +cx q[6],q[3]; +cx q[15],q[6]; +h q[3]; +h q[15]; +t q[5]; +t q[4]; +t q[15]; +cx q[4],q[5]; +cx q[15],q[4]; +cx q[5],q[15]; +tdg q[4]; +cx q[5],q[4]; +tdg q[5]; +tdg q[4]; +t q[15]; +cx q[15],q[4]; +cx q[5],q[15]; +cx q[4],q[5]; +h q[15]; +h q[4]; +t q[5]; +t q[6]; +t q[4]; +cx q[6],q[5]; +cx q[4],q[6]; +cx q[5],q[4]; +tdg q[6]; +cx q[5],q[6]; +tdg q[5]; +tdg q[6]; +t q[4]; +cx q[4],q[6]; +cx q[5],q[4]; +cx q[6],q[5]; +h q[4]; +cx q[6],q[5]; +h q[2]; +t q[3]; +t q[1]; +t q[2]; +cx q[1],q[3]; +cx q[2],q[1]; +cx q[3],q[2]; +tdg q[1]; +cx q[3],q[1]; +tdg q[3]; +tdg q[1]; +t q[2]; +cx q[2],q[1]; +cx q[3],q[2]; +cx q[1],q[3]; +h q[2]; +h q[0]; +t q[3]; +t q[15]; +t q[0]; +cx q[15],q[3]; +cx q[0],q[15]; +cx q[3],q[0]; +tdg q[15]; +cx q[3],q[15]; +tdg q[3]; +tdg q[15]; +t q[0]; +cx q[0],q[15]; +cx q[3],q[0]; +cx q[15],q[3]; +h q[0]; +h q[15]; +t q[2]; +t q[1]; +t q[15]; +cx q[1],q[2]; +cx q[15],q[1]; +cx q[2],q[15]; +tdg q[1]; +cx q[2],q[1]; +tdg q[2]; +tdg q[1]; +t q[15]; +cx q[15],q[1]; +cx q[2],q[15]; +cx q[1],q[2]; +h q[15]; +h q[0]; +t q[3]; +t q[15]; +t q[0]; +cx q[15],q[3]; +cx q[0],q[15]; +cx q[3],q[0]; +tdg q[15]; +cx q[3],q[15]; +tdg q[3]; +tdg q[15]; +t q[0]; +cx q[0],q[15]; +cx q[3],q[0]; +cx q[15],q[3]; +h q[0]; +h q[15]; +t q[2]; +t q[1]; +t q[15]; +cx q[1],q[2]; +cx q[15],q[1]; +cx q[2],q[15]; +tdg q[1]; +cx q[2],q[1]; +tdg q[2]; +tdg q[1]; +t q[15]; +cx q[15],q[1]; +cx q[2],q[15]; +cx q[1],q[2]; +h q[15]; +h q[1]; +t q[2]; +t q[3]; +t q[1]; +cx q[3],q[2]; +cx q[1],q[3]; +cx q[2],q[1]; +tdg q[3]; +cx q[2],q[3]; +tdg q[2]; +tdg q[3]; +t q[1]; +cx q[1],q[3]; +cx q[2],q[1]; +cx q[3],q[2]; +h q[1]; +cx q[3],q[2]; diff --git a/test/benchmarks/qasm/time_qft_16.qasm b/test/benchmarks/qasm/time_qft_16.qasm new file mode 100644 index 000000000000..0984ed46f6ca --- /dev/null +++ b/test/benchmarks/qasm/time_qft_16.qasm @@ -0,0 +1,516 @@ +OPENQASM 2.0; +include "qelib1.inc"; +qreg q[16]; +creg c[16]; +h q[0]; +rz(-0.7854) q[0]; +cx q[0],q[1]; +rz(0.7854) q[0]; +cx q[0],q[1]; +rz(-0.3927) q[0]; +cx q[0],q[2]; +rz(0.3927) q[0]; +cx q[0],q[2]; +rz(-0.19635) q[0]; +cx q[0],q[3]; +rz(0.19635) q[0]; +cx q[0],q[3]; +rz(-0.09815) q[0]; +cx q[0],q[4]; +rz(0.09815) q[0]; +cx q[0],q[4]; +rz(-0.0491) q[0]; +cx q[0],q[5]; +rz(0.0491) q[0]; +cx q[0],q[5]; +rz(-0.02455) q[0]; +cx q[0],q[6]; +rz(0.02455) q[0]; +cx q[0],q[6]; +rz(-0.01225) q[0]; +cx q[0],q[7]; +rz(0.01225) q[0]; +cx q[0],q[7]; +rz(-0.00615) q[0]; +cx q[0],q[8]; +rz(0.00615) q[0]; +cx q[0],q[8]; +rz(-0.00305) q[0]; +cx q[0],q[9]; +rz(0.00305) q[0]; +cx q[0],q[9]; +rz(-0.00155) q[0]; +cx q[0],q[10]; +rz(0.00155) q[0]; +cx q[0],q[10]; +rz(-0.00075) q[0]; +cx q[0],q[11]; +rz(0.00075) q[0]; +cx q[0],q[11]; +rz(-0.0004) q[0]; +cx q[0],q[12]; +rz(0.0004) q[0]; +cx q[0],q[12]; +rz(-0.0002) q[0]; +cx q[0],q[13]; +rz(0.0002) q[0]; +cx q[0],q[13]; +rz(-0.0001) q[0]; +cx q[0],q[14]; +rz(0.0001) q[0]; +cx q[0],q[14]; +rz(-0.00005) q[0]; +cx q[0],q[15]; +rz(0.00005) q[0]; +cx q[0],q[15]; +h q[1]; +rz(-0.7854) q[1]; +cx q[1],q[2]; +rz(0.7854) q[1]; +cx q[1],q[2]; +rz(-0.3927) q[1]; +cx q[1],q[3]; +rz(0.3927) q[1]; +cx q[1],q[3]; +rz(-0.19635) q[1]; +cx q[1],q[4]; +rz(0.19635) q[1]; +cx q[1],q[4]; +rz(-0.09815) q[1]; +cx q[1],q[5]; +rz(0.09815) q[1]; +cx q[1],q[5]; +rz(-0.0491) q[1]; +cx q[1],q[6]; +rz(0.0491) q[1]; +cx q[1],q[6]; +rz(-0.02455) q[1]; +cx q[1],q[7]; +rz(0.02455) q[1]; +cx q[1],q[7]; +rz(-0.01225) q[1]; +cx q[1],q[8]; +rz(0.01225) q[1]; +cx q[1],q[8]; +rz(-0.00615) q[1]; +cx q[1],q[9]; +rz(0.00615) q[1]; +cx q[1],q[9]; +rz(-0.00305) q[1]; +cx q[1],q[10]; +rz(0.00305) q[1]; +cx q[1],q[10]; +rz(-0.00155) q[1]; +cx q[1],q[11]; +rz(0.00155) q[1]; +cx q[1],q[11]; +rz(-0.00075) q[1]; +cx q[1],q[12]; +rz(0.00075) q[1]; +cx q[1],q[12]; +rz(-0.0004) q[1]; +cx q[1],q[13]; +rz(0.0004) q[1]; +cx q[1],q[13]; +rz(-0.0002) q[1]; +cx q[1],q[14]; +rz(0.0002) q[1]; +cx q[1],q[14]; +rz(-0.0001) q[1]; +cx q[1],q[15]; +rz(0.0001) q[1]; +cx q[1],q[15]; +h q[2]; +rz(-0.7854) q[2]; +cx q[2],q[3]; +rz(0.7854) q[2]; +cx q[2],q[3]; +rz(-0.3927) q[2]; +cx q[2],q[4]; +rz(0.3927) q[2]; +cx q[2],q[4]; +rz(-0.19635) q[2]; +cx q[2],q[5]; +rz(0.19635) q[2]; +cx q[2],q[5]; +rz(-0.09815) q[2]; +cx q[2],q[6]; +rz(0.09815) q[2]; +cx q[2],q[6]; +rz(-0.0491) q[2]; +cx q[2],q[7]; +rz(0.0491) q[2]; +cx q[2],q[7]; +rz(-0.02455) q[2]; +cx q[2],q[8]; +rz(0.02455) q[2]; +cx q[2],q[8]; +rz(-0.01225) q[2]; +cx q[2],q[9]; +rz(0.01225) q[2]; +cx q[2],q[9]; +rz(-0.00615) q[2]; +cx q[2],q[10]; +rz(0.00615) q[2]; +cx q[2],q[10]; +rz(-0.00305) q[2]; +cx q[2],q[11]; +rz(0.00305) q[2]; +cx q[2],q[11]; +rz(-0.00155) q[2]; +cx q[2],q[12]; +rz(0.00155) q[2]; +cx q[2],q[12]; +rz(-0.00075) q[2]; +cx q[2],q[13]; +rz(0.00075) q[2]; +cx q[2],q[13]; +rz(-0.0004) q[2]; +cx q[2],q[14]; +rz(0.0004) q[2]; +cx q[2],q[14]; +rz(-0.0002) q[2]; +cx q[2],q[15]; +rz(0.0002) q[2]; +cx q[2],q[15]; +h q[3]; +rz(-0.7854) q[3]; +cx q[3],q[4]; +rz(0.7854) q[3]; +cx q[3],q[4]; +rz(-0.3927) q[3]; +cx q[3],q[5]; +rz(0.3927) q[3]; +cx q[3],q[5]; +rz(-0.19635) q[3]; +cx q[3],q[6]; +rz(0.19635) q[3]; +cx q[3],q[6]; +rz(-0.09815) q[3]; +cx q[3],q[7]; +rz(0.09815) q[3]; +cx q[3],q[7]; +rz(-0.0491) q[3]; +cx q[3],q[8]; +rz(0.0491) q[3]; +cx q[3],q[8]; +rz(-0.02455) q[3]; +cx q[3],q[9]; +rz(0.02455) q[3]; +cx q[3],q[9]; +rz(-0.01225) q[3]; +cx q[3],q[10]; +rz(0.01225) q[3]; +cx q[3],q[10]; +rz(-0.00615) q[3]; +cx q[3],q[11]; +rz(0.00615) q[3]; +cx q[3],q[11]; +rz(-0.00305) q[3]; +cx q[3],q[12]; +rz(0.00305) q[3]; +cx q[3],q[12]; +rz(-0.00155) q[3]; +cx q[3],q[13]; +rz(0.00155) q[3]; +cx q[3],q[13]; +rz(-0.00075) q[3]; +cx q[3],q[14]; +rz(0.00075) q[3]; +cx q[3],q[14]; +rz(-0.0004) q[3]; +cx q[3],q[15]; +rz(0.0004) q[3]; +cx q[3],q[15]; +h q[4]; +rz(-0.7854) q[4]; +cx q[4],q[5]; +rz(0.7854) q[4]; +cx q[4],q[5]; +rz(-0.3927) q[4]; +cx q[4],q[6]; +rz(0.3927) q[4]; +cx q[4],q[6]; +rz(-0.19635) q[4]; +cx q[4],q[7]; +rz(0.19635) q[4]; +cx q[4],q[7]; +rz(-0.09815) q[4]; +cx q[4],q[8]; +rz(0.09815) q[4]; +cx q[4],q[8]; +rz(-0.0491) q[4]; +cx q[4],q[9]; +rz(0.0491) q[4]; +cx q[4],q[9]; +rz(-0.02455) q[4]; +cx q[4],q[10]; +rz(0.02455) q[4]; +cx q[4],q[10]; +rz(-0.01225) q[4]; +cx q[4],q[11]; +rz(0.01225) q[4]; +cx q[4],q[11]; +rz(-0.00615) q[4]; +cx q[4],q[12]; +rz(0.00615) q[4]; +cx q[4],q[12]; +rz(-0.00305) q[4]; +cx q[4],q[13]; +rz(0.00305) q[4]; +cx q[4],q[13]; +rz(-0.00155) q[4]; +cx q[4],q[14]; +rz(0.00155) q[4]; +cx q[4],q[14]; +rz(-0.00075) q[4]; +cx q[4],q[15]; +rz(0.00075) q[4]; +cx q[4],q[15]; +h q[5]; +rz(-0.7854) q[5]; +cx q[5],q[6]; +rz(0.7854) q[5]; +cx q[5],q[6]; +rz(-0.3927) q[5]; +cx q[5],q[7]; +rz(0.3927) q[5]; +cx q[5],q[7]; +rz(-0.19635) q[5]; +cx q[5],q[8]; +rz(0.19635) q[5]; +cx q[5],q[8]; +rz(-0.09815) q[5]; +cx q[5],q[9]; +rz(0.09815) q[5]; +cx q[5],q[9]; +rz(-0.0491) q[5]; +cx q[5],q[10]; +rz(0.0491) q[5]; +cx q[5],q[10]; +rz(-0.02455) q[5]; +cx q[5],q[11]; +rz(0.02455) q[5]; +cx q[5],q[11]; +rz(-0.01225) q[5]; +cx q[5],q[12]; +rz(0.01225) q[5]; +cx q[5],q[12]; +rz(-0.00615) q[5]; +cx q[5],q[13]; +rz(0.00615) q[5]; +cx q[5],q[13]; +rz(-0.00305) q[5]; +cx q[5],q[14]; +rz(0.00305) q[5]; +cx q[5],q[14]; +rz(-0.00155) q[5]; +cx q[5],q[15]; +rz(0.00155) q[5]; +cx q[5],q[15]; +h q[6]; +rz(-0.7854) q[6]; +cx q[6],q[7]; +rz(0.7854) q[6]; +cx q[6],q[7]; +rz(-0.3927) q[6]; +cx q[6],q[8]; +rz(0.3927) q[6]; +cx q[6],q[8]; +rz(-0.19635) q[6]; +cx q[6],q[9]; +rz(0.19635) q[6]; +cx q[6],q[9]; +rz(-0.09815) q[6]; +cx q[6],q[10]; +rz(0.09815) q[6]; +cx q[6],q[10]; +rz(-0.0491) q[6]; +cx q[6],q[11]; +rz(0.0491) q[6]; +cx q[6],q[11]; +rz(-0.02455) q[6]; +cx q[6],q[12]; +rz(0.02455) q[6]; +cx q[6],q[12]; +rz(-0.01225) q[6]; +cx q[6],q[13]; +rz(0.01225) q[6]; +cx q[6],q[13]; +rz(-0.00615) q[6]; +cx q[6],q[14]; +rz(0.00615) q[6]; +cx q[6],q[14]; +rz(-0.00305) q[6]; +cx q[6],q[15]; +rz(0.00305) q[6]; +cx q[6],q[15]; +h q[7]; +rz(-0.7854) q[7]; +cx q[7],q[8]; +rz(0.7854) q[7]; +cx q[7],q[8]; +rz(-0.3927) q[7]; +cx q[7],q[9]; +rz(0.3927) q[7]; +cx q[7],q[9]; +rz(-0.19635) q[7]; +cx q[7],q[10]; +rz(0.19635) q[7]; +cx q[7],q[10]; +rz(-0.09815) q[7]; +cx q[7],q[11]; +rz(0.09815) q[7]; +cx q[7],q[11]; +rz(-0.0491) q[7]; +cx q[7],q[12]; +rz(0.0491) q[7]; +cx q[7],q[12]; +rz(-0.02455) q[7]; +cx q[7],q[13]; +rz(0.02455) q[7]; +cx q[7],q[13]; +rz(-0.01225) q[7]; +cx q[7],q[14]; +rz(0.01225) q[7]; +cx q[7],q[14]; +rz(-0.00615) q[7]; +cx q[7],q[15]; +rz(0.00615) q[7]; +cx q[7],q[15]; +h q[8]; +rz(-0.7854) q[8]; +cx q[8],q[9]; +rz(0.7854) q[8]; +cx q[8],q[9]; +rz(-0.3927) q[8]; +cx q[8],q[10]; +rz(0.3927) q[8]; +cx q[8],q[10]; +rz(-0.19635) q[8]; +cx q[8],q[11]; +rz(0.19635) q[8]; +cx q[8],q[11]; +rz(-0.09815) q[8]; +cx q[8],q[12]; +rz(0.09815) q[8]; +cx q[8],q[12]; +rz(-0.0491) q[8]; +cx q[8],q[13]; +rz(0.0491) q[8]; +cx q[8],q[13]; +rz(-0.02455) q[8]; +cx q[8],q[14]; +rz(0.02455) q[8]; +cx q[8],q[14]; +rz(-0.01225) q[8]; +cx q[8],q[15]; +rz(0.01225) q[8]; +cx q[8],q[15]; +h q[9]; +rz(-0.7854) q[9]; +cx q[9],q[10]; +rz(0.7854) q[9]; +cx q[9],q[10]; +rz(-0.3927) q[9]; +cx q[9],q[11]; +rz(0.3927) q[9]; +cx q[9],q[11]; +rz(-0.19635) q[9]; +cx q[9],q[12]; +rz(0.19635) q[9]; +cx q[9],q[12]; +rz(-0.09815) q[9]; +cx q[9],q[13]; +rz(0.09815) q[9]; +cx q[9],q[13]; +rz(-0.0491) q[9]; +cx q[9],q[14]; +rz(0.0491) q[9]; +cx q[9],q[14]; +rz(-0.02455) q[9]; +cx q[9],q[15]; +rz(0.02455) q[9]; +cx q[9],q[15]; +h q[10]; +rz(-0.7854) q[10]; +cx q[10],q[11]; +rz(0.7854) q[10]; +cx q[10],q[11]; +rz(-0.3927) q[10]; +cx q[10],q[12]; +rz(0.3927) q[10]; +cx q[10],q[12]; +rz(-0.19635) q[10]; +cx q[10],q[13]; +rz(0.19635) q[10]; +cx q[10],q[13]; +rz(-0.09815) q[10]; +cx q[10],q[14]; +rz(0.09815) q[10]; +cx q[10],q[14]; +rz(-0.0491) q[10]; +cx q[10],q[15]; +rz(0.0491) q[10]; +cx q[10],q[15]; +h q[11]; +rz(-0.7854) q[11]; +cx q[11],q[12]; +rz(0.7854) q[11]; +cx q[11],q[12]; +rz(-0.3927) q[11]; +cx q[11],q[13]; +rz(0.3927) q[11]; +cx q[11],q[13]; +rz(-0.19635) q[11]; +cx q[11],q[14]; +rz(0.19635) q[11]; +cx q[11],q[14]; +rz(-0.09815) q[11]; +cx q[11],q[15]; +rz(0.09815) q[11]; +cx q[11],q[15]; +h q[12]; +rz(-0.7854) q[12]; +cx q[12],q[13]; +rz(0.7854) q[12]; +cx q[12],q[13]; +rz(-0.3927) q[12]; +cx q[12],q[14]; +rz(0.3927) q[12]; +cx q[12],q[14]; +rz(-0.19635) q[12]; +cx q[12],q[15]; +rz(0.19635) q[12]; +cx q[12],q[15]; +h q[13]; +rz(-0.7854) q[13]; +cx q[13],q[14]; +rz(0.7854) q[13]; +cx q[13],q[14]; +rz(-0.3927) q[13]; +cx q[13],q[15]; +rz(0.3927) q[13]; +cx q[13],q[15]; +h q[14]; +rz(-0.7854) q[14]; +cx q[14],q[15]; +rz(0.7854) q[14]; +cx q[14],q[15]; +h q[15]; +h q[0]; +h q[1]; +h q[2]; +h q[3]; +h q[4]; +h q[5]; +h q[6]; +h q[7]; +h q[8]; +h q[9]; +h q[10]; +h q[11]; +h q[12]; +h q[13]; +h q[14]; +h q[15]; diff --git a/test/benchmarks/transpiler_qualitative.py b/test/benchmarks/transpiler_qualitative.py new file mode 100644 index 000000000000..c59f250eea09 --- /dev/null +++ b/test/benchmarks/transpiler_qualitative.py @@ -0,0 +1,98 @@ +# -*- coding: utf-8 -*- + +# This code is part of Qiskit. +# +# (C) Copyright IBM 2020. +# +# This code is licensed under the Apache License, Version 2.0. You may +# obtain a copy of this license in the LICENSE.txt file in the root directory +# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. +# +# Any modifications or derivative works of this code must retain this +# copyright notice, and modified files need to carry a notice indicating +# that they have been altered from the originals. + +# pylint: disable=no-member,invalid-name,missing-docstring,no-name-in-module +# pylint: disable=attribute-defined-outside-init,unsubscriptable-object + +import os + +from qiskit import QuantumCircuit +from qiskit.compiler import transpile +from qiskit.test.mock import FakeToronto + + +class TranspilerQualitativeBench: + params = ([0, 1, 2, 3], + ["stochastic", "sabre"], + ["dense", "noise_adaptive", "sabre"]) + param_names = ["optimization level", "routing method", "layout method"] + timeout = 600 + + # pylint: disable=unused-argument + def setup(self, optimization_level, routing_method, layout_method): + self.backend = FakeToronto() + self.qasm_path = os.path.abspath( + os.path.join(os.path.dirname(__file__), "qasm")) + + self.depth_4gt10_v1_81 = QuantumCircuit.from_qasm_file( + os.path.join(self.qasm_path, "depth_4gt10-v1_81.qasm")) + self.depth_4mod5_v0_19 = QuantumCircuit.from_qasm_file( + os.path.join(self.qasm_path, "depth_4mod5-v0_19.qasm")) + self.depth_mod8_10_178 = QuantumCircuit.from_qasm_file( + os.path.join(self.qasm_path, "depth_mod8-10_178.qasm")) + + self.time_cnt3_5_179 = QuantumCircuit.from_qasm_file( + os.path.join(self.qasm_path, "time_cnt3-5_179.qasm")) + self.time_cnt3_5_180 = QuantumCircuit.from_qasm_file( + os.path.join(self.qasm_path, "time_cnt3-5_180.qasm")) + self.time_qft_16 = QuantumCircuit.from_qasm_file( + os.path.join(self.qasm_path, "time_qft_16.qasm")) + + def track_depth_transpile_4gt10_v1_81(self, optimization_level, + routing_method, layout_method): + return transpile(self.depth_4gt10_v1_81, self.backend, + routing_method=routing_method, + layout_method=layout_method, + optimization_level=optimization_level, + seed_transpiler=0).depth() + + def track_depth_transpile_4mod5_v0_19(self, optimization_level, + routing_method, layout_method): + return transpile(self.depth_4mod5_v0_19, self.backend, + routing_method=routing_method, + layout_method=layout_method, + optimization_level=optimization_level, + seed_transpiler=0).depth() + + def track_depth_transpile_mod8_10_178(self, optimization_level, + routing_method, layout_method): + return transpile(self.depth_mod8_10_178, self.backend, + routing_method=routing_method, + layout_method=layout_method, + optimization_level=optimization_level, + seed_transpiler=0).depth() + + def time_transpile_time_cnt3_5_179(self, optimization_level, + routing_method, layout_method): + transpile(self.time_cnt3_5_179, self.backend, + routing_method=routing_method, + layout_method=layout_method, + optimization_level=optimization_level, + seed_transpiler=0) + + def time_transpile_time_cnt3_5_180(self, optimization_level, + routing_method, layout_method): + transpile(self.time_cnt3_5_180, self.backend, + routing_method=routing_method, + layout_method=layout_method, + optimization_level=optimization_level, + seed_transpiler=0) + + def time_transpile_time_qft_16(self, optimization_level, + routing_method, layout_method): + transpile(self.time_qft_16, self.backend, + routing_method=routing_method, + layout_method=layout_method, + optimization_level=optimization_level, + seed_transpiler=0) From e7ebc48661fa479a79d43f22ab13f41f5e535b5f Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Mon, 7 Dec 2020 11:23:20 -0500 Subject: [PATCH 37/61] Fix random_circuit_hex benchmarks (Qiskit/qiskit-metapackage#1129) In Qiskit/qiskit-terra#5439 a bunch of deprecated quantum_info module methods were removed from terra. This included one that the random_circuit_hex benchmark module was relying on which has been causing benchmark failure since Qiskit/qiskit-terra#5439 merged. This commit updates the benchmarks to use the new methods to fix the benchmarks. --- test/benchmarks/random_circuit_hex.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/test/benchmarks/random_circuit_hex.py b/test/benchmarks/random_circuit_hex.py index e063a66af6bd..063ac6844e40 100644 --- a/test/benchmarks/random_circuit_hex.py +++ b/test/benchmarks/random_circuit_hex.py @@ -17,13 +17,7 @@ import copy -try: - from qiskit.quantum_info.synthesis import euler_angles_1q -except ImportError: - try: - from qiskit.mapper.compiling import euler_angles_1q - except ImportError: - from qiskit.mapper._compiling import euler_angles_1q +from qiskit.quantum_info.synthesis import OneQubitEulerDecomposer from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister from qiskit import BasicAer try: @@ -50,6 +44,7 @@ def make_circuit_ring(nq, depth, seed): # Create a Quantum Circuit qc = QuantumCircuit(q, c) offset = 1 + decomposer = OneQubitEulerDecomposer() # initial round of random single-qubit unitaries for i in range(nq): qc.h(q[i]) @@ -63,7 +58,7 @@ def make_circuit_ring(nq, depth, seed): else: u = random_unitary_matrix(2) - angles = euler_angles_1q(u) + angles = decomposer.angles(u) qc.u3(angles[0], angles[1], angles[2], q[i]) # insert the final measurements From 881ae2e3ddcf410d1714c91d5c3d02bdcdcf4662 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Fri, 29 Jan 2021 15:49:29 -0500 Subject: [PATCH 38/61] Fix the Pulse schedule construction benchmarks (Qiskit/qiskit-metapackage#1147) The Pulse schedule construction benchmarks were using the previously deprecated and now removed SamplePulse class as the pulse to add to a schedule. This has been failing in benchmark runs since that class was removed. This commit fixes the failure by using the replacement class Waveform. This will break compatibility with old versions of terra from before waveform existed, however since we're unlikely to run a backfill job for historical data this is an ok tradeoff. --- test/benchmarks/pulse/schedule_construction.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/benchmarks/pulse/schedule_construction.py b/test/benchmarks/pulse/schedule_construction.py index 584cb975ea6d..0c0612cd30e8 100644 --- a/test/benchmarks/pulse/schedule_construction.py +++ b/test/benchmarks/pulse/schedule_construction.py @@ -16,7 +16,8 @@ # pylint: disable=attribute-defined-outside-init import numpy as np -from qiskit.pulse import Schedule, Gaussian, DriveChannel, SamplePulse, Play + +from qiskit.pulse import Schedule, Gaussian, DriveChannel, Play, Waveform def build_sample_pulse_schedule(number_of_unique_pulses, number_of_channels): @@ -24,7 +25,7 @@ def build_sample_pulse_schedule(number_of_unique_pulses, number_of_channels): sched = Schedule() for _ in range(number_of_unique_pulses): for channel in range(number_of_channels): - sched.append(Play(SamplePulse(rng.random(50)), + sched.append(Play(Waveform(rng.random(50)), DriveChannel(channel))) return sched From 4f83fb52c217c9db7d992b801cd0d599b74a12f7 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Thu, 4 Feb 2021 17:17:07 -0500 Subject: [PATCH 39/61] Add QUEKO benchmarks (Qiskit/qiskit-metapackage#1154) * Add QUEKO benchmarks This commit adds a subset of the QUEKO benchmarks [1] to the benchmark suite it runs a sweep of different transpiler levels and options on 3 sample circuits (one of each category) and measures the output depth or the execution time of the transpile. [1] https://github.com/UCLA-VAST/QUEKO-benchmark * Fix lint * Include optimal depth in track benchmark names * Update class name --- .../qasm/20QBT_45CYC_.0D1_.1D2_3.qasm | 51 + test/benchmarks/qasm/53QBT_100CYC_QSE_3.qasm | 3770 +++++++++++++++++ test/benchmarks/qasm/54QBT_25CYC_QSE_3.qasm | 966 +++++ test/benchmarks/queko.py | 235 + 4 files changed, 5022 insertions(+) create mode 100644 test/benchmarks/qasm/20QBT_45CYC_.0D1_.1D2_3.qasm create mode 100644 test/benchmarks/qasm/53QBT_100CYC_QSE_3.qasm create mode 100644 test/benchmarks/qasm/54QBT_25CYC_QSE_3.qasm create mode 100644 test/benchmarks/queko.py diff --git a/test/benchmarks/qasm/20QBT_45CYC_.0D1_.1D2_3.qasm b/test/benchmarks/qasm/20QBT_45CYC_.0D1_.1D2_3.qasm new file mode 100644 index 000000000000..cdd0efb1afbc --- /dev/null +++ b/test/benchmarks/qasm/20QBT_45CYC_.0D1_.1D2_3.qasm @@ -0,0 +1,51 @@ +// Originally source from the QUEKO benchmark suite +// https://github.com/UCLA-VAST/QUEKO-benchmark +// A benchmark of the impact of gate density for IBMQ Tokyo with a depth of 45 +OPENQASM 2.0; +include "qelib1.inc"; +qreg q[20]; +cx q[12], q[9]; +cx q[6], q[12]; +cx q[8], q[6]; +cx q[6], q[10]; +cx q[7], q[6]; +cx q[6], q[10]; +cx q[6], q[10]; +cx q[6], q[10]; +cx q[11], q[6]; +cx q[11], q[6]; +cx q[11], q[6]; +cx q[8], q[11]; +cx q[8], q[7]; +cx q[7], q[6]; +cx q[15], q[7]; +cx q[7], q[13]; +cx q[13], q[9]; +cx q[12], q[9]; +cx q[12], q[10]; +cx q[12], q[10]; +cx q[12], q[10]; +cx q[6], q[10]; +cx q[6], q[10]; +cx q[9], q[10]; +cx q[6], q[10]; +cx q[6], q[9]; +cx q[6], q[9]; +cx q[6], q[12]; +cx q[6], q[12]; +cx q[12], q[9]; +cx q[12], q[9]; +cx q[9], q[10]; +cx q[6], q[10]; +cx q[11], q[6]; +cx q[11], q[6]; +cx q[6], q[9]; +cx q[6], q[10]; +cx q[9], q[10]; +cx q[9], q[10]; +cx q[12], q[10]; +cx q[12], q[10]; +cx q[12], q[10]; +cx q[6], q[10]; +cx q[6], q[10]; +cx q[9], q[10]; diff --git a/test/benchmarks/qasm/53QBT_100CYC_QSE_3.qasm b/test/benchmarks/qasm/53QBT_100CYC_QSE_3.qasm new file mode 100644 index 000000000000..af33099e9cd6 --- /dev/null +++ b/test/benchmarks/qasm/53QBT_100CYC_QSE_3.qasm @@ -0,0 +1,3770 @@ +// Originally source from the QUEKO benchmark suite +// https://github.com/UCLA-VAST/QUEKO-benchmark +// A benchmark of scalability for IBMQ rochester with a depth of 100 +OPENQASM 2.0; +include "qelib1.inc"; +qreg q[53]; +x q[41]; +x q[32]; +x q[20]; +x q[19]; +x q[29]; +x q[27]; +x q[50]; +x q[23]; +x q[18]; +x q[30]; +x q[39]; +x q[22]; +x q[2]; +x q[38]; +x q[48]; +x q[25]; +x q[34]; +x q[5]; +x q[15]; +x q[3]; +x q[40]; +x q[17]; +x q[45]; +x q[35]; +x q[47]; +x q[28]; +x q[36]; +x q[11]; +x q[33]; +x q[46]; +x q[13]; +cx q[42], q[16]; +cx q[7], q[8]; +cx q[31], q[52]; +cx q[49], q[10]; +cx q[21], q[0]; +cx q[43], q[44]; +cx q[6], q[14]; +cx q[9], q[24]; +x q[41]; +x q[0]; +x q[46]; +x q[35]; +x q[28]; +x q[27]; +x q[49]; +x q[5]; +x q[15]; +x q[22]; +x q[10]; +x q[40]; +x q[48]; +x q[3]; +x q[39]; +x q[8]; +x q[52]; +x q[45]; +x q[44]; +x q[34]; +x q[38]; +x q[42]; +x q[16]; +x q[24]; +x q[51]; +x q[32]; +cx q[20], q[17]; +cx q[43], q[29]; +cx q[14], q[9]; +cx q[1], q[21]; +cx q[47], q[6]; +cx q[19], q[13]; +cx q[37], q[2]; +cx q[23], q[31]; +cx q[4], q[7]; +cx q[11], q[50]; +cx q[33], q[25]; +cx q[18], q[12]; +x q[1]; +x q[42]; +x q[29]; +x q[6]; +x q[49]; +x q[11]; +x q[12]; +x q[20]; +x q[52]; +x q[26]; +x q[46]; +x q[28]; +x q[2]; +x q[40]; +x q[35]; +x q[27]; +x q[21]; +x q[14]; +x q[19]; +x q[22]; +x q[17]; +x q[13]; +x q[32]; +x q[15]; +x q[0]; +x q[4]; +cx q[34], q[41]; +cx q[45], q[30]; +cx q[43], q[44]; +cx q[9], q[24]; +cx q[33], q[25]; +cx q[7], q[8]; +cx q[5], q[37]; +cx q[38], q[36]; +cx q[50], q[16]; +cx q[10], q[48]; +cx q[51], q[47]; +cx q[23], q[31]; +x q[41]; +x q[22]; +x q[17]; +x q[42]; +x q[9]; +x q[47]; +x q[18]; +x q[29]; +x q[20]; +x q[19]; +x q[51]; +x q[46]; +x q[16]; +x q[44]; +x q[28]; +x q[15]; +x q[35]; +x q[4]; +x q[26]; +x q[34]; +x q[52]; +x q[13]; +x q[30]; +x q[32]; +x q[40]; +x q[6]; +x q[21]; +x q[27]; +cx q[7], q[8]; +cx q[23], q[31]; +cx q[14], q[0]; +cx q[5], q[37]; +cx q[33], q[25]; +cx q[39], q[2]; +cx q[11], q[50]; +cx q[24], q[3]; +cx q[49], q[10]; +cx q[36], q[43]; +cx q[12], q[38]; +x q[41]; +x q[13]; +x q[36]; +x q[48]; +x q[4]; +x q[49]; +x q[24]; +x q[17]; +x q[3]; +x q[22]; +x q[40]; +x q[0]; +x q[34]; +x q[50]; +x q[19]; +x q[7]; +x q[45]; +x q[52]; +x q[44]; +x q[33]; +x q[32]; +x q[5]; +x q[35]; +x q[25]; +cx q[39], q[26]; +cx q[1], q[21]; +cx q[23], q[31]; +cx q[42], q[16]; +cx q[14], q[9]; +cx q[43], q[29]; +cx q[51], q[47]; +cx q[37], q[2]; +cx q[30], q[18]; +cx q[15], q[46]; +cx q[10], q[11]; +cx q[12], q[38]; +x q[41]; +x q[25]; +x q[51]; +x q[38]; +x q[45]; +x q[33]; +x q[15]; +x q[24]; +x q[49]; +x q[21]; +x q[2]; +x q[29]; +x q[11]; +x q[46]; +x q[39]; +x q[27]; +x q[44]; +x q[40]; +x q[28]; +x q[30]; +x q[35]; +x q[16]; +x q[47]; +x q[13]; +x q[0]; +x q[34]; +x q[10]; +x q[26]; +x q[22]; +x q[6]; +x q[12]; +cx q[14], q[9]; +cx q[31], q[52]; +cx q[36], q[43]; +cx q[32], q[8]; +cx q[5], q[37]; +cx q[50], q[19]; +cx q[7], q[20]; +cx q[17], q[1]; +cx q[3], q[42]; +x q[41]; +x q[34]; +x q[38]; +x q[14]; +x q[18]; +x q[36]; +x q[27]; +x q[23]; +x q[5]; +x q[32]; +x q[10]; +x q[20]; +x q[11]; +x q[15]; +x q[35]; +x q[33]; +x q[48]; +x q[39]; +x q[52]; +x q[29]; +x q[4]; +x q[46]; +x q[6]; +x q[17]; +x q[19]; +x q[28]; +x q[49]; +x q[25]; +x q[40]; +cx q[31], q[22]; +cx q[21], q[0]; +cx q[50], q[16]; +cx q[51], q[47]; +cx q[9], q[24]; +cx q[7], q[8]; +cx q[3], q[42]; +cx q[45], q[30]; +cx q[37], q[2]; +cx q[43], q[44]; +x q[41]; +x q[13]; +x q[29]; +x q[0]; +x q[28]; +x q[24]; +x q[2]; +x q[35]; +x q[40]; +x q[15]; +x q[11]; +x q[17]; +x q[46]; +x q[32]; +x q[34]; +x q[5]; +x q[20]; +x q[9]; +x q[37]; +x q[23]; +x q[30]; +x q[27]; +x q[45]; +cx q[51], q[47]; +cx q[12], q[38]; +cx q[33], q[25]; +cx q[36], q[43]; +cx q[31], q[22]; +cx q[50], q[16]; +cx q[3], q[42]; +cx q[10], q[48]; +cx q[7], q[8]; +cx q[6], q[14]; +cx q[21], q[49]; +cx q[39], q[26]; +x q[33]; +x q[5]; +x q[6]; +x q[44]; +x q[36]; +x q[11]; +x q[8]; +x q[39]; +x q[32]; +x q[47]; +x q[4]; +x q[31]; +x q[51]; +x q[3]; +x q[23]; +x q[35]; +x q[40]; +x q[38]; +x q[15]; +x q[34]; +x q[18]; +x q[26]; +x q[46]; +x q[43]; +x q[49]; +x q[48]; +x q[10]; +x q[27]; +x q[2]; +x q[12]; +x q[22]; +x q[25]; +cx q[41], q[52]; +cx q[14], q[0]; +cx q[1], q[21]; +cx q[42], q[16]; +cx q[20], q[17]; +cx q[19], q[13]; +cx q[45], q[30]; +x q[41]; +x q[23]; +x q[50]; +x q[3]; +x q[11]; +x q[26]; +x q[16]; +x q[40]; +x q[45]; +x q[47]; +x q[34]; +x q[22]; +x q[49]; +x q[36]; +x q[44]; +x q[27]; +x q[5]; +x q[9]; +x q[30]; +x q[6]; +x q[37]; +x q[38]; +cx q[14], q[0]; +cx q[35], q[48]; +cx q[4], q[7]; +cx q[20], q[17]; +cx q[32], q[8]; +cx q[31], q[52]; +cx q[39], q[2]; +cx q[19], q[13]; +cx q[24], q[46]; +cx q[1], q[21]; +cx q[29], q[33]; +cx q[18], q[12]; +cx q[15], q[28]; +x q[41]; +x q[27]; +x q[34]; +x q[48]; +x q[52]; +x q[31]; +x q[12]; +x q[11]; +x q[30]; +x q[44]; +x q[7]; +x q[47]; +x q[8]; +x q[18]; +x q[24]; +x q[15]; +x q[25]; +x q[46]; +x q[28]; +x q[4]; +x q[6]; +x q[23]; +x q[35]; +x q[21]; +x q[1]; +x q[45]; +cx q[36], q[43]; +cx q[14], q[0]; +cx q[29], q[33]; +cx q[39], q[2]; +cx q[32], q[51]; +cx q[5], q[37]; +cx q[19], q[13]; +cx q[3], q[42]; +cx q[20], q[17]; +x q[15]; +x q[27]; +x q[1]; +x q[45]; +x q[2]; +x q[20]; +x q[35]; +x q[28]; +x q[48]; +x q[32]; +x q[34]; +x q[37]; +x q[26]; +x q[51]; +x q[43]; +x q[23]; +x q[0]; +x q[5]; +x q[50]; +x q[3]; +x q[40]; +x q[11]; +x q[25]; +x q[12]; +x q[10]; +cx q[41], q[52]; +cx q[31], q[22]; +cx q[24], q[46]; +cx q[21], q[49]; +cx q[30], q[18]; +cx q[19], q[13]; +cx q[47], q[6]; +cx q[7], q[8]; +cx q[14], q[9]; +cx q[29], q[33]; +cx q[42], q[16]; +cx q[38], q[36]; +x q[52]; +x q[6]; +x q[11]; +x q[3]; +x q[8]; +x q[30]; +x q[7]; +x q[0]; +x q[14]; +x q[18]; +x q[22]; +x q[24]; +x q[20]; +x q[17]; +x q[1]; +x q[41]; +x q[29]; +x q[4]; +x q[36]; +x q[28]; +x q[2]; +x q[13]; +x q[34]; +x q[10]; +x q[27]; +x q[43]; +x q[40]; +x q[9]; +x q[45]; +x q[15]; +x q[32]; +cx q[50], q[16]; +cx q[21], q[49]; +cx q[39], q[26]; +cx q[23], q[31]; +cx q[35], q[48]; +cx q[33], q[25]; +cx q[12], q[38]; +cx q[51], q[47]; +cx q[5], q[37]; +x q[52]; +x q[19]; +x q[5]; +x q[37]; +x q[42]; +x q[1]; +x q[22]; +x q[23]; +x q[27]; +x q[46]; +x q[8]; +x q[50]; +x q[9]; +x q[13]; +x q[25]; +x q[48]; +x q[29]; +x q[18]; +x q[33]; +x q[43]; +x q[35]; +x q[47]; +x q[31]; +x q[16]; +x q[30]; +x q[15]; +x q[11]; +cx q[21], q[0]; +cx q[17], q[44]; +cx q[6], q[14]; +cx q[28], q[40]; +cx q[45], q[4]; +cx q[32], q[51]; +cx q[34], q[41]; +cx q[39], q[2]; +cx q[24], q[3]; +cx q[7], q[20]; +cx q[38], q[36]; +cx q[49], q[10]; +x q[52]; +x q[16]; +x q[37]; +x q[4]; +x q[1]; +x q[40]; +x q[23]; +x q[6]; +x q[43]; +x q[8]; +x q[26]; +x q[32]; +x q[27]; +x q[34]; +x q[48]; +x q[38]; +x q[45]; +x q[30]; +x q[15]; +x q[17]; +x q[13]; +x q[50]; +x q[36]; +cx q[14], q[9]; +cx q[7], q[20]; +cx q[18], q[12]; +cx q[29], q[33]; +cx q[49], q[10]; +cx q[51], q[47]; +cx q[24], q[46]; +cx q[31], q[22]; +cx q[39], q[2]; +cx q[21], q[0]; +cx q[25], q[35]; +cx q[3], q[42]; +x q[52]; +x q[25]; +x q[6]; +x q[34]; +x q[5]; +x q[10]; +x q[30]; +x q[51]; +x q[44]; +x q[47]; +x q[28]; +x q[0]; +x q[2]; +x q[19]; +x q[37]; +x q[13]; +x q[41]; +x q[48]; +x q[29]; +x q[36]; +x q[24]; +x q[11]; +x q[33]; +x q[40]; +x q[45]; +x q[35]; +x q[27]; +cx q[14], q[9]; +cx q[21], q[49]; +cx q[32], q[8]; +cx q[3], q[42]; +cx q[18], q[12]; +cx q[31], q[22]; +cx q[39], q[26]; +cx q[17], q[1]; +cx q[15], q[46]; +cx q[4], q[7]; +x q[52]; +x q[41]; +x q[16]; +x q[18]; +x q[5]; +x q[12]; +x q[0]; +x q[8]; +x q[15]; +x q[51]; +x q[13]; +x q[46]; +x q[3]; +x q[47]; +x q[27]; +x q[9]; +x q[43]; +x q[19]; +x q[1]; +x q[48]; +x q[38]; +cx q[42], q[34]; +cx q[31], q[22]; +cx q[17], q[44]; +cx q[40], q[23]; +cx q[7], q[20]; +cx q[49], q[10]; +cx q[6], q[14]; +cx q[37], q[2]; +cx q[45], q[4]; +cx q[29], q[33]; +cx q[11], q[50]; +x q[52]; +x q[33]; +x q[10]; +x q[37]; +x q[45]; +x q[48]; +x q[22]; +x q[46]; +x q[26]; +x q[3]; +x q[27]; +x q[49]; +x q[16]; +x q[30]; +x q[2]; +x q[42]; +x q[34]; +x q[15]; +x q[21]; +x q[1]; +x q[39]; +x q[28]; +x q[8]; +x q[20]; +x q[0]; +cx q[38], q[36]; +cx q[51], q[47]; +cx q[18], q[12]; +cx q[25], q[35]; +cx q[6], q[14]; +cx q[4], q[7]; +cx q[43], q[29]; +cx q[13], q[5]; +cx q[9], q[24]; +cx q[23], q[31]; +cx q[11], q[50]; +cx q[17], q[44]; +x q[52]; +x q[3]; +x q[12]; +x q[39]; +x q[38]; +x q[4]; +x q[45]; +x q[35]; +x q[18]; +x q[13]; +x q[36]; +x q[25]; +x q[19]; +x q[28]; +x q[49]; +x q[46]; +x q[50]; +x q[22]; +x q[29]; +x q[40]; +x q[34]; +x q[15]; +x q[5]; +x q[11]; +cx q[43], q[44]; +cx q[42], q[16]; +cx q[23], q[31]; +cx q[7], q[8]; +cx q[37], q[2]; +cx q[47], q[6]; +cx q[14], q[0]; +cx q[9], q[24]; +cx q[32], q[51]; +cx q[10], q[48]; +cx q[20], q[17]; +cx q[41], q[27]; +cx q[1], q[21]; +x q[52]; +x q[4]; +x q[25]; +x q[51]; +x q[29]; +x q[11]; +x q[24]; +x q[3]; +x q[44]; +x q[40]; +x q[8]; +x q[28]; +x q[9]; +x q[45]; +x q[32]; +x q[37]; +x q[48]; +x q[7]; +x q[26]; +x q[2]; +cx q[13], q[5]; +cx q[31], q[22]; +cx q[14], q[0]; +cx q[27], q[39]; +cx q[15], q[46]; +cx q[20], q[17]; +cx q[36], q[43]; +cx q[1], q[21]; +cx q[30], q[18]; +cx q[50], q[19]; +cx q[47], q[6]; +cx q[12], q[38]; +cx q[42], q[16]; +cx q[34], q[41]; +x q[2]; +x q[33]; +x q[18]; +x q[27]; +x q[0]; +x q[29]; +x q[32]; +x q[51]; +x q[20]; +x q[15]; +x q[28]; +x q[47]; +x q[6]; +x q[12]; +x q[25]; +x q[4]; +x q[34]; +x q[22]; +x q[11]; +x q[16]; +x q[37]; +x q[21]; +x q[8]; +cx q[31], q[52]; +cx q[39], q[26]; +cx q[17], q[1]; +cx q[3], q[42]; +cx q[24], q[46]; +cx q[38], q[36]; +cx q[49], q[10]; +cx q[13], q[5]; +cx q[14], q[9]; +cx q[35], q[48]; +cx q[45], q[30]; +cx q[43], q[44]; +x q[31]; +x q[28]; +x q[23]; +x q[22]; +x q[1]; +x q[8]; +x q[16]; +x q[36]; +x q[21]; +x q[9]; +x q[52]; +x q[46]; +x q[41]; +x q[10]; +x q[37]; +x q[49]; +x q[15]; +x q[43]; +x q[32]; +x q[39]; +x q[29]; +x q[33]; +x q[6]; +x q[2]; +x q[5]; +cx q[42], q[34]; +cx q[35], q[48]; +cx q[20], q[17]; +cx q[14], q[0]; +cx q[18], q[12]; +cx q[24], q[3]; +cx q[19], q[13]; +cx q[4], q[7]; +cx q[45], q[30]; +cx q[11], q[50]; +x q[31]; +x q[28]; +x q[0]; +x q[44]; +x q[7]; +x q[1]; +x q[49]; +x q[4]; +x q[8]; +x q[20]; +x q[43]; +x q[21]; +x q[2]; +x q[27]; +x q[36]; +x q[3]; +x q[34]; +x q[19]; +x q[17]; +x q[16]; +x q[42]; +x q[18]; +x q[30]; +x q[11]; +x q[39]; +x q[22]; +x q[35]; +x q[13]; +x q[29]; +x q[50]; +x q[38]; +x q[45]; +x q[37]; +x q[25]; +cx q[41], q[52]; +cx q[15], q[46]; +cx q[10], q[48]; +cx q[9], q[24]; +cx q[40], q[23]; +cx q[51], q[47]; +x q[31]; +x q[35]; +x q[48]; +x q[14]; +x q[18]; +x q[49]; +x q[27]; +x q[0]; +x q[8]; +x q[39]; +x q[16]; +x q[22]; +x q[19]; +x q[37]; +x q[25]; +x q[41]; +x q[50]; +x q[26]; +x q[21]; +x q[38]; +x q[33]; +x q[6]; +x q[52]; +x q[9]; +x q[36]; +x q[4]; +x q[32]; +x q[12]; +x q[46]; +cx q[43], q[29]; +cx q[51], q[47]; +cx q[13], q[5]; +cx q[7], q[20]; +cx q[42], q[34]; +cx q[40], q[23]; +cx q[10], q[11]; +cx q[15], q[28]; +cx q[24], q[3]; +cx q[45], q[30]; +cx q[17], q[1]; +x q[31]; +x q[17]; +x q[23]; +x q[20]; +x q[32]; +x q[11]; +x q[8]; +x q[12]; +x q[26]; +x q[52]; +x q[38]; +x q[36]; +x q[13]; +x q[5]; +x q[15]; +x q[19]; +x q[22]; +x q[50]; +x q[28]; +x q[40]; +x q[45]; +x q[3]; +x q[29]; +x q[1]; +x q[43]; +x q[33]; +x q[0]; +x q[27]; +x q[37]; +x q[46]; +cx q[39], q[2]; +cx q[4], q[7]; +cx q[9], q[24]; +cx q[6], q[14]; +cx q[10], q[48]; +cx q[34], q[41]; +cx q[30], q[18]; +cx q[42], q[16]; +cx q[21], q[49]; +cx q[51], q[47]; +x q[33]; +x q[22]; +x q[11]; +x q[51]; +x q[42]; +x q[26]; +x q[1]; +x q[32]; +x q[48]; +x q[13]; +x q[47]; +x q[12]; +x q[29]; +x q[30]; +x q[4]; +x q[16]; +x q[18]; +x q[2]; +x q[6]; +x q[49]; +x q[25]; +x q[10]; +x q[41]; +x q[8]; +x q[34]; +x q[35]; +x q[9]; +x q[21]; +x q[44]; +cx q[23], q[31]; +cx q[27], q[39]; +cx q[20], q[17]; +cx q[36], q[43]; +cx q[24], q[3]; +cx q[5], q[37]; +cx q[50], q[19]; +cx q[14], q[0]; +cx q[15], q[28]; +x q[23]; +x q[1]; +x q[7]; +x q[41]; +x q[20]; +x q[49]; +x q[21]; +x q[50]; +x q[33]; +x q[12]; +x q[36]; +x q[34]; +x q[11]; +x q[45]; +x q[10]; +x q[27]; +x q[29]; +x q[26]; +x q[4]; +x q[44]; +x q[39]; +x q[18]; +x q[8]; +x q[37]; +x q[19]; +x q[2]; +x q[38]; +x q[46]; +x q[24]; +x q[40]; +x q[43]; +x q[9]; +x q[17]; +cx q[25], q[35]; +cx q[31], q[22]; +cx q[13], q[5]; +cx q[42], q[16]; +cx q[14], q[0]; +cx q[32], q[51]; +cx q[47], q[6]; +cx q[15], q[28]; +x q[46]; +x q[1]; +x q[2]; +x q[0]; +x q[24]; +x q[35]; +x q[38]; +x q[37]; +x q[30]; +x q[39]; +x q[9]; +x q[3]; +x q[16]; +x q[18]; +x q[36]; +x q[29]; +x q[4]; +x q[17]; +x q[31]; +x q[49]; +x q[27]; +x q[42]; +x q[22]; +x q[45]; +x q[47]; +cx q[40], q[23]; +cx q[33], q[25]; +cx q[34], q[41]; +cx q[15], q[28]; +cx q[32], q[8]; +cx q[10], q[48]; +cx q[11], q[50]; +cx q[6], q[14]; +cx q[43], q[44]; +cx q[7], q[20]; +x q[23]; +x q[16]; +x q[14]; +x q[24]; +x q[47]; +x q[30]; +x q[28]; +x q[9]; +x q[18]; +x q[40]; +x q[49]; +x q[45]; +x q[5]; +x q[36]; +x q[4]; +x q[6]; +x q[12]; +x q[0]; +x q[3]; +x q[38]; +x q[27]; +x q[26]; +x q[21]; +x q[8]; +cx q[43], q[44]; +cx q[11], q[50]; +cx q[17], q[1]; +cx q[41], q[52]; +cx q[31], q[22]; +cx q[15], q[46]; +cx q[7], q[20]; +cx q[25], q[35]; +cx q[10], q[48]; +cx q[32], q[51]; +cx q[29], q[33]; +cx q[39], q[2]; +cx q[42], q[34]; +x q[23]; +x q[22]; +x q[25]; +x q[1]; +x q[35]; +x q[6]; +x q[2]; +x q[3]; +x q[17]; +x q[49]; +x q[29]; +x q[10]; +x q[46]; +x q[8]; +x q[43]; +x q[40]; +x q[14]; +x q[33]; +x q[4]; +x q[37]; +x q[26]; +x q[51]; +x q[28]; +x q[39]; +x q[12]; +x q[13]; +x q[45]; +x q[32]; +x q[48]; +x q[11]; +x q[47]; +x q[31]; +cx q[50], q[19]; +cx q[41], q[52]; +cx q[9], q[24]; +cx q[30], q[18]; +cx q[38], q[36]; +cx q[21], q[0]; +cx q[7], q[20]; +cx q[42], q[34]; +x q[33]; +x q[16]; +x q[19]; +x q[12]; +x q[28]; +x q[0]; +x q[37]; +x q[52]; +x q[17]; +x q[25]; +x q[49]; +x q[39]; +x q[36]; +x q[38]; +x q[41]; +x q[18]; +x q[9]; +x q[26]; +x q[27]; +x q[13]; +x q[35]; +x q[15]; +x q[30]; +cx q[40], q[23]; +cx q[11], q[50]; +cx q[43], q[44]; +cx q[32], q[8]; +cx q[7], q[20]; +cx q[1], q[21]; +cx q[42], q[34]; +cx q[6], q[14]; +cx q[31], q[22]; +cx q[24], q[46]; +cx q[45], q[4]; +cx q[51], q[47]; +x q[23]; +x q[45]; +x q[21]; +x q[26]; +x q[43]; +x q[24]; +x q[49]; +x q[30]; +x q[51]; +x q[3]; +x q[46]; +x q[15]; +x q[47]; +x q[36]; +x q[34]; +x q[20]; +x q[9]; +cx q[31], q[22]; +cx q[42], q[16]; +cx q[4], q[7]; +cx q[28], q[40]; +cx q[17], q[1]; +cx q[27], q[39]; +cx q[32], q[8]; +cx q[37], q[2]; +cx q[10], q[11]; +cx q[18], q[12]; +cx q[33], q[25]; +cx q[35], q[48]; +cx q[41], q[52]; +cx q[13], q[5]; +cx q[50], q[19]; +cx q[14], q[0]; +x q[24]; +x q[49]; +x q[14]; +x q[3]; +x q[45]; +x q[51]; +x q[44]; +x q[13]; +x q[36]; +x q[47]; +x q[15]; +x q[4]; +x q[22]; +x q[2]; +x q[9]; +x q[12]; +x q[52]; +x q[38]; +x q[50]; +x q[5]; +x q[30]; +x q[40]; +x q[18]; +x q[37]; +x q[27]; +x q[1]; +x q[42]; +x q[46]; +x q[32]; +x q[28]; +x q[6]; +x q[16]; +cx q[23], q[31]; +cx q[10], q[11]; +cx q[35], q[48]; +cx q[21], q[0]; +cx q[7], q[8]; +cx q[33], q[25]; +cx q[43], q[29]; +cx q[39], q[26]; +cx q[34], q[41]; +cx q[20], q[17]; +x q[5]; +x q[45]; +x q[49]; +x q[11]; +x q[40]; +x q[17]; +x q[12]; +x q[8]; +x q[4]; +x q[22]; +x q[46]; +x q[3]; +x q[37]; +x q[0]; +x q[21]; +x q[35]; +x q[30]; +x q[44]; +x q[1]; +cx q[23], q[31]; +cx q[6], q[14]; +cx q[10], q[48]; +cx q[43], q[29]; +cx q[7], q[20]; +cx q[50], q[16]; +cx q[33], q[25]; +cx q[9], q[24]; +cx q[39], q[2]; +cx q[51], q[47]; +cx q[41], q[52]; +cx q[15], q[28]; +cx q[38], q[36]; +cx q[42], q[34]; +x q[31]; +x q[3]; +x q[6]; +x q[36]; +x q[45]; +x q[10]; +x q[44]; +x q[7]; +x q[26]; +x q[18]; +x q[25]; +x q[9]; +x q[38]; +x q[22]; +x q[32]; +x q[12]; +x q[14]; +x q[39]; +x q[23]; +x q[24]; +x q[47]; +x q[4]; +x q[20]; +x q[8]; +x q[43]; +cx q[21], q[0]; +cx q[41], q[52]; +cx q[37], q[2]; +cx q[29], q[33]; +cx q[11], q[50]; +cx q[42], q[16]; +cx q[15], q[46]; +cx q[35], q[48]; +cx q[13], q[5]; +cx q[28], q[40]; +x q[31]; +x q[51]; +x q[52]; +x q[27]; +x q[30]; +x q[40]; +x q[0]; +x q[15]; +x q[48]; +x q[23]; +x q[49]; +x q[28]; +x q[26]; +x q[36]; +x q[6]; +x q[46]; +x q[32]; +x q[35]; +x q[5]; +x q[45]; +x q[47]; +x q[39]; +x q[38]; +x q[14]; +x q[20]; +x q[17]; +x q[29]; +x q[8]; +cx q[9], q[24]; +cx q[19], q[13]; +cx q[18], q[12]; +cx q[1], q[21]; +cx q[34], q[41]; +cx q[42], q[16]; +cx q[10], q[11]; +cx q[33], q[25]; +cx q[4], q[7]; +cx q[37], q[2]; +x q[31]; +x q[6]; +x q[46]; +x q[41]; +x q[2]; +x q[37]; +x q[34]; +x q[38]; +x q[50]; +x q[12]; +x q[47]; +x q[42]; +x q[5]; +x q[11]; +x q[9]; +x q[27]; +x q[33]; +x q[15]; +x q[32]; +x q[17]; +x q[7]; +x q[29]; +x q[25]; +x q[19]; +x q[13]; +x q[30]; +x q[8]; +x q[44]; +x q[1]; +x q[18]; +x q[23]; +x q[40]; +x q[16]; +x q[52]; +x q[45]; +x q[28]; +cx q[36], q[43]; +cx q[24], q[3]; +cx q[39], q[26]; +cx q[35], q[48]; +cx q[49], q[10]; +cx q[14], q[0]; +x q[31]; +x q[27]; +x q[11]; +x q[50]; +x q[25]; +x q[20]; +x q[17]; +x q[32]; +x q[6]; +x q[43]; +x q[38]; +x q[37]; +x q[52]; +x q[36]; +x q[48]; +x q[35]; +x q[41]; +x q[45]; +x q[4]; +x q[49]; +x q[16]; +x q[44]; +x q[51]; +x q[23]; +x q[34]; +x q[12]; +x q[28]; +x q[42]; +x q[47]; +x q[40]; +x q[22]; +cx q[15], q[46]; +cx q[13], q[5]; +cx q[30], q[18]; +cx q[24], q[3]; +cx q[7], q[8]; +cx q[29], q[33]; +cx q[1], q[21]; +cx q[14], q[0]; +cx q[39], q[2]; +x q[4]; +x q[43]; +x q[42]; +x q[0]; +x q[23]; +x q[8]; +x q[2]; +x q[26]; +x q[10]; +x q[45]; +x q[11]; +x q[40]; +x q[1]; +x q[17]; +x q[32]; +x q[19]; +x q[18]; +x q[22]; +x q[33]; +x q[28]; +x q[7]; +x q[21]; +x q[25]; +x q[13]; +x q[50]; +x q[51]; +x q[49]; +x q[47]; +x q[15]; +x q[46]; +x q[30]; +x q[29]; +cx q[31], q[52]; +cx q[12], q[38]; +cx q[34], q[41]; +cx q[14], q[9]; +cx q[24], q[3]; +cx q[27], q[39]; +cx q[35], q[48]; +cx q[5], q[37]; +x q[31]; +x q[36]; +x q[4]; +x q[45]; +x q[40]; +x q[23]; +x q[18]; +x q[44]; +x q[20]; +x q[17]; +x q[22]; +x q[48]; +x q[34]; +x q[42]; +x q[7]; +x q[38]; +x q[41]; +x q[8]; +x q[0]; +x q[12]; +x q[9]; +x q[32]; +x q[49]; +x q[26]; +x q[16]; +x q[47]; +x q[10]; +x q[52]; +x q[35]; +x q[19]; +x q[30]; +cx q[29], q[33]; +cx q[13], q[5]; +cx q[1], q[21]; +cx q[27], q[39]; +cx q[37], q[2]; +cx q[15], q[28]; +cx q[11], q[50]; +cx q[6], q[14]; +cx q[24], q[46]; +x q[31]; +x q[52]; +x q[49]; +x q[45]; +x q[9]; +x q[7]; +x q[39]; +x q[21]; +x q[26]; +x q[2]; +x q[47]; +x q[48]; +x q[12]; +x q[20]; +x q[13]; +x q[25]; +x q[27]; +x q[44]; +x q[18]; +x q[6]; +x q[33]; +x q[0]; +x q[30]; +x q[3]; +x q[50]; +x q[23]; +x q[38]; +x q[14]; +x q[35]; +x q[5]; +x q[1]; +x q[17]; +x q[36]; +x q[19]; +x q[4]; +x q[24]; +x q[22]; +x q[46]; +x q[16]; +x q[37]; +x q[40]; +x q[51]; +cx q[15], q[28]; +cx q[10], q[11]; +cx q[42], q[34]; +cx q[43], q[29]; +x q[31]; +x q[49]; +x q[17]; +x q[26]; +x q[33]; +x q[52]; +x q[29]; +x q[50]; +x q[16]; +x q[51]; +x q[2]; +x q[4]; +x q[22]; +x q[42]; +x q[5]; +x q[39]; +x q[35]; +x q[47]; +x q[40]; +x q[48]; +x q[32]; +x q[23]; +x q[19]; +x q[20]; +x q[45]; +x q[6]; +x q[9]; +x q[28]; +x q[37]; +cx q[7], q[8]; +cx q[14], q[0]; +cx q[30], q[18]; +cx q[10], q[11]; +cx q[34], q[41]; +cx q[15], q[46]; +cx q[24], q[3]; +cx q[43], q[44]; +cx q[1], q[21]; +x q[31]; +x q[13]; +x q[24]; +x q[0]; +x q[14]; +x q[45]; +x q[3]; +x q[27]; +x q[47]; +x q[28]; +x q[35]; +x q[15]; +x q[21]; +x q[36]; +x q[2]; +x q[52]; +x q[22]; +x q[50]; +x q[1]; +x q[46]; +x q[19]; +x q[49]; +x q[25]; +x q[33]; +x q[6]; +x q[4]; +x q[23]; +x q[51]; +cx q[12], q[38]; +cx q[10], q[48]; +cx q[34], q[41]; +cx q[5], q[37]; +cx q[7], q[8]; +cx q[42], q[16]; +cx q[39], q[26]; +cx q[30], q[18]; +cx q[17], q[44]; +cx q[43], q[29]; +x q[31]; +x q[52]; +x q[16]; +x q[6]; +x q[33]; +x q[46]; +x q[27]; +x q[17]; +x q[39]; +x q[37]; +x q[22]; +x q[20]; +x q[8]; +x q[51]; +x q[48]; +x q[21]; +x q[15]; +x q[4]; +x q[29]; +x q[18]; +x q[42]; +x q[26]; +x q[2]; +x q[23]; +x q[9]; +x q[7]; +x q[25]; +x q[35]; +x q[1]; +x q[11]; +x q[47]; +cx q[50], q[19]; +cx q[34], q[41]; +cx q[24], q[3]; +cx q[12], q[38]; +cx q[49], q[10]; +cx q[43], q[44]; +cx q[13], q[5]; +cx q[28], q[40]; +x q[32]; +x q[47]; +x q[27]; +x q[4]; +x q[39]; +x q[23]; +x q[34]; +x q[52]; +x q[42]; +x q[30]; +x q[45]; +x q[8]; +x q[6]; +x q[13]; +x q[41]; +x q[44]; +x q[26]; +x q[2]; +x q[5]; +x q[33]; +x q[51]; +x q[0]; +x q[16]; +x q[21]; +x q[46]; +cx q[31], q[22]; +cx q[38], q[36]; +cx q[49], q[10]; +cx q[11], q[50]; +cx q[43], q[29]; +cx q[17], q[1]; +cx q[35], q[48]; +cx q[24], q[3]; +cx q[28], q[40]; +cx q[18], q[12]; +cx q[7], q[20]; +cx q[14], q[9]; +x q[27]; +x q[45]; +x q[23]; +x q[14]; +x q[11]; +x q[35]; +x q[13]; +x q[25]; +x q[47]; +x q[42]; +x q[48]; +x q[49]; +x q[7]; +x q[1]; +x q[33]; +x q[20]; +x q[26]; +x q[8]; +x q[6]; +x q[34]; +x q[19]; +x q[32]; +x q[16]; +cx q[31], q[22]; +cx q[43], q[29]; +cx q[17], q[44]; +cx q[28], q[40]; +cx q[30], q[18]; +cx q[15], q[46]; +cx q[9], q[24]; +cx q[38], q[36]; +cx q[21], q[0]; +cx q[5], q[37]; +cx q[39], q[2]; +cx q[41], q[52]; +x q[19]; +x q[51]; +x q[47]; +x q[26]; +x q[38]; +x q[44]; +x q[40]; +x q[39]; +x q[4]; +x q[41]; +x q[12]; +x q[7]; +x q[16]; +x q[5]; +x q[36]; +x q[45]; +x q[46]; +x q[34]; +x q[23]; +x q[27]; +x q[52]; +x q[50]; +x q[11]; +x q[10]; +x q[6]; +x q[33]; +cx q[31], q[22]; +cx q[3], q[42]; +cx q[43], q[29]; +cx q[30], q[18]; +cx q[37], q[2]; +cx q[21], q[49]; +cx q[15], q[28]; +cx q[32], q[8]; +cx q[25], q[35]; +cx q[9], q[24]; +cx q[17], q[1]; +cx q[14], q[0]; +x q[31]; +x q[3]; +x q[35]; +x q[29]; +x q[8]; +x q[42]; +x q[28]; +x q[45]; +x q[41]; +x q[5]; +x q[48]; +x q[18]; +x q[11]; +x q[16]; +x q[10]; +x q[13]; +x q[39]; +x q[30]; +x q[49]; +x q[0]; +x q[6]; +x q[52]; +x q[27]; +x q[22]; +x q[14]; +x q[47]; +x q[34]; +x q[43]; +x q[21]; +x q[44]; +x q[24]; +cx q[38], q[36]; +cx q[20], q[17]; +cx q[15], q[46]; +cx q[40], q[23]; +cx q[50], q[19]; +cx q[4], q[7]; +cx q[33], q[25]; +cx q[37], q[2]; +cx q[32], q[51]; +x q[31]; +x q[12]; +x q[36]; +x q[32]; +x q[17]; +x q[4]; +x q[40]; +x q[25]; +x q[49]; +x q[13]; +x q[2]; +x q[1]; +x q[22]; +x q[48]; +x q[26]; +x q[8]; +x q[46]; +x q[45]; +x q[0]; +x q[10]; +x q[43]; +x q[34]; +x q[19]; +x q[44]; +cx q[29], q[33]; +cx q[6], q[14]; +cx q[51], q[47]; +cx q[9], q[24]; +cx q[27], q[39]; +cx q[7], q[20]; +cx q[3], q[42]; +cx q[5], q[37]; +cx q[30], q[18]; +cx q[11], q[50]; +cx q[41], q[52]; +cx q[15], q[28]; +x q[11]; +x q[20]; +x q[47]; +x q[34]; +x q[3]; +x q[50]; +x q[27]; +x q[24]; +x q[52]; +x q[4]; +x q[15]; +x q[43]; +x q[37]; +x q[19]; +x q[22]; +x q[7]; +x q[26]; +x q[0]; +x q[5]; +x q[42]; +x q[13]; +x q[12]; +x q[51]; +x q[46]; +cx q[23], q[31]; +cx q[29], q[33]; +cx q[28], q[40]; +cx q[25], q[35]; +cx q[39], q[2]; +cx q[30], q[18]; +cx q[6], q[14]; +cx q[10], q[48]; +cx q[32], q[8]; +cx q[38], q[36]; +cx q[17], q[1]; +cx q[21], q[49]; +x q[5]; +x q[33]; +x q[30]; +x q[42]; +x q[41]; +x q[34]; +x q[3]; +x q[16]; +x q[25]; +x q[20]; +x q[29]; +x q[13]; +x q[32]; +x q[7]; +x q[22]; +x q[35]; +x q[8]; +x q[24]; +x q[52]; +x q[12]; +x q[51]; +x q[48]; +x q[37]; +x q[38]; +x q[9]; +x q[28]; +cx q[23], q[31]; +cx q[15], q[46]; +cx q[21], q[0]; +cx q[11], q[50]; +cx q[47], q[6]; +cx q[39], q[2]; +cx q[17], q[1]; +cx q[49], q[10]; +cx q[45], q[4]; +cx q[43], q[44]; +x q[26]; +x q[7]; +x q[6]; +x q[21]; +x q[38]; +x q[49]; +x q[41]; +x q[36]; +x q[1]; +x q[37]; +x q[32]; +x q[3]; +x q[14]; +x q[35]; +x q[4]; +x q[8]; +x q[11]; +x q[10]; +x q[48]; +x q[30]; +x q[45]; +x q[22]; +cx q[31], q[52]; +cx q[18], q[12]; +cx q[43], q[29]; +cx q[20], q[17]; +cx q[13], q[5]; +cx q[39], q[2]; +cx q[42], q[16]; +cx q[15], q[46]; +cx q[51], q[47]; +cx q[9], q[24]; +cx q[33], q[25]; +cx q[50], q[19]; +cx q[28], q[40]; +x q[52]; +x q[13]; +x q[42]; +x q[22]; +x q[25]; +x q[45]; +x q[40]; +x q[46]; +x q[1]; +x q[12]; +x q[7]; +x q[20]; +x q[2]; +x q[6]; +x q[16]; +x q[47]; +x q[23]; +x q[0]; +x q[9]; +x q[34]; +x q[36]; +x q[31]; +x q[4]; +x q[3]; +x q[21]; +x q[24]; +x q[14]; +x q[41]; +x q[28]; +x q[51]; +x q[38]; +x q[10]; +x q[43]; +x q[15]; +x q[19]; +cx q[32], q[8]; +cx q[39], q[26]; +cx q[5], q[37]; +cx q[11], q[50]; +cx q[35], q[48]; +cx q[29], q[33]; +cx q[30], q[18]; +cx q[17], q[44]; +x q[38]; +x q[3]; +x q[27]; +x q[5]; +x q[0]; +x q[24]; +x q[23]; +x q[2]; +x q[26]; +x q[41]; +x q[34]; +x q[9]; +x q[25]; +x q[4]; +x q[6]; +x q[15]; +x q[18]; +x q[47]; +x q[40]; +x q[19]; +x q[35]; +x q[22]; +x q[39]; +x q[8]; +x q[42]; +x q[13]; +x q[16]; +x q[12]; +x q[49]; +x q[28]; +cx q[31], q[52]; +cx q[10], q[48]; +cx q[11], q[50]; +cx q[29], q[33]; +cx q[7], q[20]; +cx q[32], q[51]; +cx q[1], q[21]; +cx q[17], q[44]; +cx q[36], q[43]; +cx q[45], q[30]; +x q[44]; +x q[30]; +x q[12]; +x q[0]; +x q[36]; +x q[17]; +x q[19]; +x q[20]; +x q[34]; +x q[51]; +x q[43]; +x q[47]; +x q[28]; +x q[45]; +x q[33]; +x q[9]; +x q[49]; +x q[39]; +x q[3]; +x q[29]; +x q[50]; +x q[48]; +x q[46]; +x q[11]; +x q[8]; +x q[32]; +cx q[31], q[52]; +cx q[40], q[23]; +cx q[42], q[16]; +cx q[41], q[27]; +cx q[1], q[21]; +cx q[13], q[5]; +cx q[4], q[7]; +cx q[6], q[14]; +cx q[37], q[2]; +x q[21]; +x q[14]; +x q[47]; +x q[51]; +x q[43]; +x q[44]; +x q[19]; +x q[12]; +x q[6]; +x q[29]; +x q[10]; +x q[1]; +x q[30]; +x q[11]; +x q[26]; +x q[32]; +x q[49]; +x q[0]; +x q[34]; +x q[18]; +x q[3]; +x q[23]; +x q[42]; +cx q[41], q[52]; +cx q[9], q[24]; +cx q[20], q[17]; +cx q[13], q[5]; +cx q[28], q[40]; +cx q[7], q[8]; +cx q[27], q[39]; +cx q[50], q[16]; +cx q[15], q[46]; +cx q[37], q[2]; +cx q[33], q[25]; +cx q[38], q[36]; +cx q[45], q[4]; +cx q[31], q[22]; +cx q[35], q[48]; +x q[52]; +x q[9]; +x q[25]; +x q[42]; +x q[45]; +x q[31]; +x q[19]; +x q[16]; +x q[40]; +x q[12]; +x q[35]; +x q[4]; +x q[0]; +x q[7]; +x q[44]; +x q[3]; +x q[14]; +x q[11]; +x q[34]; +x q[23]; +x q[50]; +x q[43]; +x q[1]; +x q[28]; +cx q[21], q[49]; +cx q[20], q[17]; +cx q[10], q[48]; +cx q[24], q[46]; +cx q[39], q[26]; +cx q[13], q[5]; +cx q[38], q[36]; +cx q[30], q[18]; +cx q[41], q[27]; +cx q[37], q[2]; +cx q[32], q[8]; +cx q[47], q[6]; +x q[52]; +x q[2]; +x q[33]; +x q[23]; +x q[27]; +x q[17]; +x q[3]; +x q[14]; +x q[42]; +x q[15]; +x q[44]; +x q[28]; +x q[43]; +x q[25]; +x q[6]; +x q[0]; +x q[29]; +x q[46]; +x q[35]; +x q[51]; +x q[26]; +x q[32]; +x q[39]; +x q[13]; +x q[20]; +x q[47]; +x q[19]; +cx q[10], q[11]; +cx q[50], q[16]; +cx q[30], q[18]; +cx q[9], q[24]; +cx q[5], q[37]; +cx q[38], q[36]; +cx q[1], q[21]; +cx q[45], q[4]; +cx q[7], q[8]; +cx q[34], q[41]; +cx q[31], q[22]; +x q[52]; +x q[0]; +x q[8]; +x q[14]; +x q[31]; +x q[17]; +x q[45]; +x q[4]; +x q[16]; +x q[32]; +x q[37]; +x q[10]; +x q[49]; +x q[6]; +x q[42]; +x q[3]; +x q[46]; +x q[2]; +x q[28]; +x q[25]; +x q[27]; +x q[15]; +x q[33]; +x q[51]; +x q[19]; +x q[5]; +x q[12]; +cx q[38], q[36]; +cx q[35], q[48]; +cx q[9], q[24]; +cx q[11], q[50]; +cx q[43], q[44]; +cx q[34], q[41]; +cx q[39], q[26]; +cx q[40], q[23]; +cx q[30], q[18]; +cx q[7], q[20]; +cx q[1], q[21]; +x q[52]; +x q[51]; +x q[26]; +x q[37]; +x q[45]; +x q[47]; +x q[25]; +x q[43]; +x q[11]; +x q[24]; +x q[46]; +x q[14]; +x q[49]; +x q[19]; +x q[44]; +x q[6]; +x q[12]; +x q[21]; +x q[3]; +x q[9]; +x q[22]; +x q[0]; +x q[35]; +x q[8]; +x q[33]; +x q[27]; +x q[32]; +x q[40]; +x q[41]; +cx q[13], q[5]; +cx q[20], q[17]; +cx q[15], q[28]; +cx q[39], q[2]; +cx q[42], q[34]; +cx q[38], q[36]; +cx q[50], q[16]; +cx q[23], q[31]; +cx q[10], q[48]; +cx q[4], q[7]; +cx q[30], q[18]; +x q[52]; +x q[49]; +x q[43]; +x q[40]; +x q[37]; +x q[23]; +x q[32]; +x q[46]; +x q[17]; +x q[29]; +x q[8]; +x q[42]; +x q[28]; +x q[38]; +x q[18]; +x q[4]; +x q[50]; +x q[0]; +x q[10]; +x q[31]; +x q[51]; +x q[15]; +x q[5]; +x q[36]; +x q[26]; +x q[33]; +x q[19]; +x q[44]; +x q[9]; +x q[16]; +x q[14]; +x q[25]; +x q[27]; +x q[6]; +cx q[45], q[30]; +cx q[24], q[3]; +cx q[39], q[2]; +cx q[7], q[20]; +cx q[34], q[41]; +cx q[35], q[48]; +cx q[1], q[21]; +x q[14]; +x q[10]; +x q[22]; +x q[17]; +x q[6]; +x q[27]; +x q[29]; +x q[35]; +x q[33]; +x q[38]; +x q[26]; +x q[15]; +x q[30]; +x q[1]; +x q[41]; +x q[32]; +x q[28]; +x q[20]; +x q[16]; +x q[40]; +x q[25]; +x q[34]; +x q[48]; +x q[23]; +x q[37]; +x q[46]; +cx q[31], q[52]; +cx q[11], q[50]; +cx q[43], q[44]; +cx q[3], q[42]; +cx q[18], q[12]; +cx q[51], q[47]; +cx q[39], q[2]; +cx q[9], q[24]; +cx q[45], q[4]; +cx q[13], q[5]; +x q[31]; +x q[34]; +x q[25]; +x q[22]; +x q[18]; +x q[35]; +x q[28]; +x q[36]; +x q[41]; +x q[21]; +x q[43]; +x q[38]; +x q[30]; +x q[19]; +x q[12]; +x q[2]; +x q[45]; +x q[44]; +x q[49]; +x q[24]; +x q[37]; +x q[4]; +x q[7]; +x q[40]; +x q[48]; +x q[27]; +cx q[10], q[11]; +cx q[29], q[33]; +cx q[14], q[0]; +cx q[50], q[16]; +cx q[39], q[26]; +cx q[3], q[42]; +cx q[15], q[46]; +cx q[13], q[5]; +cx q[20], q[17]; +cx q[51], q[47]; +cx q[32], q[8]; +x q[9]; +x q[29]; +x q[14]; +x q[6]; +x q[7]; +x q[12]; +x q[35]; +x q[40]; +x q[49]; +x q[20]; +x q[34]; +x q[16]; +x q[22]; +x q[26]; +x q[23]; +x q[17]; +x q[39]; +x q[0]; +x q[36]; +x q[28]; +x q[43]; +x q[41]; +cx q[31], q[52]; +cx q[50], q[19]; +cx q[33], q[25]; +cx q[51], q[47]; +cx q[32], q[8]; +cx q[15], q[46]; +cx q[1], q[21]; +cx q[37], q[2]; +cx q[13], q[5]; +cx q[24], q[3]; +cx q[10], q[48]; +cx q[45], q[30]; +x q[52]; +x q[42]; +x q[41]; +x q[17]; +x q[51]; +x q[47]; +x q[43]; +x q[44]; +x q[36]; +x q[12]; +x q[3]; +x q[18]; +x q[25]; +x q[20]; +x q[0]; +x q[26]; +x q[23]; +x q[11]; +x q[34]; +x q[38]; +x q[45]; +x q[30]; +x q[40]; +cx q[9], q[24]; +cx q[32], q[8]; +cx q[5], q[37]; +cx q[6], q[14]; +cx q[29], q[33]; +cx q[50], q[16]; +cx q[19], q[13]; +cx q[1], q[21]; +cx q[39], q[2]; +cx q[35], q[48]; +cx q[31], q[22]; +cx q[49], q[10]; +cx q[15], q[46]; +cx q[4], q[7]; +x q[52]; +x q[39]; +x q[26]; +x q[27]; +x q[36]; +x q[44]; +x q[15]; +x q[7]; +x q[0]; +x q[2]; +x q[8]; +x q[9]; +x q[22]; +x q[38]; +x q[43]; +x q[30]; +x q[41]; +x q[31]; +x q[6]; +x q[18]; +x q[17]; +x q[3]; +x q[49]; +x q[28]; +x q[11]; +x q[14]; +x q[20]; +x q[19]; +x q[24]; +cx q[25], q[35]; +cx q[29], q[33]; +cx q[1], q[21]; +cx q[40], q[23]; +cx q[45], q[4]; +cx q[10], q[48]; +cx q[5], q[37]; +cx q[51], q[47]; +cx q[42], q[34]; +cx q[50], q[16]; +x q[6]; +x q[23]; +x q[8]; +x q[3]; +x q[10]; +x q[2]; +x q[22]; +x q[44]; +x q[27]; +x q[43]; +x q[26]; +x q[28]; +x q[40]; +x q[47]; +x q[33]; +x q[13]; +x q[49]; +x q[37]; +x q[19]; +x q[32]; +x q[24]; +x q[39]; +x q[5]; +x q[48]; +cx q[41], q[52]; +cx q[21], q[0]; +cx q[14], q[9]; +cx q[15], q[46]; +cx q[17], q[1]; +cx q[25], q[35]; +cx q[42], q[16]; +cx q[38], q[36]; +cx q[18], q[12]; +cx q[7], q[20]; +cx q[11], q[50]; +cx q[45], q[30]; +x q[52]; +x q[23]; +x q[15]; +x q[18]; +x q[17]; +x q[12]; +x q[0]; +x q[3]; +x q[30]; +x q[16]; +x q[47]; +x q[1]; +x q[46]; +x q[34]; +x q[26]; +x q[36]; +x q[49]; +x q[50]; +x q[21]; +x q[27]; +x q[43]; +x q[9]; +x q[31]; +x q[14]; +x q[24]; +x q[44]; +x q[7]; +x q[6]; +x q[35]; +x q[37]; +x q[41]; +x q[51]; +x q[5]; +x q[42]; +x q[29]; +x q[22]; +cx q[32], q[8]; +cx q[45], q[4]; +cx q[10], q[48]; +cx q[33], q[25]; +cx q[39], q[2]; +cx q[19], q[13]; +x q[52]; +x q[24]; +x q[27]; +x q[51]; +x q[2]; +x q[15]; +x q[47]; +x q[1]; +x q[7]; +x q[33]; +x q[22]; +x q[6]; +x q[19]; +x q[25]; +x q[8]; +x q[4]; +x q[16]; +x q[5]; +x q[45]; +x q[26]; +x q[39]; +x q[13]; +x q[46]; +x q[50]; +x q[11]; +x q[37]; +x q[20]; +x q[29]; +x q[38]; +cx q[17], q[44]; +cx q[3], q[42]; +cx q[34], q[41]; +cx q[49], q[10]; +cx q[40], q[23]; +cx q[21], q[0]; +cx q[14], q[9]; +cx q[18], q[12]; +cx q[35], q[48]; +x q[43]; +x q[48]; +x q[21]; +x q[4]; +x q[33]; +x q[7]; +x q[51]; +x q[2]; +x q[12]; +x q[27]; +x q[9]; +x q[39]; +x q[38]; +x q[18]; +x q[34]; +x q[36]; +x q[47]; +x q[22]; +x q[26]; +x q[29]; +x q[42]; +x q[13]; +x q[20]; +x q[14]; +x q[6]; +x q[1]; +x q[31]; +x q[49]; +x q[40]; +x q[30]; +x q[44]; +cx q[41], q[52]; +cx q[10], q[11]; +cx q[32], q[8]; +cx q[25], q[35]; +cx q[24], q[3]; +cx q[15], q[46]; +cx q[5], q[37]; +cx q[50], q[16]; +x q[52]; +x q[34]; +x q[20]; +x q[29]; +x q[10]; +x q[22]; +x q[6]; +x q[27]; +x q[9]; +x q[47]; +x q[7]; +x q[50]; +x q[15]; +x q[30]; +x q[49]; +x q[18]; +x q[14]; +x q[41]; +x q[31]; +x q[19]; +x q[25]; +x q[28]; +x q[36]; +x q[11]; +cx q[12], q[38]; +cx q[45], q[4]; +cx q[17], q[1]; +cx q[37], q[2]; +cx q[24], q[3]; +cx q[39], q[26]; +cx q[40], q[23]; +cx q[43], q[44]; +cx q[21], q[0]; +cx q[32], q[51]; +cx q[13], q[5]; +cx q[35], q[48]; +x q[4]; +x q[12]; +x q[15]; +x q[2]; +x q[42]; +x q[0]; +x q[30]; +x q[9]; +x q[23]; +x q[11]; +x q[22]; +x q[18]; +x q[47]; +x q[34]; +x q[45]; +x q[3]; +x q[32]; +x q[36]; +x q[19]; +x q[26]; +x q[13]; +x q[39]; +x q[38]; +cx q[31], q[52]; +cx q[7], q[8]; +cx q[41], q[27]; +cx q[43], q[44]; +cx q[24], q[46]; +cx q[33], q[25]; +cx q[20], q[17]; +cx q[50], q[16]; +cx q[28], q[40]; +cx q[1], q[21]; +cx q[6], q[14]; +cx q[5], q[37]; +cx q[49], q[10]; +cx q[35], q[48]; +x q[52]; +x q[23]; +x q[21]; +x q[30]; +x q[38]; +x q[31]; +x q[11]; +x q[22]; +x q[9]; +x q[36]; +x q[50]; +x q[33]; +x q[34]; +x q[35]; +x q[18]; +x q[24]; +x q[12]; +x q[48]; +x q[29]; +cx q[41], q[27]; +cx q[45], q[4]; +cx q[32], q[8]; +cx q[39], q[26]; +cx q[37], q[2]; +cx q[15], q[46]; +cx q[47], q[6]; +cx q[13], q[5]; +cx q[43], q[44]; +cx q[3], q[42]; +cx q[28], q[40]; +cx q[17], q[1]; +cx q[49], q[10]; +cx q[14], q[0]; +x q[52]; +x q[34]; +x q[49]; +x q[2]; +x q[32]; +x q[21]; +x q[33]; +x q[23]; +x q[45]; +x q[40]; +x q[18]; +x q[41]; +x q[22]; +x q[29]; +x q[8]; +x q[9]; +x q[48]; +x q[38]; +x q[35]; +x q[51]; +x q[31]; +x q[37]; +x q[27]; +x q[0]; +x q[11]; +x q[44]; +x q[47]; +cx q[50], q[19]; +cx q[7], q[20]; +cx q[36], q[43]; +cx q[17], q[1]; +cx q[13], q[5]; +cx q[6], q[14]; +cx q[24], q[3]; +cx q[42], q[16]; +cx q[15], q[46]; +cx q[39], q[26]; +x q[52]; +x q[29]; +x q[12]; +x q[14]; +x q[16]; +x q[50]; +x q[33]; +x q[21]; +x q[5]; +x q[49]; +x q[28]; +x q[44]; +x q[40]; +x q[3]; +x q[45]; +x q[41]; +x q[25]; +x q[32]; +x q[24]; +x q[0]; +x q[26]; +x q[51]; +x q[23]; +x q[1]; +x q[19]; +x q[4]; +x q[13]; +x q[18]; +cx q[42], q[34]; +cx q[35], q[48]; +cx q[31], q[22]; +cx q[47], q[6]; +cx q[37], q[2]; +cx q[7], q[8]; +cx q[20], q[17]; +cx q[15], q[46]; +cx q[10], q[11]; +cx q[27], q[39]; +cx q[36], q[43]; +x q[5]; +x q[39]; +x q[29]; +x q[26]; +x q[21]; +x q[50]; +x q[38]; +x q[46]; +x q[19]; +x q[49]; +x q[20]; +x q[16]; +x q[42]; +x q[0]; +x q[33]; +x q[34]; +x q[25]; +x q[35]; +x q[27]; +x q[17]; +x q[43]; +x q[36]; +x q[13]; +x q[11]; +cx q[41], q[52]; +cx q[9], q[24]; +cx q[10], q[48]; +cx q[32], q[8]; +cx q[18], q[12]; +cx q[40], q[23]; +cx q[51], q[47]; +cx q[31], q[22]; +cx q[6], q[14]; +cx q[37], q[2]; +cx q[4], q[7]; +cx q[15], q[28]; +cx q[45], q[30]; +x q[41]; +x q[9]; +x q[22]; +x q[15]; +x q[52]; +x q[28]; +x q[26]; +x q[18]; +x q[12]; +x q[47]; +x q[39]; +x q[34]; +x q[27]; +x q[11]; +x q[33]; +x q[7]; +x q[45]; +x q[25]; +x q[1]; +x q[44]; +x q[16]; +x q[51]; +x q[46]; +x q[13]; +x q[21]; +x q[42]; +x q[0]; +cx q[40], q[23]; +cx q[24], q[3]; +cx q[32], q[8]; +cx q[6], q[14]; +cx q[20], q[17]; +cx q[35], q[48]; +cx q[38], q[36]; +cx q[49], q[10]; +cx q[50], q[19]; +cx q[43], q[29]; +cx q[37], q[2]; +x q[41]; +x q[28]; +x q[7]; +x q[21]; +x q[12]; +x q[4]; +x q[1]; +x q[46]; +x q[14]; +x q[16]; +x q[15]; +x q[34]; +x q[25]; +x q[47]; +x q[0]; +x q[6]; +x q[43]; +x q[33]; +x q[20]; +x q[38]; +x q[13]; +x q[22]; +x q[11]; +x q[49]; +x q[26]; +x q[23]; +x q[31]; +x q[10]; +x q[36]; +x q[45]; +x q[29]; +cx q[5], q[37]; +cx q[17], q[44]; +cx q[9], q[24]; +cx q[3], q[42]; +cx q[27], q[39]; +cx q[35], q[48]; +cx q[32], q[8]; +cx q[30], q[18]; +x q[11]; +x q[37]; +x q[19]; +x q[14]; +x q[12]; +x q[3]; +x q[38]; +x q[4]; +x q[48]; +x q[9]; +x q[7]; +x q[36]; +x q[49]; +x q[5]; +x q[10]; +x q[23]; +x q[1]; +x q[16]; +x q[24]; +x q[33]; +x q[18]; +x q[51]; +x q[35]; +x q[13]; +x q[42]; +x q[52]; +x q[2]; +x q[25]; +x q[26]; +cx q[34], q[41]; +cx q[20], q[17]; +cx q[47], q[6]; +cx q[21], q[0]; +cx q[32], q[8]; +cx q[27], q[39]; +cx q[43], q[44]; +cx q[45], q[30]; +cx q[15], q[46]; +cx q[28], q[40]; +cx q[31], q[22]; +x q[34]; +x q[5]; +x q[18]; +x q[2]; +x q[52]; +x q[35]; +x q[27]; +x q[9]; +x q[19]; +x q[17]; +x q[15]; +x q[39]; +x q[37]; +x q[29]; +x q[25]; +x q[3]; +x q[23]; +x q[0]; +x q[47]; +x q[4]; +x q[14]; +x q[41]; +x q[46]; +x q[20]; +x q[24]; +x q[26]; +x q[30]; +x q[45]; +x q[38]; +x q[6]; +cx q[31], q[22]; +cx q[43], q[44]; +cx q[7], q[8]; +cx q[42], q[16]; +cx q[49], q[10]; +cx q[32], q[51]; +cx q[11], q[50]; +cx q[28], q[40]; +cx q[1], q[21]; +x q[17]; +x q[52]; +x q[9]; +x q[19]; +x q[5]; +x q[27]; +x q[37]; +x q[1]; +x q[49]; +x q[45]; +x q[24]; +x q[16]; +x q[13]; +x q[20]; +x q[30]; +x q[26]; +x q[46]; +x q[22]; +x q[7]; +x q[47]; +x q[36]; +x q[31]; +x q[18]; +x q[29]; +x q[51]; +x q[42]; +cx q[34], q[41]; +cx q[40], q[23]; +cx q[12], q[38]; +cx q[6], q[14]; +cx q[15], q[28]; +cx q[11], q[50]; +cx q[10], q[48]; +cx q[43], q[44]; +cx q[33], q[25]; +cx q[32], q[8]; +cx q[39], q[2]; +x q[34]; +x q[40]; +x q[33]; +x q[10]; +x q[4]; +x q[26]; +x q[7]; +x q[41]; +x q[27]; +x q[25]; +x q[28]; +x q[49]; +x q[21]; +x q[8]; +x q[32]; +x q[20]; +x q[3]; +x q[19]; +x q[14]; +x q[23]; +x q[51]; +x q[1]; +x q[31]; +x q[6]; +x q[15]; +x q[18]; +x q[45]; +x q[36]; +x q[44]; +x q[52]; +x q[9]; +x q[39]; +x q[0]; +x q[30]; +x q[17]; +x q[22]; +cx q[37], q[2]; +cx q[13], q[5]; +cx q[12], q[38]; +cx q[35], q[48]; +cx q[24], q[46]; +cx q[42], q[16]; +cx q[11], q[50]; +cx q[43], q[29]; +x q[7]; +x q[39]; +x q[11]; +x q[48]; +x q[44]; +x q[45]; +x q[29]; +x q[15]; +x q[23]; +x q[33]; +x q[40]; +x q[28]; +x q[52]; +x q[4]; +x q[43]; +x q[0]; +x q[20]; +x q[27]; +x q[46]; +x q[26]; +x q[3]; +x q[22]; +x q[12]; +x q[51]; +cx q[34], q[41]; +cx q[21], q[49]; +cx q[30], q[18]; +cx q[50], q[19]; +cx q[32], q[8]; +cx q[47], q[6]; +cx q[37], q[2]; +cx q[13], q[5]; +cx q[25], q[35]; +cx q[9], q[24]; +cx q[42], q[16]; +cx q[17], q[1]; +cx q[38], q[36]; +x q[41]; +x q[49]; +x q[47]; +x q[38]; +x q[51]; +x q[40]; +x q[34]; +x q[45]; +x q[37]; +x q[5]; +x q[32]; +x q[13]; +x q[23]; +x q[11]; +x q[43]; +x q[16]; +x q[6]; +x q[30]; +x q[42]; +x q[36]; +x q[10]; +x q[14]; +x q[1]; +x q[46]; +x q[22]; +x q[25]; +x q[3]; +x q[2]; +x q[17]; +x q[44]; +cx q[35], q[48]; +cx q[9], q[24]; +cx q[7], q[20]; +cx q[50], q[19]; +cx q[21], q[0]; +cx q[15], q[28]; +cx q[18], q[12]; +cx q[29], q[33]; +cx q[39], q[26]; +x q[41]; +x q[19]; +x q[46]; +x q[29]; +x q[11]; +x q[4]; +x q[34]; +x q[7]; +x q[32]; +x q[20]; +x q[52]; +x q[47]; +x q[30]; +x q[45]; +x q[27]; +x q[39]; +x q[3]; +x q[2]; +x q[24]; +x q[35]; +x q[13]; +x q[51]; +x q[38]; +x q[23]; +x q[36]; +x q[26]; +x q[6]; +x q[0]; +x q[50]; +x q[22]; +x q[15]; +x q[31]; +x q[18]; +cx q[42], q[16]; +cx q[43], q[44]; +cx q[33], q[25]; +cx q[28], q[40]; +cx q[5], q[37]; +cx q[17], q[1]; +cx q[49], q[10]; +cx q[14], q[9]; +x q[41]; +x q[34]; +x q[19]; +x q[25]; +x q[28]; +x q[18]; +x q[4]; +x q[20]; +x q[0]; +x q[43]; +x q[31]; +x q[16]; +x q[5]; +x q[48]; +x q[1]; +x q[35]; +x q[45]; +x q[42]; +x q[13]; +x q[23]; +x q[29]; +x q[12]; +x q[33]; +x q[6]; +x q[27]; +x q[36]; +x q[32]; +x q[14]; +cx q[39], q[26]; +cx q[49], q[10]; +cx q[51], q[47]; +cx q[9], q[24]; +cx q[17], q[44]; +cx q[11], q[50]; +cx q[15], q[46]; +x q[41]; +x q[20]; +x q[45]; +x q[37]; +x q[47]; +x q[23]; +x q[29]; +x q[15]; +x q[33]; +x q[50]; +x q[30]; +x q[27]; +x q[25]; +x q[52]; +x q[38]; +x q[3]; +x q[34]; +x q[6]; +x q[24]; +x q[0]; +x q[11]; +x q[31]; +x q[22]; +x q[2]; +cx q[10], q[48]; +cx q[28], q[40]; +cx q[17], q[44]; +cx q[4], q[7]; +cx q[36], q[43]; +cx q[14], q[9]; +cx q[21], q[49]; +cx q[18], q[12]; +cx q[39], q[26]; +cx q[42], q[16]; +cx q[32], q[51]; +cx q[19], q[13]; +x q[41]; +x q[18]; +x q[30]; +x q[12]; +x q[44]; +x q[47]; +x q[43]; +x q[9]; +x q[45]; +x q[27]; +x q[52]; +x q[13]; +x q[1]; +x q[35]; +x q[23]; +x q[3]; +x q[32]; +x q[24]; +x q[37]; +x q[2]; +x q[40]; +x q[6]; +x q[25]; +x q[46]; +cx q[50], q[16]; +cx q[29], q[33]; +cx q[42], q[34]; +cx q[20], q[17]; +cx q[31], q[22]; +cx q[39], q[26]; +cx q[4], q[7]; +cx q[15], q[28]; +cx q[14], q[0]; +cx q[38], q[36]; +cx q[21], q[49]; +cx q[10], q[11]; +x q[27]; +x q[46]; +x q[48]; +x q[1]; +x q[37]; +x q[29]; +x q[12]; +x q[45]; +x q[40]; +x q[5]; +x q[47]; +x q[19]; +x q[13]; +x q[18]; +x q[38]; +x q[51]; +x q[7]; +x q[4]; +x q[49]; +x q[26]; +x q[23]; +x q[20]; +x q[17]; +x q[24]; +x q[36]; +cx q[41], q[52]; +cx q[50], q[16]; +cx q[43], q[44]; +cx q[15], q[28]; +cx q[14], q[9]; +cx q[33], q[25]; +cx q[39], q[2]; +cx q[21], q[0]; +cx q[32], q[8]; +cx q[31], q[22]; +cx q[10], q[11]; +cx q[42], q[34]; +x q[41]; +x q[4]; +x q[46]; +x q[45]; +x q[24]; +x q[40]; +x q[32]; +x q[6]; +x q[23]; +x q[28]; +x q[17]; +x q[34]; +x q[20]; +x q[30]; +x q[18]; +x q[3]; +x q[27]; +x q[31]; +x q[15]; +x q[11]; +x q[22]; +x q[29]; +x q[5]; +x q[1]; +x q[33]; +x q[12]; +x q[10]; +x q[35]; +x q[26]; +cx q[21], q[0]; +cx q[14], q[9]; +cx q[19], q[13]; +cx q[51], q[47]; +cx q[7], q[8]; +cx q[42], q[16]; +cx q[43], q[44]; +cx q[38], q[36]; +cx q[37], q[2]; +x q[44]; +x q[51]; +x q[27]; +x q[34]; +x q[18]; +x q[43]; +x q[47]; +x q[9]; +x q[36]; +x q[20]; +x q[26]; +x q[50]; +x q[32]; +x q[49]; +x q[38]; +x q[30]; +x q[35]; +x q[14]; +x q[25]; +x q[17]; +x q[48]; +x q[45]; +x q[29]; +x q[21]; +x q[24]; +x q[12]; +x q[6]; +x q[0]; +x q[8]; +x q[16]; +x q[40]; +x q[2]; +x q[3]; +x q[33]; +x q[46]; +x q[22]; +x q[1]; +cx q[41], q[52]; +cx q[15], q[28]; +cx q[4], q[7]; +cx q[5], q[37]; +cx q[23], q[31]; +cx q[19], q[13]; +cx q[10], q[11]; +x q[10]; +x q[47]; +x q[6]; +x q[39]; +x q[4]; +x q[13]; +x q[26]; +x q[9]; +x q[14]; +x q[2]; +x q[11]; +x q[27]; +x q[1]; +x q[21]; +x q[49]; +x q[36]; +x q[0]; +x q[28]; +cx q[34], q[41]; +cx q[45], q[30]; +cx q[7], q[8]; +cx q[40], q[23]; +cx q[50], q[19]; +cx q[15], q[46]; +cx q[35], q[48]; +cx q[24], q[3]; +cx q[5], q[37]; +cx q[18], q[12]; +cx q[43], q[29]; +cx q[17], q[44]; +cx q[32], q[51]; +cx q[42], q[16]; +cx q[31], q[22]; +x q[8]; +x q[4]; +x q[3]; +x q[23]; +x q[27]; +x q[35]; +x q[13]; +x q[50]; +x q[15]; +x q[44]; +x q[45]; +x q[19]; +x q[7]; +x q[49]; +x q[26]; +x q[25]; +x q[20]; +x q[39]; +x q[17]; +x q[32]; +x q[12]; +x q[5]; +x q[1]; +x q[51]; +x q[43]; +x q[42]; +cx q[34], q[41]; +cx q[31], q[52]; +cx q[10], q[11]; +cx q[14], q[9]; +cx q[37], q[2]; +cx q[24], q[46]; +cx q[38], q[36]; +cx q[21], q[0]; +cx q[29], q[33]; +cx q[47], q[6]; +cx q[30], q[18]; +cx q[28], q[40]; +x q[41]; +x q[25]; +x q[44]; +x q[49]; +x q[3]; +x q[40]; +x q[16]; +x q[18]; +x q[21]; +x q[43]; +x q[32]; +x q[14]; +x q[47]; +x q[12]; +x q[50]; +x q[35]; +x q[34]; +x q[42]; +x q[48]; +x q[6]; +x q[51]; +x q[30]; +x q[0]; +x q[26]; +x q[28]; +x q[36]; +cx q[7], q[8]; +cx q[29], q[33]; +cx q[17], q[1]; +cx q[27], q[39]; +cx q[24], q[46]; +cx q[31], q[52]; +cx q[19], q[13]; +cx q[37], q[2]; +cx q[10], q[11]; +x q[41]; +x q[37]; +x q[45]; +x q[10]; +x q[18]; +x q[12]; +x q[50]; +x q[11]; +x q[52]; +x q[26]; +x q[22]; +x q[30]; +x q[35]; +x q[4]; +x q[49]; +x q[2]; +x q[25]; +x q[19]; +x q[16]; +cx q[14], q[9]; +cx q[43], q[44]; +cx q[38], q[36]; +cx q[42], q[34]; +cx q[21], q[0]; +cx q[23], q[31]; +cx q[27], q[39]; +cx q[28], q[40]; +cx q[13], q[5]; +cx q[47], q[6]; +cx q[29], q[33]; +cx q[17], q[1]; +cx q[32], q[51]; +cx q[7], q[8]; +cx q[24], q[3]; +cx q[15], q[46]; +x q[41]; +x q[3]; +x q[18]; +x q[25]; +x q[47]; +x q[27]; +x q[34]; +x q[0]; +x q[2]; +x q[38]; +x q[14]; +x q[19]; +x q[42]; +x q[13]; +x q[35]; +x q[52]; +x q[6]; +x q[9]; +x q[28]; +x q[44]; +x q[11]; +x q[20]; +x q[48]; +x q[5]; +x q[30]; +x q[12]; +cx q[45], q[4]; +cx q[40], q[23]; +cx q[39], q[26]; +cx q[32], q[51]; +cx q[36], q[43]; +cx q[50], q[16]; +cx q[29], q[33]; +cx q[49], q[10]; +cx q[7], q[8]; +cx q[1], q[21]; +cx q[31], q[22]; +cx q[24], q[46]; +x q[31]; +x q[9]; +x q[46]; +x q[5]; +x q[7]; +x q[44]; +x q[34]; +x q[33]; +x q[29]; +x q[28]; +x q[45]; +x q[22]; +x q[42]; +x q[0]; +x q[30]; +x q[49]; +x q[11]; +x q[8]; +x q[18]; +x q[21]; +x q[23]; +x q[2]; +x q[51]; +x q[15]; +x q[37]; +x q[40]; +x q[26]; +x q[14]; +x q[25]; +x q[10]; +cx q[41], q[52]; +cx q[27], q[39]; +cx q[19], q[13]; +cx q[47], q[6]; +cx q[20], q[17]; +cx q[36], q[43]; +cx q[50], q[16]; +cx q[24], q[3]; +cx q[35], q[48]; +x q[19]; +x q[37]; +x q[14]; +x q[34]; +x q[1]; +x q[29]; +x q[35]; +x q[48]; +x q[3]; +x q[24]; +x q[27]; +x q[12]; +x q[22]; +x q[50]; +x q[6]; +x q[7]; +x q[20]; +x q[38]; +x q[26]; +x q[0]; +x q[46]; +cx q[41], q[52]; +cx q[10], q[11]; +cx q[51], q[47]; +cx q[23], q[31]; +cx q[28], q[40]; +cx q[42], q[16]; +cx q[13], q[5]; +cx q[36], q[43]; +cx q[33], q[25]; +cx q[17], q[44]; +cx q[39], q[2]; +cx q[30], q[18]; +cx q[21], q[49]; +cx q[45], q[4]; +x q[43]; +x q[8]; +x q[3]; +x q[26]; +x q[47]; +x q[18]; +x q[25]; +x q[20]; +x q[46]; +x q[36]; +x q[34]; +x q[42]; +x q[11]; +x q[13]; +x q[27]; +x q[24]; +x q[45]; +x q[30]; +x q[12]; +x q[22]; +x q[1]; +x q[38]; +x q[9]; +x q[4]; +x q[16]; +x q[19]; +cx q[41], q[52]; +cx q[17], q[44]; +cx q[28], q[40]; +cx q[49], q[10]; +cx q[5], q[37]; +cx q[23], q[31]; +cx q[32], q[51]; +cx q[29], q[33]; +cx q[39], q[2]; +cx q[35], q[48]; +cx q[6], q[14]; +x q[52]; +x q[19]; +x q[13]; +x q[25]; +x q[28]; +x q[33]; +x q[40]; +x q[49]; +x q[22]; +x q[5]; +x q[18]; +x q[6]; +x q[34]; +x q[10]; +x q[30]; +x q[45]; +x q[16]; +x q[23]; +x q[21]; +x q[31]; +x q[29]; +x q[15]; +cx q[20], q[17]; +cx q[35], q[48]; +cx q[24], q[46]; +cx q[36], q[43]; +cx q[39], q[26]; +cx q[32], q[8]; +cx q[37], q[2]; +cx q[11], q[50]; +cx q[4], q[7]; +cx q[14], q[0]; +cx q[51], q[47]; +cx q[12], q[38]; diff --git a/test/benchmarks/qasm/54QBT_25CYC_QSE_3.qasm b/test/benchmarks/qasm/54QBT_25CYC_QSE_3.qasm new file mode 100644 index 000000000000..4910c35dfec6 --- /dev/null +++ b/test/benchmarks/qasm/54QBT_25CYC_QSE_3.qasm @@ -0,0 +1,966 @@ +// Originally source from the QUEKO benchmark suite +// https://github.com/UCLA-VAST/QUEKO-benchmark +// A benchmark that is near-term feasible for Google Sycamore with a optimal +// soluation depth of 25 +OPENQASM 2.0; +include "qelib1.inc"; +qreg q[54]; +x q[36]; +x q[24]; +x q[13]; +x q[22]; +x q[47]; +x q[1]; +x q[23]; +x q[11]; +x q[25]; +x q[46]; +x q[15]; +x q[44]; +x q[27]; +x q[8]; +x q[39]; +x q[3]; +x q[12]; +x q[52]; +x q[18]; +x q[0]; +x q[21]; +x q[26]; +x q[16]; +x q[51]; +x q[33]; +x q[9]; +cx q[43], q[50]; +cx q[7], q[45]; +cx q[28], q[5]; +cx q[35], q[32]; +cx q[42], q[34]; +cx q[29], q[48]; +cx q[49], q[41]; +cx q[6], q[14]; +cx q[17], q[53]; +cx q[30], q[4]; +cx q[40], q[19]; +cx q[31], q[20]; +x q[36]; +x q[8]; +x q[31]; +x q[50]; +x q[43]; +x q[16]; +x q[25]; +x q[52]; +x q[26]; +x q[5]; +x q[27]; +x q[35]; +x q[12]; +x q[14]; +x q[34]; +x q[51]; +x q[38]; +x q[47]; +x q[2]; +x q[28]; +x q[6]; +x q[20]; +x q[29]; +x q[44]; +x q[1]; +x q[53]; +x q[9]; +cx q[37], q[21]; +cx q[46], q[23]; +cx q[48], q[11]; +cx q[39], q[30]; +cx q[49], q[4]; +cx q[17], q[22]; +cx q[19], q[13]; +cx q[10], q[41]; +cx q[7], q[45]; +x q[37]; +x q[19]; +x q[10]; +x q[39]; +x q[30]; +x q[7]; +x q[13]; +x q[50]; +x q[22]; +x q[21]; +x q[51]; +x q[38]; +x q[29]; +x q[44]; +x q[20]; +x q[45]; +x q[16]; +x q[9]; +x q[1]; +x q[28]; +x q[3]; +x q[32]; +x q[18]; +x q[24]; +x q[2]; +x q[43]; +x q[40]; +cx q[36], q[17]; +cx q[49], q[4]; +cx q[34], q[26]; +cx q[8], q[47]; +cx q[53], q[25]; +cx q[15], q[35]; +cx q[11], q[6]; +cx q[27], q[42]; +cx q[46], q[23]; +cx q[41], q[52]; +cx q[33], q[31]; +x q[17]; +x q[25]; +x q[27]; +x q[21]; +x q[48]; +x q[47]; +x q[41]; +x q[14]; +x q[1]; +x q[39]; +x q[18]; +x q[24]; +x q[37]; +x q[36]; +x q[10]; +x q[49]; +x q[5]; +x q[2]; +x q[42]; +x q[13]; +x q[15]; +x q[50]; +x q[45]; +x q[28]; +x q[35]; +x q[22]; +cx q[31], q[20]; +cx q[11], q[6]; +cx q[7], q[43]; +cx q[12], q[38]; +cx q[3], q[29]; +cx q[46], q[23]; +cx q[16], q[26]; +cx q[40], q[33]; +cx q[19], q[8]; +cx q[4], q[9]; +x q[33]; +x q[21]; +x q[0]; +x q[51]; +x q[1]; +x q[36]; +x q[46]; +x q[18]; +x q[27]; +x q[23]; +x q[52]; +x q[44]; +x q[48]; +x q[3]; +x q[34]; +x q[28]; +x q[24]; +x q[29]; +x q[12]; +x q[15]; +x q[25]; +x q[2]; +x q[31]; +x q[49]; +cx q[17], q[53]; +cx q[22], q[39]; +cx q[43], q[50]; +cx q[38], q[45]; +cx q[19], q[8]; +cx q[35], q[32]; +cx q[42], q[16]; +cx q[26], q[14]; +cx q[5], q[40]; +cx q[4], q[9]; +cx q[7], q[37]; +cx q[10], q[41]; +cx q[11], q[6]; +x q[9]; +x q[24]; +x q[22]; +x q[21]; +x q[6]; +x q[29]; +x q[4]; +x q[37]; +x q[14]; +x q[36]; +x q[23]; +x q[3]; +x q[30]; +x q[32]; +x q[35]; +x q[46]; +x q[50]; +x q[39]; +x q[15]; +x q[43]; +x q[12]; +x q[34]; +x q[20]; +x q[26]; +x q[10]; +x q[52]; +cx q[17], q[53]; +cx q[13], q[47]; +cx q[31], q[44]; +cx q[40], q[19]; +cx q[25], q[51]; +cx q[7], q[45]; +cx q[5], q[18]; +cx q[42], q[16]; +cx q[28], q[1]; +cx q[2], q[27]; +cx q[38], q[0]; +cx q[48], q[11]; +cx q[49], q[41]; +cx q[33], q[8]; +x q[17]; +x q[16]; +x q[51]; +x q[37]; +x q[47]; +x q[19]; +x q[35]; +x q[3]; +x q[53]; +x q[26]; +x q[7]; +x q[13]; +x q[20]; +x q[5]; +x q[33]; +x q[31]; +x q[0]; +x q[32]; +x q[28]; +x q[10]; +x q[24]; +x q[6]; +x q[29]; +x q[21]; +x q[12]; +x q[9]; +cx q[25], q[30]; +cx q[8], q[44]; +cx q[38], q[48]; +cx q[22], q[39]; +cx q[45], q[11]; +cx q[46], q[23]; +cx q[1], q[40]; +cx q[2], q[27]; +cx q[43], q[50]; +cx q[4], q[52]; +cx q[49], q[41]; +cx q[36], q[34]; +x q[17]; +x q[37]; +x q[44]; +x q[42]; +x q[32]; +x q[26]; +x q[21]; +x q[18]; +x q[50]; +x q[13]; +x q[1]; +x q[19]; +x q[29]; +x q[51]; +x q[22]; +x q[9]; +x q[14]; +x q[43]; +x q[12]; +x q[39]; +x q[15]; +x q[46]; +x q[35]; +x q[49]; +cx q[45], q[11]; +cx q[6], q[24]; +cx q[38], q[0]; +cx q[27], q[3]; +cx q[30], q[4]; +cx q[40], q[33]; +cx q[53], q[25]; +cx q[36], q[34]; +cx q[28], q[5]; +cx q[41], q[20]; +cx q[10], q[31]; +x q[17]; +x q[10]; +x q[29]; +x q[24]; +x q[8]; +x q[13]; +x q[20]; +x q[2]; +x q[33]; +x q[9]; +x q[48]; +x q[15]; +x q[47]; +x q[51]; +x q[31]; +x q[43]; +x q[12]; +x q[27]; +x q[44]; +x q[36]; +x q[22]; +x q[39]; +x q[4]; +x q[23]; +x q[5]; +x q[18]; +x q[45]; +x q[3]; +x q[19]; +x q[21]; +x q[40]; +x q[52]; +cx q[34], q[26]; +cx q[35], q[32]; +cx q[7], q[37]; +cx q[28], q[1]; +cx q[30], q[46]; +cx q[53], q[25]; +cx q[14], q[49]; +cx q[16], q[6]; +cx q[38], q[0]; +x q[17]; +x q[40]; +x q[52]; +x q[51]; +x q[39]; +x q[21]; +x q[11]; +x q[18]; +x q[9]; +x q[15]; +x q[44]; +x q[47]; +x q[43]; +x q[37]; +x q[38]; +x q[34]; +x q[23]; +x q[0]; +x q[14]; +x q[12]; +x q[29]; +x q[32]; +x q[20]; +x q[48]; +x q[4]; +x q[46]; +x q[30]; +x q[26]; +x q[28]; +x q[36]; +x q[42]; +x q[10]; +cx q[53], q[25]; +cx q[50], q[5]; +cx q[35], q[2]; +cx q[19], q[8]; +cx q[33], q[31]; +cx q[6], q[24]; +cx q[7], q[45]; +cx q[27], q[3]; +x q[17]; +x q[43]; +x q[29]; +x q[47]; +x q[33]; +x q[13]; +x q[30]; +x q[12]; +x q[22]; +x q[24]; +x q[52]; +x q[40]; +x q[32]; +x q[18]; +x q[48]; +x q[20]; +x q[5]; +x q[31]; +x q[9]; +x q[4]; +x q[41]; +cx q[25], q[51]; +cx q[11], q[1]; +cx q[39], q[49]; +cx q[45], q[28]; +cx q[16], q[6]; +cx q[35], q[2]; +cx q[46], q[23]; +cx q[27], q[3]; +cx q[42], q[34]; +cx q[19], q[8]; +cx q[7], q[37]; +cx q[26], q[14]; +x q[4]; +x q[30]; +x q[34]; +x q[51]; +x q[13]; +x q[5]; +x q[0]; +x q[43]; +x q[27]; +x q[1]; +x q[46]; +x q[12]; +x q[21]; +x q[40]; +x q[26]; +x q[2]; +x q[50]; +x q[23]; +x q[20]; +x q[36]; +x q[15]; +x q[22]; +x q[10]; +x q[9]; +x q[28]; +x q[44]; +x q[25]; +x q[3]; +cx q[17], q[53]; +cx q[38], q[45]; +cx q[41], q[52]; +cx q[6], q[14]; +cx q[7], q[37]; +cx q[24], q[33]; +cx q[29], q[48]; +cx q[35], q[32]; +cx q[18], q[19]; +cx q[42], q[16]; +cx q[39], q[49]; +x q[47]; +x q[3]; +x q[36]; +x q[48]; +x q[13]; +x q[2]; +x q[28]; +x q[37]; +x q[11]; +x q[33]; +x q[27]; +x q[0]; +x q[30]; +x q[43]; +x q[10]; +x q[22]; +x q[21]; +x q[24]; +x q[31]; +x q[7]; +x q[44]; +x q[1]; +x q[50]; +x q[20]; +cx q[32], q[17]; +cx q[46], q[23]; +cx q[42], q[16]; +cx q[4], q[9]; +cx q[39], q[49]; +cx q[25], q[51]; +cx q[5], q[40]; +cx q[38], q[45]; +cx q[18], q[19]; +cx q[41], q[52]; +cx q[6], q[14]; +cx q[15], q[35]; +cx q[29], q[12]; +cx q[34], q[26]; +x q[32]; +x q[18]; +x q[39]; +x q[2]; +x q[51]; +x q[33]; +x q[35]; +x q[47]; +x q[6]; +x q[38]; +x q[1]; +x q[45]; +x q[27]; +x q[49]; +x q[43]; +x q[42]; +x q[50]; +x q[52]; +x q[12]; +x q[37]; +x q[11]; +x q[53]; +x q[13]; +x q[21]; +x q[17]; +x q[8]; +x q[46]; +cx q[26], q[14]; +cx q[31], q[44]; +cx q[3], q[29]; +cx q[48], q[16]; +cx q[36], q[34]; +cx q[40], q[19]; +cx q[4], q[9]; +cx q[10], q[41]; +cx q[28], q[5]; +cx q[22], q[25]; +cx q[0], q[7]; +x q[1]; +x q[46]; +x q[42]; +x q[41]; +x q[19]; +x q[36]; +x q[45]; +x q[52]; +x q[44]; +x q[25]; +x q[34]; +x q[20]; +x q[7]; +x q[0]; +x q[51]; +x q[49]; +x q[40]; +x q[26]; +x q[22]; +x q[39]; +x q[11]; +x q[9]; +x q[15]; +x q[8]; +x q[10]; +x q[16]; +x q[14]; +x q[50]; +x q[13]; +x q[5]; +cx q[35], q[32]; +cx q[6], q[24]; +cx q[37], q[21]; +cx q[29], q[48]; +cx q[12], q[38]; +cx q[27], q[3]; +cx q[17], q[53]; +cx q[43], q[28]; +cx q[33], q[31]; +x q[32]; +x q[38]; +x q[22]; +x q[53]; +x q[34]; +x q[39]; +x q[50]; +x q[51]; +x q[36]; +x q[11]; +x q[48]; +x q[30]; +x q[46]; +x q[6]; +x q[45]; +x q[49]; +x q[5]; +x q[17]; +x q[9]; +x q[4]; +x q[25]; +x q[41]; +x q[52]; +x q[23]; +x q[13]; +x q[2]; +x q[0]; +cx q[7], q[37]; +cx q[31], q[20]; +cx q[29], q[12]; +cx q[18], q[19]; +cx q[15], q[35]; +cx q[26], q[14]; +cx q[40], q[33]; +cx q[8], q[44]; +cx q[21], q[43]; +cx q[42], q[16]; +cx q[27], q[3]; +cx q[1], q[24]; +x q[32]; +x q[15]; +x q[39]; +x q[44]; +x q[13]; +x q[46]; +x q[7]; +x q[17]; +x q[51]; +x q[47]; +x q[41]; +x q[8]; +x q[14]; +x q[53]; +x q[5]; +x q[10]; +x q[22]; +x q[50]; +x q[20]; +x q[2]; +x q[12]; +x q[42]; +x q[38]; +x q[23]; +x q[3]; +x q[48]; +x q[34]; +x q[49]; +x q[35]; +x q[0]; +x q[43]; +cx q[18], q[19]; +cx q[27], q[36]; +cx q[33], q[31]; +cx q[16], q[26]; +cx q[1], q[24]; +cx q[4], q[9]; +cx q[37], q[21]; +cx q[11], q[6]; +cx q[25], q[30]; +cx q[45], q[28]; +x q[32]; +x q[9]; +x q[19]; +x q[35]; +x q[11]; +x q[51]; +x q[36]; +x q[41]; +x q[38]; +x q[48]; +x q[47]; +x q[29]; +x q[0]; +x q[53]; +x q[10]; +x q[7]; +x q[18]; +x q[8]; +x q[45]; +x q[13]; +x q[12]; +x q[43]; +x q[52]; +x q[4]; +x q[34]; +x q[3]; +x q[23]; +x q[28]; +x q[25]; +x q[15]; +x q[40]; +cx q[2], q[27]; +cx q[37], q[21]; +cx q[26], q[39]; +cx q[17], q[22]; +cx q[50], q[5]; +cx q[42], q[16]; +cx q[31], q[44]; +cx q[24], q[33]; +cx q[30], q[46]; +x q[19]; +x q[50]; +x q[12]; +x q[53]; +x q[40]; +x q[34]; +x q[24]; +x q[1]; +x q[0]; +x q[8]; +x q[2]; +x q[17]; +x q[25]; +x q[43]; +x q[29]; +x q[3]; +x q[51]; +x q[37]; +x q[15]; +x q[52]; +x q[22]; +x q[28]; +x q[36]; +x q[20]; +x q[31]; +x q[21]; +x q[11]; +x q[5]; +x q[23]; +cx q[35], q[32]; +cx q[26], q[39]; +cx q[27], q[42]; +cx q[49], q[41]; +cx q[7], q[45]; +cx q[38], q[48]; +cx q[30], q[4]; +cx q[16], q[6]; +cx q[46], q[9]; +cx q[14], q[10]; +x q[30]; +x q[52]; +x q[48]; +x q[37]; +x q[12]; +x q[11]; +x q[6]; +x q[41]; +x q[19]; +x q[42]; +x q[16]; +x q[8]; +x q[18]; +x q[23]; +x q[35]; +x q[15]; +x q[34]; +x q[1]; +x q[0]; +x q[13]; +x q[3]; +x q[36]; +x q[22]; +x q[14]; +x q[20]; +x q[24]; +x q[44]; +cx q[32], q[17]; +cx q[7], q[45]; +cx q[53], q[25]; +cx q[43], q[28]; +cx q[4], q[9]; +cx q[51], q[46]; +cx q[2], q[27]; +cx q[40], q[33]; +cx q[26], q[39]; +cx q[50], q[5]; +x q[17]; +x q[10]; +x q[13]; +x q[47]; +x q[31]; +x q[36]; +x q[50]; +x q[44]; +x q[2]; +x q[30]; +x q[27]; +x q[46]; +x q[41]; +x q[34]; +x q[22]; +x q[53]; +x q[23]; +x q[37]; +x q[51]; +x q[15]; +x q[20]; +x q[48]; +x q[12]; +x q[9]; +x q[18]; +x q[42]; +x q[19]; +x q[16]; +x q[52]; +x q[4]; +cx q[1], q[24]; +cx q[14], q[49]; +cx q[33], q[8]; +cx q[26], q[39]; +cx q[38], q[0]; +cx q[3], q[29]; +cx q[5], q[40]; +cx q[11], q[6]; +cx q[35], q[32]; +cx q[43], q[28]; +cx q[7], q[45]; +x q[24]; +x q[16]; +x q[25]; +x q[30]; +x q[31]; +x q[29]; +x q[21]; +x q[9]; +x q[52]; +x q[33]; +x q[4]; +x q[53]; +x q[44]; +x q[15]; +x q[51]; +x q[0]; +x q[10]; +x q[27]; +x q[8]; +x q[22]; +x q[35]; +cx q[36], q[17]; +cx q[38], q[48]; +cx q[11], q[1]; +cx q[40], q[19]; +cx q[39], q[49]; +cx q[46], q[23]; +cx q[41], q[20]; +cx q[7], q[43]; +cx q[5], q[18]; +cx q[6], q[14]; +cx q[13], q[47]; +cx q[45], q[28]; +cx q[42], q[34]; +x q[37]; +x q[42]; +x q[53]; +x q[0]; +x q[33]; +x q[24]; +x q[35]; +x q[49]; +x q[28]; +x q[20]; +x q[44]; +x q[51]; +x q[14]; +x q[22]; +x q[3]; +x q[18]; +x q[40]; +x q[26]; +x q[45]; +x q[31]; +x q[8]; +x q[1]; +x q[7]; +x q[23]; +x q[21]; +x q[10]; +x q[25]; +x q[19]; +x q[41]; +x q[15]; +cx q[32], q[17]; +cx q[48], q[11]; +cx q[4], q[52]; +cx q[43], q[50]; +cx q[36], q[34]; +cx q[13], q[47]; +cx q[16], q[6]; +cx q[29], q[12]; +cx q[39], q[30]; +cx q[46], q[9]; +x q[17]; +x q[32]; +x q[48]; +x q[43]; +x q[35]; +x q[5]; +x q[38]; +x q[20]; +x q[0]; +x q[1]; +x q[13]; +x q[50]; +x q[41]; +x q[2]; +x q[21]; +x q[22]; +x q[11]; +x q[44]; +x q[15]; +x q[6]; +x q[31]; +x q[23]; +x q[25]; +x q[28]; +x q[53]; +x q[3]; +x q[26]; +x q[27]; +x q[45]; +cx q[29], q[12]; +cx q[40], q[33]; +cx q[42], q[16]; +cx q[14], q[49]; +cx q[39], q[30]; +cx q[51], q[46]; +cx q[24], q[10]; +cx q[18], q[19]; +cx q[36], q[34]; +cx q[4], q[52]; +x q[17]; +x q[34]; +x q[23]; +x q[22]; +x q[12]; +x q[37]; +x q[21]; +x q[35]; +x q[52]; +x q[15]; +x q[28]; +x q[43]; +x q[31]; +x q[41]; +x q[20]; +x q[46]; +x q[1]; +x q[36]; +x q[9]; +x q[10]; +x q[24]; +x q[51]; +x q[30]; +x q[49]; +x q[47]; +x q[3]; +x q[0]; +x q[26]; +x q[39]; +x q[44]; +x q[38]; +x q[18]; +x q[50]; +x q[4]; +cx q[2], q[27]; +cx q[19], q[13]; +cx q[53], q[25]; +cx q[33], q[8]; +cx q[48], q[16]; +cx q[7], q[45]; +cx q[5], q[40]; +cx q[11], q[6]; +cx q[29], q[42]; diff --git a/test/benchmarks/queko.py b/test/benchmarks/queko.py new file mode 100644 index 000000000000..1ae8f36b53ff --- /dev/null +++ b/test/benchmarks/queko.py @@ -0,0 +1,235 @@ +# -*- coding: utf-8 -*- + +# This code is part of Qiskit. +# +# (C) Copyright IBM 2021. +# +# This code is licensed under the Apache License, Version 2.0. You may +# obtain a copy of this license in the LICENSE.txt file in the root directory +# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. +# +# Any modifications or derivative works of this code must retain this +# copyright notice, and modified files need to carry a notice indicating +# that they have been altered from the originals. + +# pylint: disable=no-member,invalid-name,missing-docstring,no-name-in-module +# pylint: disable=attribute-defined-outside-init,unsubscriptable-object + +import os + +from qiskit import QuantumCircuit +from qiskit.compiler import transpile + + +class QUEKOTranspilerBench: + params = ([0, 1, 2, 3], + [None, "sabre"]) + param_names = ["optimization level", "routing/layout method"] + timeout = 600 + + # pylint: disable=unused-argument + def setup(self, optimization_level, routing_method): + self.rochester_coupling_map = [ + [0, 5], + [0, 1], + [1, 2], + [1, 0], + [2, 3], + [2, 1], + [3, 4], + [3, 2], + [4, 6], + [4, 3], + [5, 9], + [5, 0], + [6, 13], + [6, 4], + [7, 16], + [7, 8], + [8, 9], + [8, 7], + [9, 10], + [9, 8], + [9, 5], + [10, 11], + [10, 9], + [11, 17], + [11, 12], + [11, 10], + [12, 13], + [12, 11], + [13, 14], + [13, 12], + [13, 6], + [14, 15], + [14, 13], + [15, 18], + [15, 14], + [16, 19], + [16, 7], + [17, 23], + [17, 11], + [18, 27], + [18, 15], + [19, 20], + [19, 16], + [20, 21], + [20, 19], + [21, 28], + [21, 22], + [21, 20], + [22, 23], + [22, 21], + [23, 24], + [23, 22], + [23, 17], + [24, 25], + [24, 23], + [25, 29], + [25, 26], + [25, 24], + [26, 27], + [26, 25], + [27, 26], + [27, 18], + [28, 32], + [28, 21], + [29, 36], + [29, 25], + [30, 39], + [30, 31], + [31, 32], + [31, 30], + [32, 33], + [32, 31], + [32, 28], + [33, 34], + [33, 32], + [34, 40], + [34, 35], + [34, 33], + [35, 36], + [35, 34], + [36, 37], + [36, 35], + [36, 29], + [37, 38], + [37, 36], + [38, 41], + [38, 37], + [39, 42], + [39, 30], + [40, 46], + [40, 34], + [41, 50], + [41, 38], + [42, 43], + [42, 39], + [43, 44], + [43, 42], + [44, 51], + [44, 45], + [44, 43], + [45, 46], + [45, 44], + [46, 47], + [46, 45], + [46, 40], + [47, 48], + [47, 46], + [48, 52], + [48, 49], + [48, 47], + [49, 50], + [49, 48], + [50, 49], + [50, 41], + [51, 44], + [52, 48]] + + self.tokyo_coupling_map = [ + [0, 1], [1, 2], [2, 3], [3, 4], + [0, 5], [1, 6], [1, 7], [2, 6], [2, 7], [3, 8], [3, 9], [4, 8], + [4, 9], [5, 6], [6, 7], [7, 8], [8, 9], [5, 10], [5, 11], [6, 10], + [6, 11], [7, 12], [7, 13], [8, 12], [8, 13], [9, 14], [10, 11], + [11, 12], [12, 13], [13, 14], [10, 15], [11, 16], [11, 17], + [12, 16], [12, 17], [13, 18], [13, 19], [14, 18], [14, 19], + [15, 16], [16, 17], [17, 18], [18, 19] + ] + self.sycamore_coupling_map = [ + [0, 6], [1, 6], [1, 7], [2, 7], [2, 8], [3, 8], [3, 9], [4, 9], + [4, 10], [5, 10], [5, 11], [6, 12], [6, 13], [7, 13], [7, 14], + [8, 14], [8, 15], [9, 15], [9, 16], [10, 16], [10, 17], [11, 17], + [12, 18], [13, 18], [13, 19], [14, 19], [14, 20], [15, 20], + [15, 21], [16, 21], [16, 22], [17, 22], [17, 23], [18, 24], + [18, 25], [19, 25], [19, 26], [20, 26], [20, 27], [21, 27], + [21, 28], [22, 28], [22, 29], [23, 29], [24, 30], [25, 30], + [25, 31], [26, 31], [26, 32], [27, 32], [27, 33], [28, 33], + [28, 34], [29, 34], [29, 35], [30, 36], [30, 37], [31, 37], + [31, 38], [32, 38], [32, 39], [33, 39], [33, 40], [34, 40], + [34, 41], [35, 41], [36, 42], [37, 42], [37, 43], [38, 43], + [38, 44], [39, 44], [39, 45], [40, 45], [40, 46], [41, 46], + [41, 47], [42, 48], [42, 49], [43, 49], [43, 50], [44, 50], + [44, 51], [45, 51], [45, 52], [46, 52], [46, 53], [47, 53] + ] + self.basis_gates = ["id", "rz", "sx", "x", "cx"] + self.qasm_path = os.path.abspath( + os.path.join(os.path.dirname(__file__), "qasm")) + + self.bigd = QuantumCircuit.from_qasm_file( + os.path.join(self.qasm_path, "20QBT_45CYC_.0D1_.1D2_3.qasm")) + self.bss = QuantumCircuit.from_qasm_file( + os.path.join(self.qasm_path, "53QBT_100CYC_QSE_3.qasm")) + self.bntf = QuantumCircuit.from_qasm_file( + os.path.join(self.qasm_path, "54QBT_25CYC_QSE_3.qasm")) + + def track_depth_bntf_optimal_depth_25(self, optimization_level, + routing_method): + return transpile(self.bntf, coupling_map=self.sycamore_coupling_map, + basis_gates=self.basis_gates, + routing_method=routing_method, + layout_method=routing_method, + optimization_level=optimization_level, + seed_transpiler=0).depth() + + def track_depth_bss_optimal_depth_100(self, optimization_level, + routing_method): + return transpile(self.bss, coupling_map=self.rochester_coupling_map, + basis_gates=self.basis_gates, + routing_method=routing_method, + layout_method=routing_method, + optimization_level=optimization_level, + seed_transpiler=0).depth() + + def track_depth_bigd_optimal_depth_45(self, optimization_level, + routing_method): + return transpile(self.bigd, coupling_map=self.tokyo_coupling_map, + basis_gates=self.basis_gates, + routing_method=routing_method, + layout_method=routing_method, + optimization_level=optimization_level, + seed_transpiler=0).depth() + + def time_transpile_bntf(self, optimization_level, routing_method): + transpile(self.bntf, coupling_map=self.sycamore_coupling_map, + basis_gates=self.basis_gates, + routing_method=routing_method, + layout_method=routing_method, + optimization_level=optimization_level, + seed_transpiler=0).depth() + + def time_transpile_bss(self, optimization_level, routing_method): + transpile(self.bss, coupling_map=self.rochester_coupling_map, + basis_gates=self.basis_gates, + routing_method=routing_method, + layout_method=routing_method, + optimization_level=optimization_level, + seed_transpiler=0).depth() + + def time_transpile_bigd(self, optimization_level, routing_method): + transpile(self.bigd, coupling_map=self.tokyo_coupling_map, + basis_gates=self.basis_gates, + routing_method=routing_method, + layout_method=routing_method, + optimization_level=optimization_level, + seed_transpiler=0).depth() From 2aee971f02faa8790c0c972b17b1527b61a3b75a Mon Sep 17 00:00:00 2001 From: Thomas Alexander Date: Mon, 8 Feb 2021 19:37:00 -0400 Subject: [PATCH 40/61] Fix pulse schedule benchmarks. (Qiskit/qiskit-metapackage#1155) * Fix pulse schedule benchmarks. * linting. --- .../benchmarks/pulse/schedule_construction.py | 24 +++++++++++++------ .../schedule_to_instruction_conversion.py | 9 +++++-- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/test/benchmarks/pulse/schedule_construction.py b/test/benchmarks/pulse/schedule_construction.py index 0c0612cd30e8..f9f615d48a2d 100644 --- a/test/benchmarks/pulse/schedule_construction.py +++ b/test/benchmarks/pulse/schedule_construction.py @@ -25,8 +25,10 @@ def build_sample_pulse_schedule(number_of_unique_pulses, number_of_channels): sched = Schedule() for _ in range(number_of_unique_pulses): for channel in range(number_of_channels): - sched.append(Play(Waveform(rng.random(50)), - DriveChannel(channel))) + sched.append( + Play(Waveform(rng.random(50)), DriveChannel(channel)), + inplace=True, + ) return sched @@ -35,8 +37,13 @@ def build_parametric_pulse_schedule(number_of_unique_pulses, sched = Schedule() for _ in range(number_of_unique_pulses): for channel in range(number_of_channels): - sched.append(Play(Gaussian(duration=25, sigma=4, amp=0.5j), - DriveChannel(channel))) + sched.append( + Play( + Gaussian(duration=25, sigma=4, amp=0.5j), + DriveChannel(channel), + ), + inplace=True, + ) return sched @@ -62,9 +69,12 @@ def time_parametric_pulse_schedule_construction(self, build_parametric_pulse_schedule(unique_pulses, channels) def time_append_instruction(self, _, __): - self.sample_sched.append(self.parametric_sched) + self.sample_sched.append(self.parametric_sched, inplace=True) def time_insert_instruction_left_to_right(self, _, __): sched = self.sample_sched.shift(self.parametric_sched.stop_time) - sched.insert(self.parametric_sched.start_time, - self.parametric_sched) + sched.insert( + self.parametric_sched.start_time, + self.parametric_sched, + inplace=True, + ) diff --git a/test/benchmarks/pulse/schedule_to_instruction_conversion.py b/test/benchmarks/pulse/schedule_to_instruction_conversion.py index ed32e6c6bb3b..31ce137a913c 100644 --- a/test/benchmarks/pulse/schedule_to_instruction_conversion.py +++ b/test/benchmarks/pulse/schedule_to_instruction_conversion.py @@ -26,8 +26,13 @@ def build_parametric_pulse_schedule(number_of_unique_pulses, sched = Schedule() for _ in range(number_of_unique_pulses): for channel in range(number_of_channels): - sched.append(Play(Gaussian(duration=25, sigma=4, amp=0.5j), - DriveChannel(channel))) + sched.append( + Play( + Gaussian(duration=25, sigma=4, amp=0.5j), + DriveChannel(channel), + ), + inplace=True, + ) return sched From b0d81458447c687f22ef22fddece4e0e0e3298a7 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Tue, 9 Mar 2021 10:44:15 -0500 Subject: [PATCH 41/61] Update QuantumVolume benchmark (Qiskit/qiskit-metapackage#1185) * Update QuantumVolume benchmark This commit updates the quantum volume benchmark to be a bit more modern and more closely represent a typical quantum volume use cases. Instead of varying the width and depth of the input circuit as parameters it uses a sweep over just width (and depth matches) and the depth matches to actually use circuits people run and also to reduce the number of permutations. Additionally, it updates the target device to use a more recent ibmq device (paris) which changes the target coupling map and basis gates. The basic aer target is removed from the benchmark suite because it provides limited value as it's basically running with no coupling map and the basis gates u1, u2, u3 which isn't a realistic target. At the same time this drops the backwards comaptibility shims used to run the benchmark against both old and new versions of qiskit and instead relies on current methods of generation and is only concerned with the performance moving forward. * Fix lint * Fix pylint --- test/benchmarks/quantum_volume.py | 113 +++++++----------------------- 1 file changed, 25 insertions(+), 88 deletions(-) diff --git a/test/benchmarks/quantum_volume.py b/test/benchmarks/quantum_volume.py index ddad889b1ea9..951905f471bc 100644 --- a/test/benchmarks/quantum_volume.py +++ b/test/benchmarks/quantum_volume.py @@ -15,104 +15,41 @@ # limitations under the License. # ============================================================================= -# pylint: disable=no-member,invalid-name,missing-docstring,no-name-in-module -# pylint: disable=attribute-defined-outside-init,unsubscriptable-object +# pylint: disable=missing-class-docstring,missing-function-docstring +# pylint: disable=attribute-defined-outside-init """Module for estimating quantum volume. See arXiv:1811.12926 [quant-ph]""" import numpy as np -from qiskit.providers.basicaer import QasmSimulatorPy -from .utils import build_qv_model_circuit - -try: - from qiskit.mapper import two_qubit_kak - NO_KAK = False -except ImportError: - NO_KAK = True - -try: - from qiskit.circuit import QuantumCircuit, QuantumRegister -except ImportError: - from qiskit import QuantumCircuit, QuantumRegister - -try: - from qiskit.compiler import transpile -except ImportError: - from qiskit.transpiler import transpile - -if not NO_KAK: - from qiskit.quantum_info import random_unitary as random_unitary_matrix - - -def build_model_circuit_kak(width, depth, seed=None): - """Create quantum volume model circuit on quantum register qreg of given - depth (default depth is equal to width) and random seed. - The model circuits consist of layers of Haar random - elements of U(4) applied between corresponding pairs - of qubits in a random bipartition. - """ - qreg = QuantumRegister(width) - depth = depth or width +from qiskit.compiler import transpile - np.random.seed(seed) - circuit = QuantumCircuit( - qreg, name="Qvolume: %s by %s, seed: %s" % (width, depth, seed)) - - for _ in range(depth): - # Generate uniformly random permutation Pj of [0...n-1] - perm = np.random.permutation(width) - - # For each pair p in Pj, generate Haar random U(4) - # Decompose each U(4) into CNOT + SU(2) - for k in range(width // 2): - U = random_unitary_matrix(4) - for gate in two_qubit_kak(U): - qs = [qreg[int(perm[2 * k + i])] for i in gate["args"]] - pars = gate["params"] - name = gate["name"] - if name == "cx": - circuit.cx(qs[0], qs[1]) - elif name == "u1": - circuit.u1(pars[0], qs[0]) - elif name == "u2": - circuit.u2(*pars[:2], qs[0]) - elif name == "u3": - circuit.u3(*pars[:3], qs[0]) - elif name == "id": - pass # do nothing - else: - raise Exception("Unexpected gate name: %s" % name) - return circuit +from .utils import build_qv_model_circuit class QuantumVolumeBenchmark: - params = ([1, 2, 3, 5, 8, 13, 14], [1, 2, 3, 5, 8, 13, 21, 34]) - param_names = ['width', 'depth'] - version = 2 - timeout = 600 + params = ([1, 2, 3, 5, 8, 14, 20, 27], ['translator', 'synthesis']) + param_names = ['Number of Qubits', 'Basis Translation Method'] + version = 3 - def setup(self, width, depth): + def setup(self, width, _): random_seed = np.random.seed(10) - if NO_KAK: - self.circuit = build_qv_model_circuit( - width=width, depth=depth, seed=random_seed) - else: - self.circuit = build_model_circuit_kak(width, depth, random_seed) - - self.sim_backend = QasmSimulatorPy() - - def time_simulator_transpile(self, _, __): - transpile(self.circuit, self.sim_backend) - - def time_ibmq_backend_transpile(self, _, __): - # Run with ibmq_16_melbourne configuration - coupling_map = [[1, 0], [1, 2], [2, 3], [4, 3], [4, 10], [5, 4], - [5, 6], [5, 9], [6, 8], [7, 8], [9, 8], [9, 10], - [11, 3], [11, 10], [11, 12], [12, 2], [13, 1], - [13, 12]] - + self.circuit = build_qv_model_circuit(width, width, random_seed) + self.coupling_map = [ + [0, 1], [1, 0], [1, 2], [1, 4], [2, 1], [2, 3], [3, 2], [3, 5], + [4, 1], [4, 7], [5, 3], [5, 8], [6, 7], [7, 4], [7, 6], [7, 10], + [8, 5], [8, 9], [8, 11], [9, 8], [10, 7], [10, 12], [11, 8], + [11, 14], [12, 10], [12, 13], [12, 15], [13, 12], [13, 14], + [14, 11], [14, 13], [14, 16], [15, 12], [15, 18], [16, 14], + [16, 19], [17, 18], [18, 15], [18, 17], [18, 21], [19, 16], + [19, 20], [19, 22], [20, 19], [21, 18], [21, 23], [22, 19], + [22, 25], [23, 21], [23, 24], [24, 23], [24, 25], [25, 22], + [25, 24], [25, 26], [26, 25]] + self.basis = ['id', 'rz', 'sx', 'x', 'cx', 'reset'] + + def time_ibmq_backend_transpile(self, _, translation): transpile(self.circuit, - basis_gates=['u1', 'u2', 'u3', 'cx', 'id'], - coupling_map=coupling_map) + basis_gates=self.basis, + coupling_map=self.coupling_map, + translation_method=translation) From f18110fe32c9b32113cce98337faa1da9f8c5d3c Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Tue, 9 Mar 2021 11:25:48 -0500 Subject: [PATCH 42/61] Remove benchmarks that measure BasicAer as transpile target (Qiskit/qiskit-metapackage#1186) * Remove benchmarks that measure BasicAer as transpile target This commmit removes all the benchmarks which were using the basic aer simulator as a target for transpilation. These benchmarks were originally added in an attempt to show the overhead of using routing and layout in a transpile but never did a good job of this. We have better microbenchmarks now of each individual transpiler pass and the basic aer target isn't a realistic use case for anything anymore. By removing these duplicate benchmarks we get back some of our time budget that we can use for adding new benchmarks. There are 2 benchmarks which aren't updated to remove the basic aer usage. The first is the quantum_volume module which is addressed in PR Qiskit/qiskit-metapackage#1185 as part of a larger refactor of that benchmark and the state tomography benchmarks which are are actually running a simulation in basic aer and its sill necessary there. * Fix lint --- test/benchmarks/isometry.py | 11 -- test/benchmarks/qft.py | 5 - test/benchmarks/random_circuit_hex.py | 11 +- test/benchmarks/randomized_benchmarking.py | 11 -- test/benchmarks/ripple_adder.py | 11 -- test/benchmarks/transpiler_benchmarks.py | 132 +++++++-------------- 6 files changed, 41 insertions(+), 140 deletions(-) diff --git a/test/benchmarks/isometry.py b/test/benchmarks/isometry.py index 5da0e02a32f0..80fb05bf67c8 100644 --- a/test/benchmarks/isometry.py +++ b/test/benchmarks/isometry.py @@ -36,17 +36,6 @@ def setup(self, m, n): qc.iso(iso, q[:m], q[m:]) self.circuit = qc - def time_simulator_transpile(self, *unused): - transpile(self.circuit, basis_gates=['u1', 'u3', 'u2', 'cx'], - seed_transpiler=0) - - def track_cnot_counts(self, *unused): - circuit = transpile(self.circuit, basis_gates=['u1', 'u3', 'u2', 'cx'], - seed_transpiler=0) - counts = circuit.count_ops() - cnot_count = counts.get('cx', 0) - return cnot_count - def track_cnot_counts_after_mapping_to_ibmq_16_melbourne(self, *unused): coupling = [[1, 0], [1, 2], [2, 3], [4, 3], [4, 10], [5, 4], [5, 6], [5, 9], [6, 8], [7, 8], [9, 8], [9, 10], diff --git a/test/benchmarks/qft.py b/test/benchmarks/qft.py index 413e1ee4b0d8..a2af99dded18 100644 --- a/test/benchmarks/qft.py +++ b/test/benchmarks/qft.py @@ -18,7 +18,6 @@ import math from qiskit import QuantumRegister, QuantumCircuit -from qiskit import BasicAer try: from qiskit.compiler import transpile except ImportError: @@ -46,10 +45,6 @@ class QftTranspileBench: def setup(self, n): qr = QuantumRegister(n) self.circuit = build_model_circuit(qr) - self.sim_backend = BasicAer.get_backend('qasm_simulator') - - def time_simulator_transpile(self, _): - transpile(self.circuit, self.sim_backend) def time_ibmq_backend_transpile(self, _): # Run with ibmq_16_melbourne configuration diff --git a/test/benchmarks/random_circuit_hex.py b/test/benchmarks/random_circuit_hex.py index 063ac6844e40..d9c1807d95dc 100644 --- a/test/benchmarks/random_circuit_hex.py +++ b/test/benchmarks/random_circuit_hex.py @@ -19,7 +19,7 @@ from qiskit.quantum_info.synthesis import OneQubitEulerDecomposer from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister -from qiskit import BasicAer + try: from qiskit.compiler import transpile TRANSPILER_SEED_KEYWORD = 'seed_transpiler' @@ -77,15 +77,6 @@ def setup(self, n): depth = 2 * n self.seed = 0 self.circuit = make_circuit_ring(n, depth, self.seed)[0] - self.sim_backend = BasicAer.get_backend('qasm_simulator') - - def time_simulator_transpile(self, _): - transpile(self.circuit, self.sim_backend, - **{TRANSPILER_SEED_KEYWORD: self.seed}) - - def track_depth_simulator_transpile(self, _): - return transpile(self.circuit, self.sim_backend, - **{TRANSPILER_SEED_KEYWORD: self.seed}).depth() def time_ibmq_backend_transpile(self, _): # Run with ibmq_16_melbourne configuration diff --git a/test/benchmarks/randomized_benchmarking.py b/test/benchmarks/randomized_benchmarking.py index 0116408d20f5..c312a22f708a 100644 --- a/test/benchmarks/randomized_benchmarking.py +++ b/test/benchmarks/randomized_benchmarking.py @@ -20,7 +20,6 @@ import os import numpy as np import qiskit.ignis.verification.randomized_benchmarking as rb -from qiskit.providers.basicaer import QasmSimulatorPy try: from qiskit.compiler import transpile @@ -76,20 +75,10 @@ def setup(self, rb_pattern): length_vector=length_vector, rb_pattern=rb_pattern, seed=self.seed) - self.sim_backend = QasmSimulatorPy() def teardown(self, _): os.environ['QISKIT_IN_PARALLEL'] = 'FALSE' - def time_simulator_transpile(self, __): - transpile(self.circuits, self.sim_backend, - **{TRANSPILER_SEED_KEYWORD: self.seed}) - - def time_simulator_transpile_single_thread(self, __): - os.environ['QISKIT_IN_PARALLEL'] = 'TRUE' - transpile(self.circuits, self.sim_backend, - **{TRANSPILER_SEED_KEYWORD: self.seed}) - def time_ibmq_backend_transpile(self, __): # Run with ibmq_16_melbourne configuration coupling_map = [[1, 0], [1, 2], [2, 3], [4, 3], [4, 10], [5, 4], diff --git a/test/benchmarks/ripple_adder.py b/test/benchmarks/ripple_adder.py index 7fe078bab076..2f931e8fe0e1 100644 --- a/test/benchmarks/ripple_adder.py +++ b/test/benchmarks/ripple_adder.py @@ -18,8 +18,6 @@ from qiskit import transpile from qiskit.transpiler import CouplingMap -from qiskit.providers.basicaer import QasmSimulatorPy - from .utils import build_ripple_adder_circuit @@ -43,17 +41,8 @@ class RippleAdderTranspile: def setup(self, size, _): edge_len = int((2*size + 2)**0.5)+1 self.coupling_map = CouplingMap.from_grid(edge_len, edge_len) - self.sim_backend = QasmSimulatorPy() self.circuit = build_ripple_adder_circuit(size) - def time_transpile_simulator_ripple_adder(self, _, level): - transpile(self.circuit, self.sim_backend, - optimization_level=level) - - def track_depth_transpile_simulator_ripple_adder(self, _, level): - return transpile(self.circuit, self.sim_backend, - optimization_level=level).depth() - def time_transpile_square_grid_ripple_adder(self, _, level): transpile(self.circuit, coupling_map=self.coupling_map, diff --git a/test/benchmarks/transpiler_benchmarks.py b/test/benchmarks/transpiler_benchmarks.py index 6afb92f141f6..8b48471f3f80 100644 --- a/test/benchmarks/transpiler_benchmarks.py +++ b/test/benchmarks/transpiler_benchmarks.py @@ -23,107 +23,55 @@ class TranspilerBenchSuite: def _build_cx_circuit(self): - if self.local_qasm_simulator is None: - qp = qiskit.QuantumProgram() - cx_register = qp.create_quantum_register('qr', 2) - cx_circuit = qp.create_circuit("cx_circuit", [cx_register]) - cx_circuit.h(cx_register[0]) - cx_circuit.h(cx_register[0]) - cx_circuit.cx(cx_register[0], cx_register[1]) - cx_circuit.cx(cx_register[0], cx_register[1]) - cx_circuit.cx(cx_register[0], cx_register[1]) - cx_circuit.cx(cx_register[0], cx_register[1]) - return qp - if self.local_qasm_simulator is not None: - cx_register = qiskit.QuantumRegister(2) - cx_circuit = qiskit.QuantumCircuit(cx_register) - cx_circuit.h(cx_register[0]) - cx_circuit.h(cx_register[0]) - cx_circuit.cx(cx_register[0], cx_register[1]) - cx_circuit.cx(cx_register[0], cx_register[1]) - cx_circuit.cx(cx_register[0], cx_register[1]) - cx_circuit.cx(cx_register[0], cx_register[1]) - return cx_circuit - return None + cx_register = qiskit.QuantumRegister(2) + cx_circuit = qiskit.QuantumCircuit(cx_register) + cx_circuit.h(cx_register[0]) + cx_circuit.h(cx_register[0]) + cx_circuit.cx(cx_register[0], cx_register[1]) + cx_circuit.cx(cx_register[0], cx_register[1]) + cx_circuit.cx(cx_register[0], cx_register[1]) + cx_circuit.cx(cx_register[0], cx_register[1]) + return cx_circuit def _build_single_gate_circuit(self): - if self.local_qasm_simulator is None: - qp = qiskit.QuantumProgram() - single_register = qp.create_quantum_register('qr', 1) - single_gate_circuit = qp.create_circuit('single_gate', - [single_register]) - single_gate_circuit.h(single_register[0]) - return qp - if self.local_qasm_simulator is not None: - single_register = qiskit.QuantumRegister(1) - single_gate_circuit = qiskit.QuantumCircuit(single_register) - single_gate_circuit.h(single_register[0]) - return single_gate_circuit - return None + single_register = qiskit.QuantumRegister(1) + single_gate_circuit = qiskit.QuantumCircuit(single_register) + single_gate_circuit.h(single_register[0]) + return single_gate_circuit def setup(self): - version_parts = qiskit.__version__.split('.') - - if version_parts[0] == '0' and int(version_parts[1]) < 5: - self.local_qasm_simulator = None - elif hasattr(qiskit, 'BasicAer'): - self.local_qasm_simulator = qiskit.BasicAer.get_backend( - 'qasm_simulator') - elif hasattr(qiskit, 'get_backend'): - self.local_qasm_simulator = qiskit.get_backend( - 'local_qasm_simulator') - else: - self.local_qasm_simulator = qiskit.BasicAer.get_backend( - "qasm_simulator") - self.has_compile = False - if hasattr(qiskit, 'compile'): - self.has_compile = True self.single_gate_circuit = self._build_single_gate_circuit() self.cx_circuit = self._build_cx_circuit() self.qasm_path = os.path.abspath( os.path.join(os.path.dirname(__file__), 'qasm')) large_qasm_path = os.path.join(self.qasm_path, 'test_eoh_qasm.qasm') + self.large_qasm = qiskit.QuantumCircuit.from_qasm_file(large_qasm_path) + self.coupling_map = [ + [0, 1], [1, 0], [1, 2], [1, 4], [2, 1], [2, 3], [3, 2], [3, 5], + [4, 1], [4, 7], [5, 3], [5, 8], [6, 7], [7, 4], [7, 6], [7, 10], + [8, 5], [8, 9], [8, 11], [9, 8], [10, 7], [10, 12], [11, 8], + [11, 14], [12, 10], [12, 13], [12, 15], [13, 12], [13, 14], + [14, 11], [14, 13], [14, 16], [15, 12], [15, 18], [16, 14], + [16, 19], [17, 18], [18, 15], [18, 17], [18, 21], [19, 16], + [19, 20], [19, 22], [20, 19], [21, 18], [21, 23], [22, 19], + [22, 25], [23, 21], [23, 24], [24, 23], [24, 25], [25, 22], + [25, 24], [25, 26], [26, 25]] + self.basis = ['id', 'rz', 'sx', 'x', 'cx', 'reset'] - if hasattr(qiskit, 'load_qasm_file'): - self.large_qasm = qiskit.load_qasm_file(large_qasm_path) - elif version_parts[0] == '0' and int(version_parts[1]) < 5: - self.large_qasm = qiskit.QuantumProgram() - self.large_qasm.load_qasm_file(large_qasm_path, - name='large_qasm') - else: - self.large_qasm = qiskit.QuantumCircuit.from_qasm_file( - large_qasm_path) - - def time_single_gate_transpile(self): - if self.local_qasm_simulator is None: - self.single_gate_circuit.compile('single_gate') - else: - if self.has_compile: - qiskit.compile(self.single_gate_circuit, - self.local_qasm_simulator) - else: - circ = qiskit.compiler.transpile(self.single_gate_circuit, - self.local_qasm_simulator) - qiskit.compiler.assemble(circ, self.local_qasm_simulator) + def time_single_gate_compile(self): + circ = qiskit.compiler.transpile(self.single_gate_circuit, + coupling_map=self.coupling_map, + basis_gates=self.basis) + qiskit.compiler.assemble(circ) - def time_cx_transpile(self): - if self.local_qasm_simulator is None: - self.cx_circuit.compile('cx_circuit') - else: - if self.has_compile: - qiskit.compile(self.cx_circuit, self.local_qasm_simulator) - else: - circ = qiskit.compiler.transpile(self.cx_circuit, - self.local_qasm_simulator) - qiskit.compiler.assemble(circ, self.local_qasm_simulator) + def time_cx_compile(self): + circ = qiskit.compiler.transpile(self.cx_circuit, + coupling_map=self.coupling_map, + basis_gates=self.basis) + qiskit.compiler.assemble(circ) - def time_transpile_from_large_qasm(self): - if self.local_qasm_simulator is None: - self.large_qasm.compile('large_qasm') - else: - if self.has_compile: - qiskit.compile(self.large_qasm, self.local_qasm_simulator) - else: - circ = qiskit.compiler.transpile(self.large_qasm, - self.local_qasm_simulator) - qiskit.compiler.assemble(circ, self.local_qasm_simulator) + def time_compile_from_large_qasm(self): + circ = qiskit.compiler.transpile(self.large_qasm, + coupling_map=self.coupling_map, + basis_gates=self.basis) + qiskit.compiler.assemble(circ) From 87c1530da0ce7cb8885d193ede19f8c5b6d040b5 Mon Sep 17 00:00:00 2001 From: Eli Arbel <46826214+eliarbel@users.noreply.github.com> Date: Wed, 7 Jul 2021 18:13:08 +0300 Subject: [PATCH 43/61] Add quantum_info benchmarks - Clifford & Cnot-Dihedral (Qiskit/qiskit-metapackage#1280) * Adding some basic Clifford and Cnot-Dihedral benchmarks * after linting * removing the custom timeouts, the default is good enough --- test/benchmarks/quantum_info.py | 87 +++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 test/benchmarks/quantum_info.py diff --git a/test/benchmarks/quantum_info.py b/test/benchmarks/quantum_info.py new file mode 100644 index 000000000000..ef18a1899fc5 --- /dev/null +++ b/test/benchmarks/quantum_info.py @@ -0,0 +1,87 @@ +# -*- coding: utf-8 -* + +# This code is part of Qiskit. +# +# (C) Copyright IBM 2021. +# +# This code is licensed under the Apache License, Version 2.0. You may +# obtain a copy of this license in the LICENSE.txt file in the root directory +# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. +# +# Any modifications or derivative works of this code must retain this +# copyright notice, and modified files need to carry a notice indicating +# that they have been altered from the originals. + +# pylint: disable=missing-docstring,invalid-name,no-member +# pylint: disable=attribute-defined-outside-init + +from qiskit.quantum_info import random_clifford, Clifford, decompose_clifford +from qiskit.quantum_info import random_cnotdihedral, CNOTDihedral +import numpy as np + + +class RandomCliffordBench: + params = ['1,3000', '2,2500', '3,2000', '4,1500', '5,1000', '6,700'] + param_names = ['nqubits,length'] + + def time_random_clifford(self, nqubits_length): + (nqubits, length) = map(int, nqubits_length.split(',')) + for _ in range(length): + random_clifford(nqubits) + + +class CliffordComposeBench: + params = ['1,7000', '2,5000', '3,5000', '4,2500', '5,2000'] + param_names = ['nqubits,length'] + + def setup(self, nqubits_length): + (nqubits, length) = map(int, nqubits_length.split(',')) + self.random_clifford = \ + [random_clifford(nqubits) for _ in range(length)] + + def time_compose(self, nqubits_length): + (nqubits, length) = map(int, nqubits_length.split(',')) + clifford = Clifford(np.eye(2 * nqubits)) + for i in range(length): + clifford.compose(self.random_clifford[i]) + + +class CliffordDecomposeBench: + params = ['1,1000', '2,500', '3,100', '4,50', '5,10'] + param_names = ['nqubits,length'] + + def setup(self, nqubits_length): + (nqubits, length) = map(int, nqubits_length.split(',')) + self.random_clifford = \ + [random_clifford(nqubits) for _ in range(length)] + + def time_decompose(self, nqubits_length): + length = int(nqubits_length.split(',')[1]) + for i in range(length): + decompose_clifford(self.random_clifford[i]) + + +class RandomCnotDihedralBench: + params = ['1,2000', '2,1500', '3,1200', '4,1000', '5,800', '6,700'] + param_names = ['nqubits,length'] + + def time_random_cnotdihedral(self, nqubits_length): + (nqubits, length) = map(int, nqubits_length.split(',')) + for _ in range(length): + random_cnotdihedral(nqubits) + + +class CnotDihedralComposeBench: + params = ['1,1500', '2,400', '3,100', '4,40', '5,10'] + param_names = ['nqubits,length'] + + def setup(self, nqubits_length): + (nqubits, length) = map(int, nqubits_length.split(',')) + self.random_cnotdihedral = \ + [random_cnotdihedral(nqubits) for _ in range(length)] + + def time_compose(self, nqubits_length): + (nqubits, length) = map(int, nqubits_length.split(',')) + cxdihedral = CNOTDihedral(num_qubits=nqubits) + for i in range(length): + cxdihedral.compose(self.random_cnotdihedral[i]) From 1d0815fc52e9566f3bbf825ee84cc98e24a03cb2 Mon Sep 17 00:00:00 2001 From: jessica-angel7 <75977100+jessica-angel7@users.noreply.github.com> Date: Wed, 22 Sep 2021 19:17:28 +0530 Subject: [PATCH 44/61] Update in Randomized_Benchmarking. Fix for Bug raised in issue Qiskit/qiskit-metapackage#1298. (Qiskit/qiskit-metapackage#1324) * Update randomized_benchmarking.py * Update randomized_benchmarking.py * Update randomized_benchmarking.py * Update randomized_benchmarking.py * Update randomized_benchmarking.py * Update randomized_benchmarking.py * Update randomized_benchmarking.py Co-authored-by: Kevin Krsulich --- test/benchmarks/randomized_benchmarking.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/test/benchmarks/randomized_benchmarking.py b/test/benchmarks/randomized_benchmarking.py index c312a22f708a..dcb21d9d3273 100644 --- a/test/benchmarks/randomized_benchmarking.py +++ b/test/benchmarks/randomized_benchmarking.py @@ -62,9 +62,13 @@ def build_rb_circuit(nseeds=1, length_vector=None, class RandomizedBenchmarkingBenchmark: # parameters for RB (1&2 qubits): - params = ([[[0]], [[0, 1]], [[0, 2], [1]]],) + params = ([ + [[0]], # Single qubit RB + [[0, 1]], # Two qubit RB + [[0, 1], [2]] # Simultaneous RB + ],) param_names = ['rb_pattern'] - version = '0.2.0' + version = '0.6.0' timeout = 600 def setup(self, rb_pattern): @@ -88,7 +92,7 @@ def time_ibmq_backend_transpile(self, __): transpile(self.circuits, basis_gates=['u1', 'u2', 'u3', 'cx', 'id'], - coupling_map=coupling_map, + coupling_map=coupling_map, optimization_level=0, **{TRANSPILER_SEED_KEYWORD: self.seed}) def time_ibmq_backend_transpile_single_thread(self, __): @@ -102,5 +106,5 @@ def time_ibmq_backend_transpile_single_thread(self, __): transpile(self.circuits, basis_gates=['u1', 'u2', 'u3', 'cx', 'id'], - coupling_map=coupling_map, + coupling_map=coupling_map, optimization_level=0, **{TRANSPILER_SEED_KEYWORD: self.seed}) From ee0fe3f06bcddd4f63d97d390ad43d7aa5e5d215 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Wed, 22 Sep 2021 10:59:36 -0400 Subject: [PATCH 45/61] Actually bump ignis version in benchmarks (Qiskit/qiskit-metapackage#1336) In Qiskit/qiskit-metapackage#1324 as part of the updates to the randomized benchmarking benchmarks the version string in the benchmark class was bumped to the latest ignis version to do 2 things, first indicate the benchmark code had significantly changed to differentiate new results from old ones and second to update the ignis version to the latest release in the benchmarks. However on the second point the ignis version installed was never actually updated. This commit fixes this oversight and updates the ignis version in the asv config and also updates the state tomography benchmark version to indicate that we're running with ignis 0.6.0 now instead of 0.2.0 that we had been using previously. --- test/benchmarks/state_tomography.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/benchmarks/state_tomography.py b/test/benchmarks/state_tomography.py index 87961b15daa8..7095a9b74b72 100644 --- a/test/benchmarks/state_tomography.py +++ b/test/benchmarks/state_tomography.py @@ -24,7 +24,7 @@ class StateTomographyBench: params = [2, 3, 4, 5] param_names = ['n_qubits'] - version = '0.2.0' + version = '0.6.0' timeout = 120.0 def setup(self, _): From 404e3c7715a4b1ba00155a42d43595848e0afd55 Mon Sep 17 00:00:00 2001 From: Eli Arbel <46826214+eliarbel@users.noreply.github.com> Date: Sat, 9 Oct 2021 00:19:28 +0300 Subject: [PATCH 46/61] Adding Pauli benchamrks (Qiskit/qiskit-metapackage#1317) Benchmarking various Pauli & PauliList related methods * Adding Pauli benchamrks * Tuning benchmark length to achieve ~1s run-time * lintifyin * Adding PauliList benchmarks * Sweeping over number of qubits * Adding SparsePauliOp benchmark * Exercising code that uses retworkx (in PauliList) * * Splitting benchmarck to cover a unique method each * using setup * removing iteration loops --- test/benchmarks/quantum_info.py | 119 +++++++++++++++++++++++++++++++- 1 file changed, 118 insertions(+), 1 deletion(-) diff --git a/test/benchmarks/quantum_info.py b/test/benchmarks/quantum_info.py index ef18a1899fc5..8a859353d464 100644 --- a/test/benchmarks/quantum_info.py +++ b/test/benchmarks/quantum_info.py @@ -15,7 +15,10 @@ # pylint: disable=missing-docstring,invalid-name,no-member # pylint: disable=attribute-defined-outside-init -from qiskit.quantum_info import random_clifford, Clifford, decompose_clifford +import random +from qiskit.quantum_info import random_clifford, Clifford, \ + decompose_clifford, random_pauli, SparsePauliOp +from qiskit.quantum_info.operators.symplectic.random import random_pauli_list from qiskit.quantum_info import random_cnotdihedral, CNOTDihedral import numpy as np @@ -85,3 +88,117 @@ def time_compose(self, nqubits_length): cxdihedral = CNOTDihedral(num_qubits=nqubits) for i in range(length): cxdihedral.compose(self.random_cnotdihedral[i]) + + +class PauliBench: + params = [100, 200, 300, 400, 500] + param_names = ["num_qubits"] + + def setup(self, num_qubits): + self.p1 = random_pauli(num_qubits, True) + self.p2 = random_pauli(num_qubits, True) + + def time_compose(self, _): + self.p1.compose(self.p2) + + def time_evolve(self, _): + self.p1.evolve(self.p2) # by another Pauli, so by composition + + def time_commutes(self, _): + self.p1.commutes(self.p2) + + def time_to_instruction(self, _): + self.p1.to_instruction() + + def time_to_label(self, _): + self.p1.to_label() + + def time_evolve_by_clifford(self, num_qubits): + c1 = random_clifford(num_qubits) + + self.p1.evolve(c1) + time_evolve_by_clifford.params = [10] + + +class PauliListBench: + params = [[100, 200, 300, 400, 500], [500]] + param_names = ["num_qubits", "length"] + + def setup(self, num_qubits, length): + self.pl1 = random_pauli_list(num_qubits=num_qubits, size=length, + phase=True) + self.pl2 = random_pauli_list(num_qubits=num_qubits, size=length, + phase=True) + + def time_commutes(self, _, __): + self.pl1.commutes(self.pl2) + + def time_commutes_with_all(self, _, __): + self.pl1.commutes_with_all(self.pl2) + + def time_argsort(self, _, __): + self.pl1.argsort() + + def time_compose(self, _, __): + self.pl1.compose(self.pl2) + + def time_group_qubit_wise_commuting(self, _, __): + self.pl1.group_qubit_wise_commuting() # exercise retworkx-based code + + def time_evolve_by_clifford(self, num_qubits, __): + c1 = random_clifford(num_qubits) + self.pl1.evolve(c1) + time_evolve_by_clifford.params = [[20], [100]] + + +class PauliListQargsBench: + params = [[100, 200, 300, 400, 500], [500]] + param_names = ["num_qubits", "length"] + + def setup(self, num_qubits, length): + half_qubits = int(num_qubits/2) + + self.pl1 = random_pauli_list(num_qubits=num_qubits, size=length, + phase=True) + self.pl2 = random_pauli_list(num_qubits=half_qubits, size=length, + phase=True) + self.qargs = [random.randint(0, num_qubits - 1) + for _ in range(half_qubits)] + + def time_commutes_with_qargs(self, _, __): + self.pl1.commutes(self.pl2, self.qargs) + + def time_compose_with_qargs(self, _, __): + self.pl1.compose(self.pl2, self.qargs) + + +class SparsePauliOpBench: + params = [[50, 100, 150, 200], [100]] + param_names = ["num_qubits", "length"] + + def setup(self, num_qubits, length): + self.p1 = SparsePauliOp( + random_pauli_list(num_qubits=num_qubits, size=length, phase=True)) + self.p2 = SparsePauliOp( + random_pauli_list(num_qubits=num_qubits, size=length, phase=True)) + + def time_compose(self, _, __): + self.p1.compose(self.p2) + + def time_simplify(self, _, __): + self.p1.simplify() + + def time_tensor(self, _, __): + self.p1.tensor(self.p2) + + def time_to_list(self, _, __): + self.p1.to_list() + time_to_list.params = [[2, 4, 6, 8, 10], [50]] + + def time_to_operator(self, _, __): + self.p1.to_operator() + time_to_operator.params = [[2, 4, 6, 8, 10], [50]] + + def time_to_matrix(self, _, __): + self.p1.to_matrix() + time_to_matrix.params = [[2, 4, 6, 8, 10], [50]] From 8229c875317703539da4e687f3ea9cf2a3f10df4 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Thu, 14 Oct 2021 17:35:43 -0400 Subject: [PATCH 47/61] Drop track_* passes benchmarks and fix cxdirection benchmark (Qiskit/qiskit-metapackage#1345) * Drop track_* passes benchmarks and fix cxdirection benchmark In preparation for adding benchmarks for additional benchmarks for new passes this commit does some house keeping on the existing passes benchmarks. Primarily it removes the track_* passes which were used to measure the depth and cnot count of output from various passes. But in practice these provided little value at the cost of multiplying our runtime. By removing them we open up additional time for more useful benchmarks. At the same time this fixes the cxdirection benchmarks which didn't work because the pass expects to run on a routed circuit and we were only passing a circuit that had run layout. * Split routed dag benchmarks to separate class --- test/benchmarks/mapping_passes.py | 96 +++++++++++++++---------------- test/benchmarks/passes.py | 37 ------------ 2 files changed, 47 insertions(+), 86 deletions(-) diff --git a/test/benchmarks/mapping_passes.py b/test/benchmarks/mapping_passes.py index d07734ce537e..55bed7ffc00b 100644 --- a/test/benchmarks/mapping_passes.py +++ b/test/benchmarks/mapping_passes.py @@ -68,47 +68,11 @@ def time_stochastic_swap(self, _, __): swap.property_set['layout'] = self.layout swap.run(self.dag) - def track_stochastic_swap_depth(self, _, __): - swap = StochasticSwap(self.coupling_map, seed=42) - swap.property_set['layout'] = self.layout - return swap.run(self.dag).depth() - - def track_stochastic_swap_swap_count(self, _, __): - swap = StochasticSwap(self.coupling_map, seed=42) - swap.property_set['layout'] = self.layout - return swap.run(self.dag).count_ops().get('swap') - - # Disable lookahead swap benchmarks due to timeout. - # def time_lookahead_swap(self, _, __): - # swap = LookaheadSwap(self.coupling_map) - # swap.property_set['layout'] = self.layout - # swap.run(self.dag) - - # def track_lookahead_swap_depth(self, _, __): - # swap = LookaheadSwap(self.coupling_map) - # swap.property_set['layout'] = self.layout - # return swap.run(self.dag).depth() - - # def track_lookahead_swap_swap_count(self, _, __): - # swap = LookaheadSwap(self.coupling_map) - # swap.property_set['layout'] = self.layout - # return swap.run(self.dag).depth().count_ops().get('swap') - def time_basic_swap(self, _, __): swap = BasicSwap(self.coupling_map) swap.property_set['layout'] = self.layout swap.run(self.dag) - def track_basic_swap_depth(self, _, __): - swap = BasicSwap(self.coupling_map) - swap.property_set['layout'] = self.layout - return swap.run(self.dag).depth() - - def track_basic_swap_swap_count(self, _, __): - swap = BasicSwap(self.coupling_map) - swap.property_set['layout'] = self.layout - return swap.run(self.dag).depth().count_ops().get('swap') - def time_csp_layout(self, _, __): CSPLayout(self.coupling_map, seed=42).run(self.fresh_dag) @@ -120,16 +84,6 @@ def time_layout_2q_distance(self, _, __): layout.property_set['layout'] = self.layout layout.run(self.dag) - def time_cxdirection(self, _, __): - CXDirection(self.coupling_map).run(self.dag) - - def track_cxdirection_depth(self, _, __): - return CXDirection(self.coupling_map).run(self.dag).depth() - - def track_cxdirection_cnot_count(self, _, __): - return CXDirection( - self.coupling_map).run(self.dag).count_ops().get('cx') - def time_apply_layout(self, _, __): layout = ApplyLayout() layout.property_set['layout'] = self.layout @@ -148,9 +102,6 @@ def time_enlarge_with_ancilla(self, _, __): def time_check_map(self, _, __): CheckMap(self.coupling_map).run(self.dag) - def time_check_cx_direction(self, _, __): - CheckCXDirection(self.coupling_map).run(self.dag) - def time_trivial_layout(self, _, __): TrivialLayout(self.coupling_map).run(self.fresh_dag) @@ -159,3 +110,50 @@ def time_set_layout(self, _, __): def time_noise_adaptive_layout(self, _, __): NoiseAdaptiveLayout(self.backend_props).run(self.fresh_dag) + + +class RoutedPassBenchmarks: + params = ([5, 14, 20], + [1024]) + + param_names = ['n_qubits', 'depth'] + timeout = 300 + + def setup(self, n_qubits, depth): + seed = 42 + self.circuit = random_circuit(n_qubits, depth, measure=True, + conditional=True, reset=True, seed=seed, + max_operands=2) + self.fresh_dag = circuit_to_dag(self.circuit) + self.basis_gates = ['u1', 'u2', 'u3', 'cx', 'iid'] + self.cmap = [[0, 1], [1, 0], [1, 2], [1, 6], [2, 1], [2, 3], [3, 2], + [3, 4], [3, 8], [4, 3], [5, 6], [5, 10], [6, 1], [6, 5], + [6, 7], [7, 6], [7, 8], [7, 12], [8, 3], [8, 7], [8, 9], + [9, 8], [9, 14], [10, 5], [10, 11], [11, 10], [11, 12], + [11, 16], [12, 7], [12, 11], [12, 13], [13, 12], [13, 14], + [13, 18], [14, 9], [14, 13], [15, 16], [16, 11], [16, 15], + [16, 17], [17, 16], [17, 18], [18, 13], [18, 17], + [18, 19], [19, 18]] + self.coupling_map = CouplingMap(self.cmap) + + layout_pass = DenseLayout(self.coupling_map) + layout_pass.run(self.fresh_dag) + self.layout = layout_pass.property_set['layout'] + full_ancilla_pass = FullAncillaAllocation(self.coupling_map) + full_ancilla_pass.property_set['layout'] = self.layout + self.full_ancilla_dag = full_ancilla_pass.run(self.fresh_dag) + enlarge_pass = EnlargeWithAncilla() + enlarge_pass.property_set['layout'] = self.layout + self.enlarge_dag = enlarge_pass.run(self.full_ancilla_dag) + apply_pass = ApplyLayout() + apply_pass.property_set['layout'] = self.layout + self.dag = apply_pass.run(self.enlarge_dag) + self.backend_props = fake_singapore.FakeSingapore().properties() + self.routed_dag = StochasticSwap(self.coupling_map, + seed=42).run(self.dag) + + def time_cxdirection(self, _, __): + CXDirection(self.coupling_map).run(self.routed_dag) + + def time_check_cx_direction(self, _, __): + CheckCXDirection(self.coupling_map).run(self.routed_dag) diff --git a/test/benchmarks/passes.py b/test/benchmarks/passes.py index f5a779f353aa..386bdbd3f76e 100644 --- a/test/benchmarks/passes.py +++ b/test/benchmarks/passes.py @@ -44,11 +44,6 @@ def time_consolidate_blocks(self, _, __): _pass.property_set['block_list'] = self.block_list _pass.run(self.dag) - def track_consolidate_blocks_depth(self, _, __): - _pass = ConsolidateBlocks() - _pass.property_set['block_list'] = self.block_list - return _pass.run(self.dag).depth() - class CommutativeAnalysisPassBenchmarks: params = ([5, 14, 20], @@ -73,11 +68,6 @@ def time_commutative_cancellation(self, _, __): _pass.property_set['commutation_set'] = self.commutation_set _pass.run(self.dag) - def track_commutative_cancellation_depth(self, _, __): - _pass = CommutativeCancellation() - _pass.property_set['commutation_set'] = self.commutation_set - return _pass.run(self.dag).depth() - class UnrolledPassBenchmarks: params = ([5, 14, 20], @@ -97,9 +87,6 @@ def setup(self, n_qubits, depth): def time_optimize_1q(self, _, __): Optimize1qGates().run(self.unrolled_dag) - def track_optimize_1q_depth(self, _, __): - return Optimize1qGates().run(self.unrolled_dag).depth() - class PassBenchmarks: params = ([5, 14, 20], @@ -118,9 +105,6 @@ def setup(self, n_qubits, depth): def time_unroller(self, _, __): Unroller(self.basis_gates).run(self.dag) - def track_unroller_depth(self, _, __): - return Unroller(self.basis_gates).run(self.dag).depth() - def time_depth_pass(self, _, __): Depth().run(self.dag) @@ -154,47 +138,26 @@ def time_merge_adjacent_barriers(self, _, __): def time_decompose_pass(self, _, __): Decompose().run(self.dag) - def track_decompose_depth(self, _, __): - return Decompose().run(self.dag).depth() - def time_unroll_3q_or_more(self, _, __): Unroll3qOrMore().run(self.dag) - def track_unroll_3q_or_more_depth(self, _, __): - return Unroll3qOrMore().run(self.dag).depth() - def time_commutation_analysis(self, _, __): CommutationAnalysis().run(self.dag) def time_remove_reset_in_zero_state(self, _, __): RemoveResetInZeroState().run(self.dag) - def track_remove_reset_in_zero_state(self, _, __): - return RemoveResetInZeroState().run(self.dag).depth() - def time_collect_2q_blocks(self, _, __): Collect2qBlocks().run(self.dag) def time_optimize_swap_before_measure(self, _, __): OptimizeSwapBeforeMeasure().run(self.dag) - def track_optimize_swap_before_measure_depth(self, _, __): - return OptimizeSwapBeforeMeasure().run(self.dag).depth() - def time_barrier_before_final_measurements(self, _, __): BarrierBeforeFinalMeasurements().run(self.dag) - def track_barrier_before_final_measurement(self, _, __): - BarrierBeforeFinalMeasurements().run(self.dag).depth() - def time_remove_diagonal_gates_before_measurement(self, _, __): RemoveDiagonalGatesBeforeMeasure().run(self.dag) - def track_remove_diagonal_gates_before_measurement(self, _, __): - return RemoveDiagonalGatesBeforeMeasure().run(self.dag).depth() - def time_remove_final_measurements(self, _, __): RemoveFinalMeasurements().run(self.dag) - - def track_remove_final_measurements_depth(self, _, __): - return RemoveFinalMeasurements().run(self.dag).depth() From 543f5ea2faa1555f0861fa96d1fe7dddd8e4376e Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Mon, 18 Oct 2021 18:43:37 -0400 Subject: [PATCH 48/61] Add benchmarks for missing passes (Qiskit/qiskit-metapackage#1346) * Add benchmarks for missing passes This commit adds runtime benchmarks to the passes and mapping_passes benchmark modules to measure additional transpiler passes in isolation that we didn't have coverage for previously. Primarily of importance here are the basis translator and the optimize 1q decomposition passes which are in the preset pass managers but didn't have standalone benchmark coverage. One pass excluded here is the TemplateOptimization pass which would have been good to add to the benchmark but it is exceedingly slow and took well more than 5 min per iteration. * Update test/benchmarks/mapping_passes.py * Add collect multi q block benchmark * Update test/benchmarks/passes.py Co-authored-by: Jake Lishman * Update test/benchmarks/passes.py Co-authored-by: Kevin Krsulich Co-authored-by: Jake Lishman Co-authored-by: Kevin Krsulich --- test/benchmarks/mapping_passes.py | 17 ++++++++++ test/benchmarks/passes.py | 54 ++++++++++++++++++++++++++++++- 2 files changed, 70 insertions(+), 1 deletion(-) diff --git a/test/benchmarks/mapping_passes.py b/test/benchmarks/mapping_passes.py index 55bed7ffc00b..b33ed36915d8 100644 --- a/test/benchmarks/mapping_passes.py +++ b/test/benchmarks/mapping_passes.py @@ -68,6 +68,11 @@ def time_stochastic_swap(self, _, __): swap.property_set['layout'] = self.layout swap.run(self.dag) + def time_sabre_swap(self, _, __): + swap = SabreSwap(self.coupling_map, seed=42) + swap.property_set['layout'] = self.layout + swap.run(self.dag) + def time_basic_swap(self, _, __): swap = BasicSwap(self.coupling_map) swap.property_set['layout'] = self.layout @@ -111,6 +116,9 @@ def time_set_layout(self, _, __): def time_noise_adaptive_layout(self, _, __): NoiseAdaptiveLayout(self.backend_props).run(self.fresh_dag) + def time_sabre_layout(self, _, __): + SabreLayout(self.coupling_map, seed=42).run(self.fresh_dag) + class RoutedPassBenchmarks: params = ([5, 14, 20], @@ -157,3 +165,12 @@ def time_cxdirection(self, _, __): def time_check_cx_direction(self, _, __): CheckCXDirection(self.coupling_map).run(self.routed_dag) + + def time_gate_direction(self, _, __): + GateDirection(self.coupling_map).run(self.routed_dag) + + def time_check_gate_direction(self, _, __): + CheckGateDirection(self.coupling_map).run(self.routed_dag) + + def time_check_map(self, _, __): + CheckMap(self.coupling_map).run(self.routed_dag) diff --git a/test/benchmarks/passes.py b/test/benchmarks/passes.py index 386bdbd3f76e..deb1ba3c2be6 100644 --- a/test/benchmarks/passes.py +++ b/test/benchmarks/passes.py @@ -14,9 +14,10 @@ # pylint: disable=no-member,invalid-name,missing-docstring,no-name-in-module # pylint: disable=attribute-defined-outside-init,unsubscriptable-object -# pylint: disable=unused-wildcard-import,wildcard-import +# pylint: disable=unused-wildcard-import,wildcard-import,undefined-variable +from qiskit.circuit.equivalence_library import SessionEquivalenceLibrary as SEL from qiskit.transpiler.passes import * from qiskit.converters import circuit_to_dag @@ -88,6 +89,31 @@ def time_optimize_1q(self, _, __): Optimize1qGates().run(self.unrolled_dag) +class MultipleBasisPassBenchmarks: + params = ([5, 14, 20], + [1024], + [['u', 'cx', 'id'], ['rx', 'ry', 'rz', 'r', 'rxx', 'id'], + ['rz', 'x', 'sx', 'cx', 'id']]) + + param_names = ['n_qubits', 'depth', 'basis_gates'] + timeout = 300 + + def setup(self, n_qubits, depth, basis_gates): + seed = 42 + self.circuit = random_circuit(n_qubits, depth, measure=True, seed=seed) + self.dag = circuit_to_dag(self.circuit) + self.basis_gates = basis_gates + + def time_optimize_1q_decompose(self, _, __, ___): + Optimize1qGatesDecomposition(self.basis_gates).run(self.dag) + + def time_optimize_1q_commutation(self, _, __, ___): + Optimize1qGatesSimpleCommutation(self.basis_gates).run(self.dag) + + def time_basis_translator(self, _, __, ___): + BasisTranslator(SEL, self.basis_gates).run(self.dag) + + class PassBenchmarks: params = ([5, 14, 20], [1024]) @@ -161,3 +187,29 @@ def time_remove_diagonal_gates_before_measurement(self, _, __): def time_remove_final_measurements(self, _, __): RemoveFinalMeasurements().run(self.dag) + + def time_contains_instruction(self, _, __): + ContainsInstruction('cx').run(self.dag) + + def time_gates_in_basis(self, _, __): + GatesInBasis(self.basis_gates).run(self.dag) + + def time_remove_barriers(self, _, __): + RemoveBarriers().run(self.dag) + + +class MultiQBlockPassBenchmarks: + params = ([5, 14, 20], + [1024], [1, 2, 3, 4, 5]) + + param_names = ['n_qubits', 'depth', 'max_block_size'] + timeout = 300 + + def setup(self, n_qubits, depth, _): + seed = 42 + self.circuit = random_circuit(n_qubits, depth, measure=True, + conditional=True, reset=True, seed=seed) + self.dag = circuit_to_dag(self.circuit) + + def time_collect_multiq_block(self, _, __, max_block_size): + CollectMultiQBlocks(max_block_size).run(self.dag) From a60e7149f1b876cc8df21d67c58d265c0dfafba1 Mon Sep 17 00:00:00 2001 From: Takashi Imamichi <31178928+t-imamichi@users.noreply.github.com> Date: Thu, 21 Oct 2021 00:37:59 +0900 Subject: [PATCH 49/61] Add a benchmark of `SparsePauliOp.__add__` (Qiskit/qiskit-metapackage#1348) Add a benchmark of SparsePauliOp._add via SparsePauliOp.__add__. This method is an important building block of various algorithms (I'm working on the qubit mapper of Qiskit nature). I'm working on the performance improvement of this method. I hope the improvement will be visible. Qiskit/qiskit-terra#7138 Qiskit/qiskit-nature#397 * Add a benchmark of SparsePauliOp.add * use `__add__` * tweak param list --- test/benchmarks/quantum_info.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/benchmarks/quantum_info.py b/test/benchmarks/quantum_info.py index 8a859353d464..d7d653fbcf69 100644 --- a/test/benchmarks/quantum_info.py +++ b/test/benchmarks/quantum_info.py @@ -191,6 +191,10 @@ def time_simplify(self, _, __): def time_tensor(self, _, __): self.p1.tensor(self.p2) + def time_add(self, _, __): + _ = self.p1 + self.p2 + time_add.params = [[50, 100, 150, 200], [10000]] + def time_to_list(self, _, __): self.p1.to_list() time_to_list.params = [[2, 4, 6, 8, 10], [50]] From 3419f98010602b964bee8a17ba826efa29b924ef Mon Sep 17 00:00:00 2001 From: Jake Lishman Date: Tue, 25 Jan 2022 18:28:09 +0000 Subject: [PATCH 50/61] Add seed to all transpiler benchmarks (Qiskit/qiskit-metapackage#1405) Fill in a missing seed for all benchmarks that need one. Fixes Qiskit/qiskit-metapackage#1404 --- test/benchmarks/qft.py | 3 ++- test/benchmarks/quantum_volume.py | 3 ++- test/benchmarks/ripple_adder.py | 6 ++++-- test/benchmarks/transpiler_benchmarks.py | 9 ++++++--- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/test/benchmarks/qft.py b/test/benchmarks/qft.py index a2af99dded18..1bf0ab289e3e 100644 --- a/test/benchmarks/qft.py +++ b/test/benchmarks/qft.py @@ -54,4 +54,5 @@ def time_ibmq_backend_transpile(self, _): [13, 12]] transpile(self.circuit, basis_gates=['u1', 'u2', 'u3', 'cx', 'id'], - coupling_map=coupling_map) + coupling_map=coupling_map, + seed_transpiler=20220125) diff --git a/test/benchmarks/quantum_volume.py b/test/benchmarks/quantum_volume.py index 951905f471bc..e3b964df837e 100644 --- a/test/benchmarks/quantum_volume.py +++ b/test/benchmarks/quantum_volume.py @@ -52,4 +52,5 @@ def time_ibmq_backend_transpile(self, _, translation): transpile(self.circuit, basis_gates=self.basis, coupling_map=self.coupling_map, - translation_method=translation) + translation_method=translation, + seed_transpiler=20220125) diff --git a/test/benchmarks/ripple_adder.py b/test/benchmarks/ripple_adder.py index 2f931e8fe0e1..ddc6a4e2b727 100644 --- a/test/benchmarks/ripple_adder.py +++ b/test/benchmarks/ripple_adder.py @@ -47,10 +47,12 @@ def time_transpile_square_grid_ripple_adder(self, _, level): transpile(self.circuit, coupling_map=self.coupling_map, basis_gates=['u1', 'u2', 'u3', 'cx', 'id'], - optimization_level=level) + optimization_level=level, + seed_transpiler=20220125) def track_depth_transpile_square_grid_ripple_adder(self, _, level): return transpile(self.circuit, coupling_map=self.coupling_map, basis_gates=['u1', 'u2', 'u3', 'cx', 'id'], - optimization_level=level).depth() + optimization_level=level, + seed_transpiler=20220125).depth() diff --git a/test/benchmarks/transpiler_benchmarks.py b/test/benchmarks/transpiler_benchmarks.py index 8b48471f3f80..f05b0a1d2db4 100644 --- a/test/benchmarks/transpiler_benchmarks.py +++ b/test/benchmarks/transpiler_benchmarks.py @@ -61,17 +61,20 @@ def setup(self): def time_single_gate_compile(self): circ = qiskit.compiler.transpile(self.single_gate_circuit, coupling_map=self.coupling_map, - basis_gates=self.basis) + basis_gates=self.basis, + seed_transpiler=20220125) qiskit.compiler.assemble(circ) def time_cx_compile(self): circ = qiskit.compiler.transpile(self.cx_circuit, coupling_map=self.coupling_map, - basis_gates=self.basis) + basis_gates=self.basis, + seed_transpiler=20220125) qiskit.compiler.assemble(circ) def time_compile_from_large_qasm(self): circ = qiskit.compiler.transpile(self.large_qasm, coupling_map=self.coupling_map, - basis_gates=self.basis) + basis_gates=self.basis, + seed_transpiler=20220125) qiskit.compiler.assemble(circ) From f24bbe878106048826a5e18752133fd5b6a8db59 Mon Sep 17 00:00:00 2001 From: Toshinari Itoko <15028342+itoko@users.noreply.github.com> Date: Sat, 26 Feb 2022 02:17:47 +0900 Subject: [PATCH 51/61] Add benchmarks for circuit scheduling (Qiskit/qiskit-metapackage#1421) Add benchmarks to track the time performance of circuit scheduling Add four tests, which benchmark TimeUnitConversion, ALAPSchedule, ASAPSchedule and DynamicalDecoupling passes. It would be a good time to start benchmarking those as rework on circuit scheduling passes is about to start. * Add benchmarks for scheduling passes * lint * Add one more bench for circuit scheduling * Add overall transpilation time bench with scheduling * Revert "Add overall transpilation time bench with scheduling" This reverts commit fdba349999548ecd1fb4cc9a1e1a67802ecd9008. * Remove wild-card import --- test/benchmarks/scheduling_passes.py | 91 ++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 test/benchmarks/scheduling_passes.py diff --git a/test/benchmarks/scheduling_passes.py b/test/benchmarks/scheduling_passes.py new file mode 100644 index 000000000000..4f900066ecc6 --- /dev/null +++ b/test/benchmarks/scheduling_passes.py @@ -0,0 +1,91 @@ +# -*- coding: utf-8 -*- + +# This code is part of Qiskit. +# +# (C) Copyright IBM 2021. +# +# This code is licensed under the Apache License, Version 2.0. You may +# obtain a copy of this license in the LICENSE.txt file in the root directory +# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. +# +# Any modifications or derivative works of this code must retain this +# copyright notice, and modified files need to carry a notice indicating +# that they have been altered from the originals. + +# pylint: disable=invalid-name,missing-docstring +# pylint: disable=attribute-defined-outside-init + +from qiskit import transpile +from qiskit.circuit.library.standard_gates import XGate +from qiskit.transpiler import CouplingMap +from qiskit.transpiler import InstructionDurations +from qiskit.transpiler.passes import ( + TimeUnitConversion, + ASAPSchedule, + ALAPSchedule, + DynamicalDecoupling, +) +from qiskit.converters import circuit_to_dag + +from .utils import random_circuit + + +class SchedulingPassBenchmarks: + + params = ([5, 10, 20], + [500, 1000]) + param_names = ['n_qubits', 'depth'] + timeout = 300 + + def setup(self, n_qubits, depth): + seed = 42 + self.circuit = random_circuit(n_qubits, depth, measure=True, + conditional=True, reset=True, seed=seed, + max_operands=2) + self.basis_gates = ['rz', 'sx', 'x', 'cx', 'id', 'reset'] + self.cmap = [[0, 1], [1, 0], [1, 2], [1, 6], [2, 1], [2, 3], [3, 2], + [3, 4], [3, 8], [4, 3], [5, 6], [5, 10], [6, 1], [6, 5], + [6, 7], [7, 6], [7, 8], [7, 12], [8, 3], [8, 7], [8, 9], + [9, 8], [9, 14], [10, 5], [10, 11], [11, 10], [11, 12], + [11, 16], [12, 7], [12, 11], [12, 13], [13, 12], [13, 14], + [13, 18], [14, 9], [14, 13], [15, 16], [16, 11], [16, 15], + [16, 17], [17, 16], [17, 18], [18, 13], [18, 17], + [18, 19], [19, 18]] + self.coupling_map = CouplingMap(self.cmap) + self.transpiled_circuit = transpile(self.circuit, + basis_gates=self.basis_gates, + coupling_map=self.coupling_map, + optimization_level=1) + self.dag = circuit_to_dag(self.transpiled_circuit) + self.durations = InstructionDurations([ + ("rz", None, 0), + ("id", None, 160), + ("sx", None, 160), + ("x", None, 160), + ("cx", None, 800), + ("measure", None, 3200), + ("reset", None, 3600), + ], dt=1e-9) + self.timed_dag = TimeUnitConversion(self.durations).run(self.dag) + _pass = ALAPSchedule(self.durations) + _pass.property_set['time_unit'] = "dt" + self.scheduled_dag = _pass.run(self.timed_dag) + + def time_time_unit_conversion_pass(self, _, __): + TimeUnitConversion(self.durations).run(self.dag) + + def time_alap_schedule_pass(self, _, __): + _pass = ALAPSchedule(self.durations) + _pass.property_set['time_unit'] = "dt" + _pass.run(self.timed_dag) + + def time_asap_schedule_pass(self, _, __): + _pass = ASAPSchedule(self.durations) + _pass.property_set['time_unit'] = "dt" + _pass.run(self.timed_dag) + + def time_dynamical_decoupling_pass(self, _, __): + DynamicalDecoupling( + self.durations, + dd_sequence=[XGate(), XGate()] + ).run(self.scheduled_dag) From 31a1882b234c981e2285b512658a396cd96d0ab6 Mon Sep 17 00:00:00 2001 From: Toshinari Itoko <15028342+itoko@users.noreply.github.com> Date: Fri, 11 Mar 2022 23:16:27 +0900 Subject: [PATCH 52/61] Add overall transpilation time bench with scheduling (Qiskit/qiskit-metapackage#1441) Add a benchmark to track the overall time performance of circuit scheduling, which would be near to that end users actually experience when scheduling. Follow-up PR of Qiskit/qiskit-metapackage#1421. As suggested in the original PR, optimization level 0 and 1 are added so that it would not take so much time while covering the places where people are doing scheduling. * Add overall transpilation time bench with scheduling * Improve a bit --- test/benchmarks/transpiler_levels.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/benchmarks/transpiler_levels.py b/test/benchmarks/transpiler_levels.py index 67b6fde93d9c..595521c88506 100644 --- a/test/benchmarks/transpiler_levels.py +++ b/test/benchmarks/transpiler_levels.py @@ -19,6 +19,7 @@ from qiskit.compiler import transpile from qiskit import QuantumCircuit +from qiskit.transpiler import InstructionDurations from .backends.fake_melbourne import FakeMelbourne from .utils import build_qv_model_circuit @@ -155,6 +156,14 @@ def setup(self, _): large_qasm_path = os.path.join(self.qasm_path, 'test_eoh_qasm.qasm') self.large_qasm = QuantumCircuit.from_qasm_file(large_qasm_path) self.melbourne = FakeMelbourne() + self.durations = InstructionDurations([ + ("u1", None, 0), + ("id", None, 160), + ("u2", None, 160), + ("u3", None, 320), + ("cx", None, 800), + ("measure", None, 3200), + ], dt=1e-9) def time_quantum_volume_transpile_50_x_20(self, transpiler_level): transpile(self.qv_50_x_20, basis_gates=self.basis_gates, @@ -197,3 +206,12 @@ def time_transpile_qv_14_x_14(self, transpiler_level): def track_depth_transpile_qv_14_x_14(self, transpiler_level): return transpile(self.qv_14_x_14, self.melbourne, seed_transpiler=0, optimization_level=transpiler_level).depth() + + def time_schedule_qv_14_x_14(self, transpiler_level): + transpile(self.qv_14_x_14, self.melbourne, seed_transpiler=0, + optimization_level=transpiler_level, + scheduling_method="alap", + instruction_durations=self.durations) + + # limit optimization levels to reduce time + time_schedule_qv_14_x_14.params = [0, 1] From 61eaf36bead59e4e81da1346f7bea61c136f5d17 Mon Sep 17 00:00:00 2001 From: Jake Lishman Date: Thu, 21 Apr 2022 18:54:56 -0400 Subject: [PATCH 53/61] Use Terra's FakeBackend in benchmarks (Qiskit/qiskit-metapackage#1480) Originally the benchmark suite created its own fake backends to avoid noise if Terra were to add new snapshots. The current old backends use `BaseBackend` and `BaseJob`, which is the legacy interface that has just been removed from mainline Terra, causing the benchmark suite to fail to import. The three fake backends in use are all either decommissioned machines that will have no further updates, or a dummy machine not based on real hardware (and so should not need to be updated). Since it's unlikely that noise will come into the benchmarks from Terra now, it's suitable just to use the Terra-provided ones. --- test/benchmarks/backends/__init__.py | 0 test/benchmarks/backends/fake_backend.py | 110 ------- test/benchmarks/backends/fake_job.py | 86 ----- test/benchmarks/backends/fake_melbourne.py | 64 ---- test/benchmarks/backends/fake_openpulse.py | 305 ------------------ test/benchmarks/backends/fake_singapore.py | 73 ----- test/benchmarks/backends/props_melbourne.json | 1 - test/benchmarks/backends/props_singapore.json | 1 - test/benchmarks/mapping_passes.py | 6 +- .../schedule_to_instruction_conversion.py | 2 +- test/benchmarks/transpiler_levels.py | 2 +- 11 files changed, 5 insertions(+), 645 deletions(-) delete mode 100644 test/benchmarks/backends/__init__.py delete mode 100644 test/benchmarks/backends/fake_backend.py delete mode 100644 test/benchmarks/backends/fake_job.py delete mode 100644 test/benchmarks/backends/fake_melbourne.py delete mode 100644 test/benchmarks/backends/fake_openpulse.py delete mode 100644 test/benchmarks/backends/fake_singapore.py delete mode 100644 test/benchmarks/backends/props_melbourne.json delete mode 100644 test/benchmarks/backends/props_singapore.json diff --git a/test/benchmarks/backends/__init__.py b/test/benchmarks/backends/__init__.py deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/test/benchmarks/backends/fake_backend.py b/test/benchmarks/backends/fake_backend.py deleted file mode 100644 index cb05706f7774..000000000000 --- a/test/benchmarks/backends/fake_backend.py +++ /dev/null @@ -1,110 +0,0 @@ -# -*- coding: utf-8 -*- - -# This code is part of Qiskit. -# -# (C) Copyright IBM 2019. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -""" -Base class for dummy backends. -""" - -import uuid -import time - -from qiskit.providers.models import BackendProperties -from qiskit.providers import BaseBackend -from qiskit.result import Result -from .fake_job import FakeJob - - -class FakeBackend(BaseBackend): - """This is a dummy backend just for testing purposes.""" - - def __init__(self, configuration, time_alive=10): - """ - Args: - configuration (BackendConfiguration): backend configuration - time_alive (int): time to wait before returning result - """ - super().__init__(configuration) - self.time_alive = time_alive - - def properties(self): - """Return backend properties""" - coupling_map = self.configuration().coupling_map - unique_qubits = list(set().union(*coupling_map)) - - properties = { - 'backend_name': self.name(), - 'backend_version': self.configuration().backend_version, - 'last_update_date': '2000-01-01 00:00:00Z', - 'qubits': [ - [ - { - "date": "2000-01-01 00:00:00Z", - "name": "T1", - "unit": "\u00b5s", - "value": 0.0 - }, - { - "date": "2000-01-01 00:00:00Z", - "name": "T2", - "unit": "\u00b5s", - "value": 0.0 - }, - { - "date": "2000-01-01 00:00:00Z", - "name": "frequency", - "unit": "GHz", - "value": 0.0 - }, - { - "date": "2000-01-01 00:00:00Z", - "name": "readout_error", - "unit": "", - "value": 0.0 - } - ] for _ in range(len(unique_qubits)) - ], - 'gates': [{ - "gate": "cx", - "name": "CX" + str(pair[0]) + "_" + str(pair[1]), - "parameters": [ - { - "date": "2000-01-01 00:00:00Z", - "name": "gate_error", - "unit": "", - "value": 0.0 - } - ], - "qubits": [ - pair[0], - pair[1] - ] - } for pair in coupling_map], - 'general': [] - } - - return BackendProperties.from_dict(properties) - - def run(self, qobj): - job_id = str(uuid.uuid4()) - job = FakeJob(self, job_id, self.run_job, qobj) - job.submit() - return job - - def run_job(self, job_id, qobj): - """Main dummy run loop""" - del qobj # unused - time.sleep(self.time_alive) - - return Result.from_dict( - {'job_id': job_id, 'result': [], 'status': 'COMPLETED'}) diff --git a/test/benchmarks/backends/fake_job.py b/test/benchmarks/backends/fake_job.py deleted file mode 100644 index 85c7cced828a..000000000000 --- a/test/benchmarks/backends/fake_job.py +++ /dev/null @@ -1,86 +0,0 @@ -# -*- coding: utf-8 -*- - -# This code is part of Qiskit. -# -# (C) Copyright IBM 2019. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -""" -Base class for dummy jobs. -""" - - -from concurrent import futures - -from qiskit.providers import BaseJob -from qiskit.providers.jobstatus import JobStatus - - -class FakeJob(BaseJob): - """Fake simulator job""" - _executor = futures.ProcessPoolExecutor() - - def __init__(self, backend, job_id, fn, qobj): - super().__init__(backend, job_id) - self._backend = backend - self._job_id = job_id - self._qobj = qobj - self._future = None - self._future_callback = fn - - def submit(self): - self._future = self._executor.submit(self._future_callback, self._qobj) - - def result(self, timeout=None): - # pylint: disable=arguments-differ - return self._future.result(timeout=timeout) - - def cancel(self): - return self._future.cancel() - - def status(self): - if self._running: - _status = JobStatus.RUNNING - elif not self._done: - _status = JobStatus.QUEUED - elif self._cancelled: - _status = JobStatus.CANCELLED - elif self._done: - _status = JobStatus.DONE - elif self._error: - _status = JobStatus.ERROR - else: - raise Exception('Unexpected state of {0}'.format( - self.__class__.__name__)) - _status_msg = None - return {'status': _status, - 'status_msg': _status_msg} - - def job_id(self): - return self._job_id - - def backend(self): - return self._backend - - @property - def _cancelled(self): - return self._future.cancelled() - - @property - def _done(self): - return self._future.done() - - @property - def _running(self): - return self._future.running() - - @property - def _error(self): - return self._future.exception(timeout=0) diff --git a/test/benchmarks/backends/fake_melbourne.py b/test/benchmarks/backends/fake_melbourne.py deleted file mode 100644 index fcb6e42c215a..000000000000 --- a/test/benchmarks/backends/fake_melbourne.py +++ /dev/null @@ -1,64 +0,0 @@ -# -*- coding: utf-8 -*- - -# This code is part of Qiskit. -# -# (C) Copyright IBM 2019. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -""" -Fake Melbourne device (14 qubit). -""" - -import os -import json - -from qiskit.providers.models import (GateConfig, QasmBackendConfiguration, - BackendProperties) -from .fake_backend import FakeBackend - - -class FakeMelbourne(FakeBackend): - """A fake 14 qubit backend.""" - - def __init__(self): - """ - 0 ← 1 → 2 → 3 ← 4 ← 5 → 6 - ↑ ↑ ↑ ↓ ↓ ↓ - 13 → 12 ← 11 → 10 ← 9 → 8 ← 7 - """ - cmap = [[1, 0], [1, 2], [2, 3], [4, 3], [4, 10], [5, 4], - [5, 6], [5, 9], [6, 8], [7, 8], [9, 8], [9, 10], - [11, 3], [11, 10], [11, 12], [12, 2], [13, 1], [13, 12]] - - configuration = QasmBackendConfiguration( - backend_name='fake_melbourne', - backend_version='0.0.0', - n_qubits=14, - basis_gates=['u1', 'u2', 'u3', 'cx', 'id'], - simulator=False, - local=True, - conditional=False, - open_pulse=False, - memory=False, - max_shots=65536, - gates=[GateConfig(name='TODO', parameters=[], qasm_def='TODO')], - coupling_map=cmap, - ) - - super().__init__(configuration) - - def properties(self): - """Returns a snapshot of device properties as recorded on 8/30/19. - """ - dirname = os.path.dirname(__file__) - filename = "props_melbourne.json" - with open(os.path.join(dirname, filename), "r") as f_prop: - props = json.load(f_prop) - return BackendProperties.from_dict(props) diff --git a/test/benchmarks/backends/fake_openpulse.py b/test/benchmarks/backends/fake_openpulse.py deleted file mode 100644 index 57b37efb0b39..000000000000 --- a/test/benchmarks/backends/fake_openpulse.py +++ /dev/null @@ -1,305 +0,0 @@ -# -*- coding: utf-8 -*- - -# This code is part of Qiskit. -# -# (C) Copyright IBM 2019. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -""" -Fake Open Pulse (2 qubit). -""" - -import datetime -from qiskit.providers.models import (GateConfig, PulseBackendConfiguration, - PulseDefaults, Command, UchannelLO) -from qiskit.providers.models.backendproperties import (Nduv, Gate, - BackendProperties) -from qiskit.qobj import PulseQobjInstruction -from qiskit.test.mock.fake_backend import FakeBackend - - -class FakeOpenPulse2Q(FakeBackend): - """A fake open pulse backend.""" - - def __init__(self): - configuration = PulseBackendConfiguration( - backend_name='fake_openpulse', - backend_version='0.0.0', - n_qubits=2, - meas_levels=[0, 1, 2], - basis_gates=['u1', 'u2', 'u3', 'cx', 'id'], - simulator=False, - local=True, - conditional=True, - open_pulse=True, - memory=False, - max_shots=65536, - gates=[GateConfig(name='TODO', parameters=[], qasm_def='TODO')], - coupling_map=[[0, 1]], - n_registers=2, - n_uchannels=2, - u_channel_lo=[ - [UchannelLO(q=0, scale=1. + 0.j)], - [UchannelLO(q=0, scale=-1. + 0.j), - UchannelLO(q=1, scale=1. + 0.j)] - ], - meas_level=[1, 2], - qubit_lo_range=[[4.5, 5.5], [4.5, 5.5]], - meas_lo_range=[[6.0, 7.0], [6.0, 7.0]], - dt=1.3333, - dtm=10.5, - rep_times=[100, 250, 500, 1000], - meas_map=[[0, 1]], - channel_bandwidth=[ - [-0.2, 0.4], [-0.3, 0.3], [-0.3, 0.3], - [-0.02, 0.02], [-0.02, 0.02], [-0.02, 0.02] - ], - meas_kernels=['kernel1'], - discriminators=['max_1Q_fidelity'], - acquisition_latency=[[100, 100], [100, 100]], - conditional_latency=[ - [100, 1000], [1000, 100], [100, 1000], - [1000, 100], [100, 1000], [1000, 100] - ], - hamiltonian={ - 'h_str': ["np.pi*(2*v0-alpha0)*O0", "np.pi*alpha0*O0*O0", - "2*np.pi*r*X0||D0", "2*np.pi*r*X0||U1", - "2*np.pi*r*X1||U0", "np.pi*(2*v1-alpha1)*O1", - "np.pi*alpha1*O1*O1", "2*np.pi*r*X1||D1", - "2*np.pi*j*(Sp0*Sm1+Sm0*Sp1)"], - 'description': "A hamiltonian for a mocked 2Q device, with 1Q\ - and 2Q terms.", - 'qub': {'0': 3, '1': 3}, - 'vars': {'v0': 5.00, - 'v1': 5.1, - 'j': 0.01, - 'r': 0.02, - 'alpha0': -0.33, - 'alpha1': -0.33} - }, - channels={ - 'acquire0': { - 'operates': {'qubits': [0]}, - 'purpose': 'acquire', - 'type': 'acquire' - }, - 'acquire1': { - 'operates': {'qubits': [1]}, - 'purpose': 'acquire', - 'type': 'acquire' - }, - 'd0': { - 'operates': {'qubits': [0]}, - 'purpose': 'drive', - 'type': 'drive' - }, - 'd1': { - 'operates': {'qubits': [1]}, - 'purpose': 'drive', - 'type': 'drive' - }, - 'm0': { - 'type': 'measure', - 'purpose': 'measure', - 'operates': {'qubits': [0]} - }, - 'm1': { - 'type': 'measure', - 'purpose': 'measure', - 'operates': {'qubits': [1]} - }, - 'u0': { - 'operates': {'qubits': [0, 1]}, - 'purpose': 'cross-resonance', - 'type': 'control' - }, - 'u1': { - 'operates': {'qubits': [1, 0]}, - 'purpose': 'cross-resonance', - 'type': 'control' - } - } - ) - - self._defaults = PulseDefaults.from_dict({ - 'qubit_freq_est': [4.9, 5.0], - 'meas_freq_est': [6.5, 6.6], - 'buffer': 10, - 'pulse_library': [ - { - 'name': 'test_pulse_1', - 'samples': [[0.0, 0.0], [0.0, 0.1]] - }, - { - 'name': 'test_pulse_2', - 'samples': [[0.0, 0.0], [0.0, 0.1], [0.0, 1.0]] - }, - { - 'name': 'test_pulse_3', - 'samples': [[0.0, 0.0], [0.0, 0.1], [0.0, 1.0], [0.5, 0.0]] - }, - { - 'name': 'test_pulse_4', - 'samples': 7 * [ - [0.0, 0.0], [0.0, 0.1], [0.0, 1.0], [0.5, 0.0] - ] - } - ], - 'cmd_def': [ - Command.from_dict({ - 'name': 'u1', - 'qubits': [0], - 'sequence': [ - PulseQobjInstruction(name='fc', ch='d0', - t0=0, phase='-P0').to_dict() - ]}).to_dict(), - Command.from_dict({ - 'name': 'u1', - 'qubits': [1], - 'sequence': [ - PulseQobjInstruction(name='fc', ch='d1', - t0=0, phase='-P0').to_dict() - ]}).to_dict(), - Command.from_dict({ - 'name': 'u2', - 'qubits': [0], - 'sequence': [ - PulseQobjInstruction(name='fc', ch='d0', - t0=0, - phase='-P1').to_dict(), - PulseQobjInstruction(name='test_pulse_4', ch='d0', - t0=0).to_dict(), - PulseQobjInstruction(name='fc', ch='d0', t0=0, - phase='-P0').to_dict() - ]}).to_dict(), - Command.from_dict({ - 'name': 'u2', - 'qubits': [1], - 'sequence': [ - PulseQobjInstruction(name='fc', ch='d1', t0=0, - phase='-P1').to_dict(), - PulseQobjInstruction(name='test_pulse_4', - ch='d1', t0=0).to_dict(), - PulseQobjInstruction(name='fc', ch='d1', - t0=0, phase='-P0').to_dict() - ]}).to_dict(), - Command.from_dict({ - 'name': 'u3', - 'qubits': [0], - 'sequence': [ - PulseQobjInstruction(name='test_pulse_1', ch='d0', - t0=0).to_dict() - ]}).to_dict(), - Command.from_dict({ - 'name': 'u3', - 'qubits': [1], - 'sequence': [ - PulseQobjInstruction(name='test_pulse_3', ch='d1', - t0=0).to_dict() - ]}).to_dict(), - Command.from_dict({ - 'name': 'cx', - 'qubits': [0, 1], - 'sequence': [ - PulseQobjInstruction(name='test_pulse_1', ch='d0', - t0=0).to_dict(), - PulseQobjInstruction(name='test_pulse_2', ch='u0', - t0=10).to_dict(), - PulseQobjInstruction(name='test_pulse_1', ch='d1', - t0=20).to_dict(), - PulseQobjInstruction(name='fc', ch='d1', - t0=20, phase=2.1).to_dict() - ]}).to_dict(), - Command.from_dict({ - 'name': 'ParametrizedGate', - 'qubits': [0, 1], - 'sequence': [ - PulseQobjInstruction(name='test_pulse_1', ch='d0', - t0=0).to_dict(), - PulseQobjInstruction(name='test_pulse_2', ch='u0', - t0=10).to_dict(), - PulseQobjInstruction(name='pv', ch='d1', - t0=2, val='cos(P2)').to_dict(), - PulseQobjInstruction(name='test_pulse_1', ch='d1', - t0=20).to_dict(), - PulseQobjInstruction(name='fc', ch='d1', - t0=20, phase=2.1).to_dict() - ]}).to_dict(), - Command.from_dict({ - 'name': 'measure', - 'qubits': [0, 1], - 'sequence': [ - PulseQobjInstruction(name='test_pulse_1', ch='m0', - t0=0).to_dict(), - PulseQobjInstruction(name='test_pulse_1', ch='m1', - t0=0).to_dict(), - PulseQobjInstruction(name='acquire', duration=10, t0=0, - qubits=[0, 1], - memory_slot=[0, 1]).to_dict() - ]}).to_dict() - ] - }) - - mock_time = datetime.datetime.now() - dt = 1.3333 # pylint: disable=invalid-name - self._properties = BackendProperties( - backend_name='fake_openpulse_2q', - backend_version='0.0.0', - last_update_date=mock_time, - qubits=[ - [Nduv(date=mock_time, name='T1', unit='µs', - value=71.9500421005539), - Nduv(date=mock_time, name='frequency', unit='MHz', - value=4919.96800692)], - [Nduv(date=mock_time, name='T1', unit='µs', - value=81.9500421005539), - Nduv(date=mock_time, name='frequency', unit='GHz', - value=5.01996800692)] - ], - gates=[ - Gate(gate='u1', name='u1_0', qubits=[0], - parameters=[ - Nduv(date=mock_time, name='gate_error', unit='', - value=0.06), - Nduv(date=mock_time, name='gate_length', unit='ns', - value=0.)]), - Gate(gate='u3', name='u3_0', qubits=[0], - parameters=[ - Nduv(date=mock_time, name='gate_error', unit='', - value=0.06), - Nduv(date=mock_time, name='gate_length', unit='ns', - value=2 * dt)]), - Gate(gate='u3', name='u3_1', qubits=[1], - parameters=[ - Nduv(date=mock_time, name='gate_error', unit='', - value=0.06), - Nduv(date=mock_time, name='gate_length', unit='ns', - value=4 * dt)]), - Gate(gate='cx', name='cx0_1', qubits=[0, 1], - parameters=[ - Nduv(date=mock_time, name='gate_error', unit='', - value=1.0), - Nduv(date=mock_time, name='gate_length', unit='ns', - value=22 * dt)]), - ], - general=[] - ) - - super().__init__(configuration) - - def defaults(self): - """Return the default pulse-related settings provided by the backend - (such as gate to Schedule mappings). - """ - return self._defaults - - def properties(self): - """Return the measured characteristics of the backend.""" - return self._properties diff --git a/test/benchmarks/backends/fake_singapore.py b/test/benchmarks/backends/fake_singapore.py deleted file mode 100644 index 321aaab3361d..000000000000 --- a/test/benchmarks/backends/fake_singapore.py +++ /dev/null @@ -1,73 +0,0 @@ -# -*- coding: utf-8 -*- - -# This code is part of Qiskit. -# -# (C) Copyright IBM 2019. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -""" -Fake Boeblingen device (20 qubit). -""" - -import os -import json - -from qiskit.providers.models import (GateConfig, QasmBackendConfiguration, - BackendProperties) -from qiskit.test.mock.fake_backend import FakeBackend - - -class FakeSingapore(FakeBackend): - """A fake Singapore backend.""" - - def __init__(self): - """ - 00 ↔ 01 ↔ 02 ↔ 03 ↔ 04 - ↕ ↕ - 05 ↔ 06 ↔ 07 ↔ 08 ↔ 09 - ↕ ↕ ↕ - 10 ↔ 11 ↔ 12 ↔ 13 ↔ 14 - ↕ ↕ - 15 ↔ 16 ↔ 17 ↔ 18 ↔ 19 - """ - cmap = [[0, 1], [1, 0], [1, 2], [1, 6], [2, 1], [2, 3], [3, 2], - [3, 4], [3, 8], [4, 3], [5, 6], [5, 10], [6, 1], [6, 5], - [6, 7], [7, 6], [7, 8], [7, 12], [8, 3], [8, 7], [8, 9], - [9, 8], [9, 14], [10, 5], [10, 11], [11, 10], [11, 12], - [11, 16], [12, 7], [12, 11], [12, 13], [13, 12], [13, 14], - [13, 18], [14, 9], [14, 13], [15, 16], [16, 11], [16, 15], - [16, 17], [17, 16], [17, 18], [18, 13], [18, 17], [18, 19], - [19, 18]] - - configuration = QasmBackendConfiguration( - backend_name='fake_singapore', - backend_version='0.0.0', - n_qubits=20, - basis_gates=['u1', 'u2', 'u3', 'cx', 'id'], - simulator=False, - local=True, - conditional=False, - open_pulse=False, - memory=True, - max_shots=8192, - gates=[GateConfig(name='TODO', parameters=[], qasm_def='TODO')], - coupling_map=cmap, - ) - - super().__init__(configuration) - - def properties(self): - """Returns a snapshot of device properties as recorded on 10/08/19. - """ - dirname = os.path.dirname(__file__) - filename = "props_singapore.json" - with open(os.path.join(dirname, filename), "r") as f_prop: - props = json.load(f_prop) - return BackendProperties.from_dict(props) diff --git a/test/benchmarks/backends/props_melbourne.json b/test/benchmarks/backends/props_melbourne.json deleted file mode 100644 index 8db37a5f4611..000000000000 --- a/test/benchmarks/backends/props_melbourne.json +++ /dev/null @@ -1 +0,0 @@ -{"backend_version": "1.0.0", "general": [], "last_update_date": "2019-08-30T08:40:39+00:00", "backend_name": "ibmq_16_melbourne", "qubits": [[{"date": "2019-08-30T06:25:05+00:00", "unit": "\u00b5s", "value": 50.77314177960378, "name": "T1"}, {"date": "2019-08-30T06:26:18+00:00", "unit": "\u00b5s", "value": 23.26716550447232, "name": "T2"}, {"date": "2019-08-30T08:40:39+00:00", "unit": "GHz", "value": 5.100143648658738, "name": "frequency"}, {"date": "2019-08-30T06:24:42+00:00", "unit": "", "value": 0.0816, "name": "readout_error"}], [{"date": "2019-08-30T06:25:05+00:00", "unit": "\u00b5s", "value": 75.03457165555137, "name": "T1"}, {"date": "2019-08-30T06:27:17+00:00", "unit": "\u00b5s", "value": 123.45446126755621, "name": "T2"}, {"date": "2019-08-30T08:40:39+00:00", "unit": "GHz", "value": 5.238515519242375, "name": "frequency"}, {"date": "2019-08-30T06:24:42+00:00", "unit": "", "value": 0.05669999999999997, "name": "readout_error"}], [{"date": "2019-08-30T06:25:05+00:00", "unit": "\u00b5s", "value": 50.275404762879674, "name": "T1"}, {"date": "2019-08-30T06:28:16+00:00", "unit": "\u00b5s", "value": 97.1824505756254, "name": "T2"}, {"date": "2019-08-30T08:40:39+00:00", "unit": "GHz", "value": 5.0325918748371725, "name": "frequency"}, {"date": "2019-08-30T06:24:42+00:00", "unit": "", "value": 0.03649999999999998, "name": "readout_error"}], [{"date": "2019-08-30T06:25:05+00:00", "unit": "\u00b5s", "value": 77.06523067691023, "name": "T1"}, {"date": "2019-08-30T06:29:16+00:00", "unit": "\u00b5s", "value": 65.88343921328119, "name": "T2"}, {"date": "2019-08-30T08:40:39+00:00", "unit": "GHz", "value": 4.89622995143569, "name": "frequency"}, {"date": "2019-08-30T06:24:42+00:00", "unit": "", "value": 0.033600000000000074, "name": "readout_error"}], [{"date": "2019-08-30T06:25:05+00:00", "unit": "\u00b5s", "value": 48.6121344326565, "name": "T1"}, {"date": "2019-08-30T06:26:18+00:00", "unit": "\u00b5s", "value": 33.43851454952923, "name": "T2"}, {"date": "2019-08-30T08:40:39+00:00", "unit": "GHz", "value": 5.030492276013032, "name": "frequency"}, {"date": "2019-08-30T06:24:42+00:00", "unit": "", "value": 0.06389999999999996, "name": "readout_error"}], [{"date": "2019-08-30T06:25:05+00:00", "unit": "\u00b5s", "value": 27.22545338386326, "name": "T1"}, {"date": "2019-08-30T06:27:17+00:00", "unit": "\u00b5s", "value": 55.30006621968561, "name": "T2"}, {"date": "2019-08-30T08:40:39+00:00", "unit": "GHz", "value": 5.067164115486811, "name": "frequency"}, {"date": "2019-08-30T06:24:42+00:00", "unit": "", "value": 0.05700000000000005, "name": "readout_error"}], [{"date": "2019-08-30T06:25:05+00:00", "unit": "\u00b5s", "value": 62.04463882018325, "name": "T1"}, {"date": "2019-08-30T06:28:16+00:00", "unit": "\u00b5s", "value": 61.95417571799565, "name": "T2"}, {"date": "2019-08-30T08:40:39+00:00", "unit": "GHz", "value": 4.923824384016654, "name": "frequency"}, {"date": "2019-08-30T06:24:42+00:00", "unit": "", "value": 0.07909999999999995, "name": "readout_error"}], [{"date": "2019-08-30T06:25:05+00:00", "unit": "\u00b5s", "value": 43.16853024912021, "name": "T1"}, {"date": "2019-08-30T06:29:16+00:00", "unit": "\u00b5s", "value": 58.427459338851314, "name": "T2"}, {"date": "2019-08-30T08:40:39+00:00", "unit": "GHz", "value": 4.974544202937344, "name": "frequency"}, {"date": "2019-08-30T06:24:42+00:00", "unit": "", "value": 0.06340000000000001, "name": "readout_error"}], [{"date": "2019-08-30T06:25:05+00:00", "unit": "\u00b5s", "value": 63.71797543850963, "name": "T1"}, {"date": "2019-08-30T06:26:18+00:00", "unit": "\u00b5s", "value": 88.67507787276234, "name": "T2"}, {"date": "2019-08-30T08:40:39+00:00", "unit": "GHz", "value": 4.739562250938468, "name": "frequency"}, {"date": "2019-08-30T06:24:42+00:00", "unit": "", "value": 0.034599999999999964, "name": "readout_error"}], [{"date": "2019-08-30T06:25:05+00:00", "unit": "\u00b5s", "value": 46.51934163391105, "name": "T1"}, {"date": "2019-08-30T06:28:16+00:00", "unit": "\u00b5s", "value": 81.94019993440179, "name": "T2"}, {"date": "2019-08-30T08:40:39+00:00", "unit": "GHz", "value": 4.963380996175847, "name": "frequency"}, {"date": "2019-08-30T06:24:42+00:00", "unit": "", "value": 0.034399999999999986, "name": "readout_error"}], [{"date": "2019-08-30T06:25:05+00:00", "unit": "\u00b5s", "value": 41.30403837241326, "name": "T1"}, {"date": "2019-08-30T06:27:17+00:00", "unit": "\u00b5s", "value": 51.44366097786817, "name": "T2"}, {"date": "2019-08-30T08:40:39+00:00", "unit": "GHz", "value": 4.945057612825996, "name": "frequency"}, {"date": "2019-08-30T06:24:42+00:00", "unit": "", "value": 0.062000000000000055, "name": "readout_error"}], [{"date": "2019-08-30T06:25:05+00:00", "unit": "\u00b5s", "value": 68.19724093725696, "name": "T1"}, {"date": "2019-08-30T06:28:16+00:00", "unit": "\u00b5s", "value": 116.05875432702656, "name": "T2"}, {"date": "2019-08-30T08:40:39+00:00", "unit": "GHz", "value": 5.005006866957911, "name": "frequency"}, {"date": "2019-08-30T06:24:42+00:00", "unit": "", "value": 0.03180000000000005, "name": "readout_error"}], [{"date": "2019-08-30T06:25:05+00:00", "unit": "\u00b5s", "value": 42.18872718994089, "name": "T1"}, {"date": "2019-08-30T06:27:17+00:00", "unit": "\u00b5s", "value": 72.39113698104636, "name": "T2"}, {"date": "2019-08-30T08:40:39+00:00", "unit": "GHz", "value": 4.759964985519018, "name": "frequency"}, {"date": "2019-08-30T06:24:42+00:00", "unit": "", "value": 0.05730000000000002, "name": "readout_error"}], [{"date": "2019-08-30T06:25:05+00:00", "unit": "\u00b5s", "value": 23.388913061674028, "name": "T1"}, {"date": "2019-08-30T06:26:18+00:00", "unit": "\u00b5s", "value": 49.568617451351685, "name": "T2"}, {"date": "2019-08-30T08:40:39+00:00", "unit": "GHz", "value": 4.968519920718844, "name": "frequency"}, {"date": "2019-08-30T06:24:42+00:00", "unit": "", "value": 0.05249999999999999, "name": "readout_error"}]], "gates": [{"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0, "name": "gate_error"}], "qubits": [0], "gate": "u1"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0022890476549879413, "name": "gate_error"}], "qubits": [0], "gate": "u2"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0045780953099758825, "name": "gate_error"}], "qubits": [0], "gate": "u3"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0, "name": "gate_error"}], "qubits": [1], "gate": "u1"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.011161011211293481, "name": "gate_error"}], "qubits": [1], "gate": "u2"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.022322022422586962, "name": "gate_error"}], "qubits": [1], "gate": "u3"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0, "name": "gate_error"}], "qubits": [2], "gate": "u1"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.004338853227556672, "name": "gate_error"}], "qubits": [2], "gate": "u2"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.008677706455113343, "name": "gate_error"}], "qubits": [2], "gate": "u3"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0, "name": "gate_error"}], "qubits": [3], "gate": "u1"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0012604117926789393, "name": "gate_error"}], "qubits": [3], "gate": "u2"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0025208235853578786, "name": "gate_error"}], "qubits": [3], "gate": "u3"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0, "name": "gate_error"}], "qubits": [4], "gate": "u1"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.004304021029278404, "name": "gate_error"}], "qubits": [4], "gate": "u2"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.008608042058556808, "name": "gate_error"}], "qubits": [4], "gate": "u3"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0, "name": "gate_error"}], "qubits": [5], "gate": "u1"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0022045855046065044, "name": "gate_error"}], "qubits": [5], "gate": "u2"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.004409171009213009, "name": "gate_error"}], "qubits": [5], "gate": "u3"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0, "name": "gate_error"}], "qubits": [6], "gate": "u1"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.003454676084759689, "name": "gate_error"}], "qubits": [6], "gate": "u2"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.006909352169519378, "name": "gate_error"}], "qubits": [6], "gate": "u3"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0, "name": "gate_error"}], "qubits": [7], "gate": "u1"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0016963998440643335, "name": "gate_error"}], "qubits": [7], "gate": "u2"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.003392799688128667, "name": "gate_error"}], "qubits": [7], "gate": "u3"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0, "name": "gate_error"}], "qubits": [8], "gate": "u1"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0016534919884557686, "name": "gate_error"}], "qubits": [8], "gate": "u2"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0033069839769115372, "name": "gate_error"}], "qubits": [8], "gate": "u3"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0, "name": "gate_error"}], "qubits": [9], "gate": "u1"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.002924197752053881, "name": "gate_error"}], "qubits": [9], "gate": "u2"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.005848395504107762, "name": "gate_error"}], "qubits": [9], "gate": "u3"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0, "name": "gate_error"}], "qubits": [10], "gate": "u1"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0019467418954691729, "name": "gate_error"}], "qubits": [10], "gate": "u2"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0038934837909383457, "name": "gate_error"}], "qubits": [10], "gate": "u3"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0, "name": "gate_error"}], "qubits": [11], "gate": "u1"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0015616057095417801, "name": "gate_error"}], "qubits": [11], "gate": "u2"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0031232114190835603, "name": "gate_error"}], "qubits": [11], "gate": "u3"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0, "name": "gate_error"}], "qubits": [12], "gate": "u1"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0038211298054479648, "name": "gate_error"}], "qubits": [12], "gate": "u2"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0076422596108959295, "name": "gate_error"}], "qubits": [12], "gate": "u3"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.0, "name": "gate_error"}], "qubits": [13], "gate": "u1"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.007137874193502647, "name": "gate_error"}], "qubits": [13], "gate": "u2"}, {"parameters": [{"date": "2019-08-30T06:30:09+00:00", "unit": "", "value": 0.014275748387005294, "name": "gate_error"}], "qubits": [13], "gate": "u3"}, {"parameters": [{"date": "2019-08-30T07:40:28+00:00", "unit": "", "value": 0.06766941423407083, "name": "gate_error"}], "qubits": [1, 0], "gate": "cx", "name": "CX1_0"}, {"parameters": [{"date": "2019-08-29T08:20:16+00:00", "unit": "", "value": 0.03801037092728929, "name": "gate_error"}], "qubits": [1, 2], "gate": "cx", "name": "CX1_2"}, {"parameters": [{"date": "2019-08-30T07:43:40+00:00", "unit": "", "value": 0.04035927412341517, "name": "gate_error"}], "qubits": [2, 3], "gate": "cx", "name": "CX2_3"}, {"parameters": [{"date": "2019-08-30T07:46:54+00:00", "unit": "", "value": 0.06554808443374471, "name": "gate_error"}], "qubits": [4, 3], "gate": "cx", "name": "CX4_3"}, {"parameters": [{"date": "2019-08-30T07:50:12+00:00", "unit": "", "value": 0.11000377135049015, "name": "gate_error"}], "qubits": [4, 10], "gate": "cx", "name": "CX4_10"}, {"parameters": [{"date": "2019-08-30T07:53:32+00:00", "unit": "", "value": 0.082271205303343, "name": "gate_error"}], "qubits": [5, 4], "gate": "cx", "name": "CX5_4"}, {"parameters": [{"date": "2019-08-30T07:56:51+00:00", "unit": "", "value": 0.08000264893528869, "name": "gate_error"}], "qubits": [5, 6], "gate": "cx", "name": "CX5_6"}, {"parameters": [{"date": "2019-08-30T08:00:47+00:00", "unit": "", "value": 0.053982705107386536, "name": "gate_error"}], "qubits": [5, 9], "gate": "cx", "name": "CX5_9"}, {"parameters": [{"date": "2019-08-30T08:04:12+00:00", "unit": "", "value": 0.044040614765997216, "name": "gate_error"}], "qubits": [6, 8], "gate": "cx", "name": "CX6_8"}, {"parameters": [{"date": "2019-08-30T08:07:39+00:00", "unit": "", "value": 0.03259217494162084, "name": "gate_error"}], "qubits": [7, 8], "gate": "cx", "name": "CX7_8"}, {"parameters": [{"date": "2019-08-30T08:10:56+00:00", "unit": "", "value": 0.05439659729448815, "name": "gate_error"}], "qubits": [9, 8], "gate": "cx", "name": "CX9_8"}, {"parameters": [{"date": "2019-08-30T08:15:16+00:00", "unit": "", "value": 0.05590172348391173, "name": "gate_error"}], "qubits": [9, 10], "gate": "cx", "name": "CX9_10"}, {"parameters": [{"date": "2019-08-30T08:25:02+00:00", "unit": "", "value": 0.03230502354557954, "name": "gate_error"}], "qubits": [11, 3], "gate": "cx", "name": "CX11_3"}, {"parameters": [{"date": "2019-08-30T08:18:40+00:00", "unit": "", "value": 0.04992714061173503, "name": "gate_error"}], "qubits": [11, 10], "gate": "cx", "name": "CX11_10"}, {"parameters": [{"date": "2019-08-30T08:21:50+00:00", "unit": "", "value": 0.0577565027812707, "name": "gate_error"}], "qubits": [11, 12], "gate": "cx", "name": "CX11_12"}, {"parameters": [{"date": "2019-08-30T08:28:18+00:00", "unit": "", "value": 0.07996541354812434, "name": "gate_error"}], "qubits": [12, 2], "gate": "cx", "name": "CX12_2"}, {"parameters": [{"date": "2019-08-30T08:32:48+00:00", "unit": "", "value": 0.20353725512052456, "name": "gate_error"}], "qubits": [13, 1], "gate": "cx", "name": "CX13_1"}, {"parameters": [{"date": "2019-08-30T08:36:49+00:00", "unit": "", "value": 0.06325184775759388, "name": "gate_error"}], "qubits": [13, 12], "gate": "cx", "name": "CX13_12"}]} \ No newline at end of file diff --git a/test/benchmarks/backends/props_singapore.json b/test/benchmarks/backends/props_singapore.json deleted file mode 100644 index bd460403197e..000000000000 --- a/test/benchmarks/backends/props_singapore.json +++ /dev/null @@ -1 +0,0 @@ -{"general": [], "qubits": [[{"date": "2019-10-07T10:10:07+00:00", "unit": "\u00b5s", "value": 98.50001846063365, "name": "T1"}, {"date": "2019-10-07T10:11:53+00:00", "unit": "\u00b5s", "value": 142.79433528474766, "name": "T2"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "GHz", "value": 4.676715786802928, "name": "frequency"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.028000000000000025, "name": "readout_error"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.04, "name": "prob_meas0_prep1"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.016000000000000014, "name": "prob_meas1_prep0"}], [{"date": "2019-10-05T10:14:29+00:00", "unit": "\u00b5s", "value": 71.8423910064075, "name": "T1"}, {"date": "2019-10-07T10:13:37+00:00", "unit": "\u00b5s", "value": 86.1000420353437, "name": "T2"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "GHz", "value": 4.782680699300517, "name": "frequency"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.03500000000000003, "name": "readout_error"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.05800000000000005, "name": "prob_meas0_prep1"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.012, "name": "prob_meas1_prep0"}], [{"date": "2019-10-07T10:10:07+00:00", "unit": "\u00b5s", "value": 54.586493833620445, "name": "T1"}, {"date": "2019-10-07T10:11:53+00:00", "unit": "\u00b5s", "value": 64.28987220978689, "name": "T2"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "GHz", "value": 4.685409810699721, "name": "frequency"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.02750000000000008, "name": "readout_error"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.040000000000000036, "name": "prob_meas0_prep1"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.015, "name": "prob_meas1_prep0"}], [{"date": "2019-10-07T10:10:07+00:00", "unit": "\u00b5s", "value": 71.88906145160064, "name": "T1"}, {"date": "2019-10-07T10:13:37+00:00", "unit": "\u00b5s", "value": 100.29926276217378, "name": "T2"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "GHz", "value": 4.716928039422963, "name": "frequency"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.031000000000000028, "name": "readout_error"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.049000000000000044, "name": "prob_meas0_prep1"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.013, "name": "prob_meas1_prep0"}], [{"date": "2019-10-07T10:10:07+00:00", "unit": "\u00b5s", "value": 52.770110881257324, "name": "T1"}, {"date": "2019-10-07T10:11:53+00:00", "unit": "\u00b5s", "value": 61.064644709448174, "name": "T2"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "GHz", "value": 4.564662441799778, "name": "frequency"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.024499999999999966, "name": "readout_error"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.04400000000000004, "name": "prob_meas0_prep1"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.005, "name": "prob_meas1_prep0"}], [{"date": "2019-10-07T10:10:07+00:00", "unit": "\u00b5s", "value": 106.63080350740401, "name": "T1"}, {"date": "2019-10-07T10:11:53+00:00", "unit": "\u00b5s", "value": 63.847221711183266, "name": "T2"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "GHz", "value": 4.3093990890670115, "name": "frequency"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.05049999999999999, "name": "readout_error"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.05700000000000005, "name": "prob_meas0_prep1"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.044, "name": "prob_meas1_prep0"}], [{"date": "2019-10-07T10:10:07+00:00", "unit": "\u00b5s", "value": 53.25798980049998, "name": "T1"}, {"date": "2019-10-07T10:25:34+00:00", "unit": "\u00b5s", "value": 59.50768130704096, "name": "T2"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "GHz", "value": 4.662502738898581, "name": "frequency"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.03500000000000003, "name": "readout_error"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.05300000000000005, "name": "prob_meas0_prep1"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.017, "name": "prob_meas1_prep0"}], [{"date": "2019-10-07T10:10:07+00:00", "unit": "\u00b5s", "value": 70.7178193327572, "name": "T1"}, {"date": "2019-09-30T09:12:16+00:00", "unit": "\u00b5s", "value": 91.5454015797137, "name": "T2"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "GHz", "value": 4.83100170618901, "name": "frequency"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.034499999999999975, "name": "readout_error"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.04400000000000004, "name": "prob_meas0_prep1"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.025, "name": "prob_meas1_prep0"}], [{"date": "2019-10-05T10:14:29+00:00", "unit": "\u00b5s", "value": 81.4823552465602, "name": "T1"}, {"date": "2019-10-07T10:25:34+00:00", "unit": "\u00b5s", "value": 80.29259328068997, "name": "T2"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "GHz", "value": 4.623118095677056, "name": "frequency"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.04200000000000004, "name": "readout_error"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.05700000000000005, "name": "prob_meas0_prep1"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.027, "name": "prob_meas1_prep0"}], [{"date": "2019-10-06T09:52:34+00:00", "unit": "\u00b5s", "value": 75.22358280239378, "name": "T1"}, {"date": "2019-10-04T10:03:13+00:00", "unit": "\u00b5s", "value": 33.6275779166682, "name": "T2"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "GHz", "value": 4.697684600011119, "name": "frequency"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.040000000000000036, "name": "readout_error"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.05600000000000005, "name": "prob_meas0_prep1"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.024, "name": "prob_meas1_prep0"}], [{"date": "2019-10-07T10:10:07+00:00", "unit": "\u00b5s", "value": 70.98747296573573, "name": "T1"}, {"date": "2019-10-07T10:13:37+00:00", "unit": "\u00b5s", "value": 113.20586880438636, "name": "T2"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "GHz", "value": 4.424172526087491, "name": "frequency"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.02849999999999997, "name": "readout_error"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.04500000000000004, "name": "prob_meas0_prep1"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.012, "name": "prob_meas1_prep0"}], [{"date": "2019-10-07T10:10:07+00:00", "unit": "\u00b5s", "value": 49.81041273082784, "name": "T1"}, {"date": "2019-10-07T10:11:53+00:00", "unit": "\u00b5s", "value": 72.19589834748233, "name": "T2"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "GHz", "value": 4.521513114099939, "name": "frequency"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.03400000000000003, "name": "readout_error"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.061, "name": "prob_meas0_prep1"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.007000000000000006, "name": "prob_meas1_prep0"}], [{"date": "2019-10-07T10:10:07+00:00", "unit": "\u00b5s", "value": 82.5827071619044, "name": "T1"}, {"date": "2019-10-07T10:13:37+00:00", "unit": "\u00b5s", "value": 141.83075197141548, "name": "T2"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "GHz", "value": 4.603498735627486, "name": "frequency"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.034499999999999975, "name": "readout_error"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.05500000000000005, "name": "prob_meas0_prep1"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.014, "name": "prob_meas1_prep0"}], [{"date": "2019-10-07T10:10:07+00:00", "unit": "\u00b5s", "value": 95.85019354756015, "name": "T1"}, {"date": "2019-10-07T10:11:53+00:00", "unit": "\u00b5s", "value": 131.6531371896787, "name": "T2"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "GHz", "value": 4.624418341917924, "name": "frequency"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.027000000000000024, "name": "readout_error"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.03500000000000003, "name": "prob_meas0_prep1"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.019, "name": "prob_meas1_prep0"}], [{"date": "2019-10-07T10:10:07+00:00", "unit": "\u00b5s", "value": 35.88916991811218, "name": "T1"}, {"date": "2019-10-07T10:13:37+00:00", "unit": "\u00b5s", "value": 62.03490787220797, "name": "T2"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "GHz", "value": 4.757476384494219, "name": "frequency"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.024499999999999966, "name": "readout_error"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.03700000000000003, "name": "prob_meas0_prep1"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.012, "name": "prob_meas1_prep0"}], [{"date": "2019-10-06T09:52:34+00:00", "unit": "\u00b5s", "value": 104.68198729947855, "name": "T1"}, {"date": "2019-10-07T10:11:53+00:00", "unit": "\u00b5s", "value": 57.97422234961757, "name": "T2"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "GHz", "value": 4.488504164049106, "name": "frequency"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.033500000000000085, "name": "readout_error"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.05600000000000005, "name": "prob_meas0_prep1"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.011, "name": "prob_meas1_prep0"}], [{"date": "2019-10-07T10:10:07+00:00", "unit": "\u00b5s", "value": 92.36366680998361, "name": "T1"}, {"date": "2019-10-07T10:13:37+00:00", "unit": "\u00b5s", "value": 94.59861170877572, "name": "T2"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "GHz", "value": 4.738439313844244, "name": "frequency"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.027000000000000024, "name": "readout_error"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.039000000000000035, "name": "prob_meas0_prep1"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.015, "name": "prob_meas1_prep0"}], [{"date": "2019-10-07T10:10:07+00:00", "unit": "\u00b5s", "value": 107.49950920916586, "name": "T1"}, {"date": "2019-10-07T10:11:53+00:00", "unit": "\u00b5s", "value": 133.11941489971574, "name": "T2"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "GHz", "value": 4.8824966313847975, "name": "frequency"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.03049999999999997, "name": "readout_error"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.04700000000000004, "name": "prob_meas0_prep1"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.014, "name": "prob_meas1_prep0"}], [{"date": "2019-10-03T09:48:38+00:00", "unit": "\u00b5s", "value": 105.19080597037585, "name": "T1"}, {"date": "2019-10-07T10:13:37+00:00", "unit": "\u00b5s", "value": 111.7410815464684, "name": "T2"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "GHz", "value": 4.5284500512834285, "name": "frequency"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.08450000000000002, "name": "readout_error"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.101, "name": "prob_meas0_prep1"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.06799999999999995, "name": "prob_meas1_prep0"}], [{"date": "2019-10-04T10:01:26+00:00", "unit": "\u00b5s", "value": 129.411447716364, "name": "T1"}, {"date": "2019-10-04T10:03:13+00:00", "unit": "\u00b5s", "value": 94.47076929782332, "name": "T2"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "GHz", "value": 4.6976528478044095, "name": "frequency"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.04200000000000004, "name": "readout_error"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.06499999999999995, "name": "prob_meas0_prep1"}, {"date": "2019-10-07T09:58:52+00:00", "unit": "", "value": 0.019, "name": "prob_meas1_prep0"}]], "gates": [{"qubits": [0], "gate": "id", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0005688851193218149, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "id_0"}, {"qubits": [0], "gate": "u1", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 0.0, "name": "gate_length"}], "name": "u1_0"}, {"qubits": [0], "gate": "u2", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0005688851193218149, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "u2_0"}, {"qubits": [0], "gate": "u3", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0011377702386436298, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 71.11111111111111, "name": "gate_length"}], "name": "u3_0"}, {"qubits": [1], "gate": "id", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.0005995105803450207, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "id_1"}, {"qubits": [1], "gate": "u1", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.0, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 0.0, "name": "gate_length"}], "name": "u1_1"}, {"qubits": [1], "gate": "u2", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.0005995105803450207, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "u2_1"}, {"qubits": [1], "gate": "u3", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.0011990211606900413, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 71.11111111111111, "name": "gate_length"}], "name": "u3_1"}, {"qubits": [2], "gate": "id", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0022127694703092497, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "id_2"}, {"qubits": [2], "gate": "u1", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 0.0, "name": "gate_length"}], "name": "u1_2"}, {"qubits": [2], "gate": "u2", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0022127694703092497, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "u2_2"}, {"qubits": [2], "gate": "u3", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0044255389406184995, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 71.11111111111111, "name": "gate_length"}], "name": "u3_2"}, {"qubits": [3], "gate": "id", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.0009010448455703253, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "id_3"}, {"qubits": [3], "gate": "u1", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.0, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 0.0, "name": "gate_length"}], "name": "u1_3"}, {"qubits": [3], "gate": "u2", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.0009010448455703253, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "u2_3"}, {"qubits": [3], "gate": "u3", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.0018020896911406506, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 71.11111111111111, "name": "gate_length"}], "name": "u3_3"}, {"qubits": [4], "gate": "id", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.00022510791737658382, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "id_4"}, {"qubits": [4], "gate": "u1", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 0.0, "name": "gate_length"}], "name": "u1_4"}, {"qubits": [4], "gate": "u2", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.00022510791737658382, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "u2_4"}, {"qubits": [4], "gate": "u3", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.00045021583475316764, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 71.11111111111111, "name": "gate_length"}], "name": "u3_4"}, {"qubits": [5], "gate": "id", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.00037422191608514393, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "id_5"}, {"qubits": [5], "gate": "u1", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 0.0, "name": "gate_length"}], "name": "u1_5"}, {"qubits": [5], "gate": "u2", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.00037422191608514393, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "u2_5"}, {"qubits": [5], "gate": "u3", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0007484438321702879, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 71.11111111111111, "name": "gate_length"}], "name": "u3_5"}, {"qubits": [6], "gate": "id", "parameters": [{"date": "2019-10-07T10:41:33+00:00", "unit": "", "value": 0.000378362284572259, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "id_6"}, {"qubits": [6], "gate": "u1", "parameters": [{"date": "2019-10-07T10:41:33+00:00", "unit": "", "value": 0.0, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 0.0, "name": "gate_length"}], "name": "u1_6"}, {"qubits": [6], "gate": "u2", "parameters": [{"date": "2019-10-07T10:41:33+00:00", "unit": "", "value": 0.000378362284572259, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "u2_6"}, {"qubits": [6], "gate": "u3", "parameters": [{"date": "2019-10-07T10:41:33+00:00", "unit": "", "value": 0.000756724569144518, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 71.11111111111111, "name": "gate_length"}], "name": "u3_6"}, {"qubits": [7], "gate": "id", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0004125770256412488, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "id_7"}, {"qubits": [7], "gate": "u1", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 0.0, "name": "gate_length"}], "name": "u1_7"}, {"qubits": [7], "gate": "u2", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0004125770256412488, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "u2_7"}, {"qubits": [7], "gate": "u3", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0008251540512824976, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 71.11111111111111, "name": "gate_length"}], "name": "u3_7"}, {"qubits": [8], "gate": "id", "parameters": [{"date": "2019-10-07T10:41:33+00:00", "unit": "", "value": 0.0005417535111698166, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "id_8"}, {"qubits": [8], "gate": "u1", "parameters": [{"date": "2019-10-07T10:41:33+00:00", "unit": "", "value": 0.0, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 0.0, "name": "gate_length"}], "name": "u1_8"}, {"qubits": [8], "gate": "u2", "parameters": [{"date": "2019-10-07T10:41:33+00:00", "unit": "", "value": 0.0005417535111698166, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "u2_8"}, {"qubits": [8], "gate": "u3", "parameters": [{"date": "2019-10-07T10:41:33+00:00", "unit": "", "value": 0.0010835070223396332, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 71.11111111111111, "name": "gate_length"}], "name": "u3_8"}, {"qubits": [9], "gate": "id", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0003155501728177163, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "id_9"}, {"qubits": [9], "gate": "u1", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 0.0, "name": "gate_length"}], "name": "u1_9"}, {"qubits": [9], "gate": "u2", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0003155501728177163, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "u2_9"}, {"qubits": [9], "gate": "u3", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0006311003456354326, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 71.11111111111111, "name": "gate_length"}], "name": "u3_9"}, {"qubits": [10], "gate": "id", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.0005368264006968577, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "id_10"}, {"qubits": [10], "gate": "u1", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.0, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 0.0, "name": "gate_length"}], "name": "u1_10"}, {"qubits": [10], "gate": "u2", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.0005368264006968577, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "u2_10"}, {"qubits": [10], "gate": "u3", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.0010736528013937153, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 71.11111111111111, "name": "gate_length"}], "name": "u3_10"}, {"qubits": [11], "gate": "id", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0004105472539004482, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "id_11"}, {"qubits": [11], "gate": "u1", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 0.0, "name": "gate_length"}], "name": "u1_11"}, {"qubits": [11], "gate": "u2", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0004105472539004482, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "u2_11"}, {"qubits": [11], "gate": "u3", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0008210945078008964, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 71.11111111111111, "name": "gate_length"}], "name": "u3_11"}, {"qubits": [12], "gate": "id", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.0027345208771739214, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "id_12"}, {"qubits": [12], "gate": "u1", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.0, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 0.0, "name": "gate_length"}], "name": "u1_12"}, {"qubits": [12], "gate": "u2", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.0027345208771739214, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "u2_12"}, {"qubits": [12], "gate": "u3", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.005469041754347843, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 71.11111111111111, "name": "gate_length"}], "name": "u3_12"}, {"qubits": [13], "gate": "id", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0034136411938485564, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "id_13"}, {"qubits": [13], "gate": "u1", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 0.0, "name": "gate_length"}], "name": "u1_13"}, {"qubits": [13], "gate": "u2", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0034136411938485564, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "u2_13"}, {"qubits": [13], "gate": "u3", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.006827282387697113, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 71.11111111111111, "name": "gate_length"}], "name": "u3_13"}, {"qubits": [14], "gate": "id", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.0003519344587204795, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "id_14"}, {"qubits": [14], "gate": "u1", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.0, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 0.0, "name": "gate_length"}], "name": "u1_14"}, {"qubits": [14], "gate": "u2", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.0003519344587204795, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "u2_14"}, {"qubits": [14], "gate": "u3", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.000703868917440959, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 71.11111111111111, "name": "gate_length"}], "name": "u3_14"}, {"qubits": [15], "gate": "id", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0016090282661921586, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "id_15"}, {"qubits": [15], "gate": "u1", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 0.0, "name": "gate_length"}], "name": "u1_15"}, {"qubits": [15], "gate": "u2", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0016090282661921586, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "u2_15"}, {"qubits": [15], "gate": "u3", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.003218056532384317, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 71.11111111111111, "name": "gate_length"}], "name": "u3_15"}, {"qubits": [16], "gate": "id", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.00036655471720775684, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "id_16"}, {"qubits": [16], "gate": "u1", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.0, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 0.0, "name": "gate_length"}], "name": "u1_16"}, {"qubits": [16], "gate": "u2", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.00036655471720775684, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "u2_16"}, {"qubits": [16], "gate": "u3", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.0007331094344155137, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 71.11111111111111, "name": "gate_length"}], "name": "u3_16"}, {"qubits": [17], "gate": "id", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.00028697003074466967, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "id_17"}, {"qubits": [17], "gate": "u1", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 0.0, "name": "gate_length"}], "name": "u1_17"}, {"qubits": [17], "gate": "u2", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.00028697003074466967, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "u2_17"}, {"qubits": [17], "gate": "u3", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0005739400614893393, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 71.11111111111111, "name": "gate_length"}], "name": "u3_17"}, {"qubits": [18], "gate": "id", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.0003816864785326346, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "id_18"}, {"qubits": [18], "gate": "u1", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.0, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 0.0, "name": "gate_length"}], "name": "u1_18"}, {"qubits": [18], "gate": "u2", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.0003816864785326346, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "u2_18"}, {"qubits": [18], "gate": "u3", "parameters": [{"date": "2019-10-07T10:29:19+00:00", "unit": "", "value": 0.0007633729570652692, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 71.11111111111111, "name": "gate_length"}], "name": "u3_18"}, {"qubits": [19], "gate": "id", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0003179681265439094, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "id_19"}, {"qubits": [19], "gate": "u1", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 0.0, "name": "gate_length"}], "name": "u1_19"}, {"qubits": [19], "gate": "u2", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0003179681265439094, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 35.55555555555556, "name": "gate_length"}], "name": "u2_19"}, {"qubits": [19], "gate": "u3", "parameters": [{"date": "2019-10-07T10:27:19+00:00", "unit": "", "value": 0.0006359362530878187, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 71.11111111111111, "name": "gate_length"}], "name": "u3_19"}, {"qubits": [0, 1], "gate": "cx", "parameters": [{"date": "2019-10-07T10:56:40+00:00", "unit": "", "value": 0.016951800122571692, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 504.88888888888886, "name": "gate_length"}], "name": "cx0_1"}, {"qubits": [1, 0], "gate": "cx", "parameters": [{"date": "2019-10-07T10:56:40+00:00", "unit": "", "value": 0.016951800122571692, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 504.88888888888886, "name": "gate_length"}], "name": "cx1_0"}, {"qubits": [1, 2], "gate": "cx", "parameters": [{"date": "2019-10-07T11:13:55+00:00", "unit": "", "value": 0.03515653355748438, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 440.88888888888886, "name": "gate_length"}], "name": "cx1_2"}, {"qubits": [1, 6], "gate": "cx", "parameters": [{"date": "2019-10-07T11:20:02+00:00", "unit": "", "value": 0.015497896558171687, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 398.2222222222222, "name": "gate_length"}], "name": "cx1_6"}, {"qubits": [2, 1], "gate": "cx", "parameters": [{"date": "2019-10-07T11:13:55+00:00", "unit": "", "value": 0.03515653355748438, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 440.88888888888886, "name": "gate_length"}], "name": "cx2_1"}, {"qubits": [2, 3], "gate": "cx", "parameters": [{"date": "2019-10-07T11:37:38+00:00", "unit": "", "value": 0.0160990621644867, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 405.3333333333333, "name": "gate_length"}], "name": "cx2_3"}, {"qubits": [3, 2], "gate": "cx", "parameters": [{"date": "2019-10-07T11:37:38+00:00", "unit": "", "value": 0.0160990621644867, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 405.3333333333333, "name": "gate_length"}], "name": "cx3_2"}, {"qubits": [3, 4], "gate": "cx", "parameters": [{"date": "2019-10-07T11:55:00+00:00", "unit": "", "value": 0.011826337096007389, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 568.8888888888889, "name": "gate_length"}], "name": "cx3_4"}, {"qubits": [3, 8], "gate": "cx", "parameters": [{"date": "2019-10-07T12:12:23+00:00", "unit": "", "value": 0.02454490012996005, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 419.55555555555554, "name": "gate_length"}], "name": "cx3_8"}, {"qubits": [4, 3], "gate": "cx", "parameters": [{"date": "2019-10-07T11:55:00+00:00", "unit": "", "value": 0.011826337096007389, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 568.8888888888889, "name": "gate_length"}], "name": "cx4_3"}, {"qubits": [5, 6], "gate": "cx", "parameters": [{"date": "2019-10-07T12:29:49+00:00", "unit": "", "value": 0.02021153777322543, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 590.2222222222222, "name": "gate_length"}], "name": "cx5_6"}, {"qubits": [5, 10], "gate": "cx", "parameters": [{"date": "2019-10-07T14:13:49+00:00", "unit": "", "value": 0.015922830657213644, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 711.1111111111111, "name": "gate_length"}], "name": "cx5_10"}, {"qubits": [6, 1], "gate": "cx", "parameters": [{"date": "2019-10-07T11:20:02+00:00", "unit": "", "value": 0.015497896558171687, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 398.2222222222222, "name": "gate_length"}], "name": "cx6_1"}, {"qubits": [6, 5], "gate": "cx", "parameters": [{"date": "2019-10-07T12:29:49+00:00", "unit": "", "value": 0.02021153777322543, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 590.2222222222222, "name": "gate_length"}], "name": "cx6_5"}, {"qubits": [6, 7], "gate": "cx", "parameters": [{"date": "2019-10-07T12:47:04+00:00", "unit": "", "value": 0.013273348749692243, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 540.4444444444445, "name": "gate_length"}], "name": "cx6_7"}, {"qubits": [7, 6], "gate": "cx", "parameters": [{"date": "2019-10-07T12:47:04+00:00", "unit": "", "value": 0.013273348749692243, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 540.4444444444445, "name": "gate_length"}], "name": "cx7_6"}, {"qubits": [7, 8], "gate": "cx", "parameters": [{"date": "2019-10-07T13:04:16+00:00", "unit": "", "value": 0.016090620555644725, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 462.2222222222222, "name": "gate_length"}], "name": "cx7_8"}, {"qubits": [7, 12], "gate": "cx", "parameters": [{"date": "2019-10-07T13:21:38+00:00", "unit": "", "value": 0.011384053501933722, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 490.66666666666663, "name": "gate_length"}], "name": "cx7_12"}, {"qubits": [8, 3], "gate": "cx", "parameters": [{"date": "2019-10-07T12:12:23+00:00", "unit": "", "value": 0.02454490012996005, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 419.55555555555554, "name": "gate_length"}], "name": "cx8_3"}, {"qubits": [8, 7], "gate": "cx", "parameters": [{"date": "2019-10-07T13:04:16+00:00", "unit": "", "value": 0.016090620555644725, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 462.2222222222222, "name": "gate_length"}], "name": "cx8_7"}, {"qubits": [8, 9], "gate": "cx", "parameters": [{"date": "2019-10-07T13:39:02+00:00", "unit": "", "value": 0.014462795657984778, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 248.88888888888889, "name": "gate_length"}], "name": "cx8_9"}, {"qubits": [9, 8], "gate": "cx", "parameters": [{"date": "2019-10-07T13:39:02+00:00", "unit": "", "value": 0.014462795657984778, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 248.88888888888889, "name": "gate_length"}], "name": "cx9_8"}, {"qubits": [9, 14], "gate": "cx", "parameters": [{"date": "2019-10-07T13:56:21+00:00", "unit": "", "value": 0.010910395045313853, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 348.4444444444444, "name": "gate_length"}], "name": "cx9_14"}, {"qubits": [10, 5], "gate": "cx", "parameters": [{"date": "2019-10-07T14:13:49+00:00", "unit": "", "value": 0.015922830657213644, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 711.1111111111111, "name": "gate_length"}], "name": "cx10_5"}, {"qubits": [10, 11], "gate": "cx", "parameters": [{"date": "2019-10-07T14:35:42+00:00", "unit": "", "value": 0.010285529834766077, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 426.66666666666663, "name": "gate_length"}], "name": "cx10_11"}, {"qubits": [11, 10], "gate": "cx", "parameters": [{"date": "2019-10-07T14:35:42+00:00", "unit": "", "value": 0.010285529834766077, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 426.66666666666663, "name": "gate_length"}], "name": "cx11_10"}, {"qubits": [11, 12], "gate": "cx", "parameters": [{"date": "2019-10-07T14:57:14+00:00", "unit": "", "value": 0.02382591530175221, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 440.88888888888886, "name": "gate_length"}], "name": "cx11_12"}, {"qubits": [11, 16], "gate": "cx", "parameters": [{"date": "2019-10-07T16:09:43+00:00", "unit": "", "value": 0.01296503598444329, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 533.3333333333333, "name": "gate_length"}], "name": "cx11_16"}, {"qubits": [12, 7], "gate": "cx", "parameters": [{"date": "2019-10-07T13:21:38+00:00", "unit": "", "value": 0.011384053501933722, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 490.66666666666663, "name": "gate_length"}], "name": "cx12_7"}, {"qubits": [12, 11], "gate": "cx", "parameters": [{"date": "2019-10-07T14:57:14+00:00", "unit": "", "value": 0.02382591530175221, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 440.88888888888886, "name": "gate_length"}], "name": "cx12_11"}, {"qubits": [12, 13], "gate": "cx", "parameters": [{"date": "2019-10-07T15:14:44+00:00", "unit": "", "value": 0.0634606351390915, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 1045.3333333333333, "name": "gate_length"}], "name": "cx12_13"}, {"qubits": [13, 12], "gate": "cx", "parameters": [{"date": "2019-10-07T15:14:44+00:00", "unit": "", "value": 0.0634606351390915, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 1045.3333333333333, "name": "gate_length"}], "name": "cx13_12"}, {"qubits": [13, 14], "gate": "cx", "parameters": [{"date": "2019-10-07T15:50:34+00:00", "unit": "", "value": 0.02584357040051538, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 369.77777777777777, "name": "gate_length"}], "name": "cx13_14"}, {"qubits": [13, 18], "gate": "cx", "parameters": [{"date": "2019-10-07T15:33:08+00:00", "unit": "", "value": 0.02862492489048793, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 568.8888888888889, "name": "gate_length"}], "name": "cx13_18"}, {"qubits": [14, 9], "gate": "cx", "parameters": [{"date": "2019-10-07T13:56:21+00:00", "unit": "", "value": 0.010910395045313853, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 348.4444444444444, "name": "gate_length"}], "name": "cx14_9"}, {"qubits": [14, 13], "gate": "cx", "parameters": [{"date": "2019-10-07T15:50:34+00:00", "unit": "", "value": 0.02584357040051538, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 369.77777777777777, "name": "gate_length"}], "name": "cx14_13"}, {"qubits": [15, 16], "gate": "cx", "parameters": [{"date": "2019-10-07T16:32:14+00:00", "unit": "", "value": 0.013742969331295318, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 391.1111111111111, "name": "gate_length"}], "name": "cx15_16"}, {"qubits": [16, 11], "gate": "cx", "parameters": [{"date": "2019-10-07T16:09:43+00:00", "unit": "", "value": 0.01296503598444329, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 533.3333333333333, "name": "gate_length"}], "name": "cx16_11"}, {"qubits": [16, 15], "gate": "cx", "parameters": [{"date": "2019-10-07T16:32:14+00:00", "unit": "", "value": 0.013742969331295318, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 391.1111111111111, "name": "gate_length"}], "name": "cx16_15"}, {"qubits": [16, 17], "gate": "cx", "parameters": [{"date": "2019-10-07T16:49:53+00:00", "unit": "", "value": 0.012724327435765598, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 554.6666666666666, "name": "gate_length"}], "name": "cx16_17"}, {"qubits": [17, 16], "gate": "cx", "parameters": [{"date": "2019-10-07T16:49:53+00:00", "unit": "", "value": 0.012724327435765598, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 554.6666666666666, "name": "gate_length"}], "name": "cx17_16"}, {"qubits": [17, 18], "gate": "cx", "parameters": [{"date": "2019-10-07T17:07:15+00:00", "unit": "", "value": 0.0116296454858979, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 760.8888888888888, "name": "gate_length"}], "name": "cx17_18"}, {"qubits": [18, 13], "gate": "cx", "parameters": [{"date": "2019-10-07T15:33:08+00:00", "unit": "", "value": 0.02862492489048793, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 568.8888888888889, "name": "gate_length"}], "name": "cx18_13"}, {"qubits": [18, 17], "gate": "cx", "parameters": [{"date": "2019-10-07T17:07:15+00:00", "unit": "", "value": 0.0116296454858979, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 760.8888888888888, "name": "gate_length"}], "name": "cx18_17"}, {"qubits": [18, 19], "gate": "cx", "parameters": [{"date": "2019-10-07T17:24:07+00:00", "unit": "", "value": 0.009729516587356962, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 533.3333333333333, "name": "gate_length"}], "name": "cx18_19"}, {"qubits": [19, 18], "gate": "cx", "parameters": [{"date": "2019-10-07T17:24:07+00:00", "unit": "", "value": 0.009729516587356962, "name": "gate_error"}, {"date": "2019-10-07T17:24:07+00:00", "unit": "ns", "value": 533.3333333333333, "name": "gate_length"}], "name": "cx19_18"}], "backend_version": "1.0.10", "backend_name": "ibmq_singapore", "last_update_date": "2019-10-07T17:24:07+00:00"} \ No newline at end of file diff --git a/test/benchmarks/mapping_passes.py b/test/benchmarks/mapping_passes.py index b33ed36915d8..e80d3c6345b9 100644 --- a/test/benchmarks/mapping_passes.py +++ b/test/benchmarks/mapping_passes.py @@ -19,8 +19,8 @@ from qiskit.transpiler import CouplingMap from qiskit.transpiler.passes import * from qiskit.converters import circuit_to_dag +from qiskit.providers.fake_provider import FakeSingapore -from .backends import fake_singapore from .utils import random_circuit @@ -61,7 +61,7 @@ def setup(self, n_qubits, depth): apply_pass = ApplyLayout() apply_pass.property_set['layout'] = self.layout self.dag = apply_pass.run(self.enlarge_dag) - self.backend_props = fake_singapore.FakeSingapore().properties() + self.backend_props = FakeSingapore().properties() def time_stochastic_swap(self, _, __): swap = StochasticSwap(self.coupling_map, seed=42) @@ -156,7 +156,7 @@ def setup(self, n_qubits, depth): apply_pass = ApplyLayout() apply_pass.property_set['layout'] = self.layout self.dag = apply_pass.run(self.enlarge_dag) - self.backend_props = fake_singapore.FakeSingapore().properties() + self.backend_props = FakeSingapore().properties() self.routed_dag = StochasticSwap(self.coupling_map, seed=42).run(self.dag) diff --git a/test/benchmarks/pulse/schedule_to_instruction_conversion.py b/test/benchmarks/pulse/schedule_to_instruction_conversion.py index 31ce137a913c..c48f670fe7af 100644 --- a/test/benchmarks/pulse/schedule_to_instruction_conversion.py +++ b/test/benchmarks/pulse/schedule_to_instruction_conversion.py @@ -18,7 +18,7 @@ from qiskit import schedule, QuantumCircuit, QuantumRegister from qiskit.circuit import Gate from qiskit.pulse import Schedule, Gaussian, DriveChannel, Play -from ..backends.fake_openpulse import FakeOpenPulse2Q +from qiskit.providers.fake_provider import FakeOpenPulse2Q def build_parametric_pulse_schedule(number_of_unique_pulses, diff --git a/test/benchmarks/transpiler_levels.py b/test/benchmarks/transpiler_levels.py index 595521c88506..9e6e3ecabb82 100644 --- a/test/benchmarks/transpiler_levels.py +++ b/test/benchmarks/transpiler_levels.py @@ -20,8 +20,8 @@ from qiskit.compiler import transpile from qiskit import QuantumCircuit from qiskit.transpiler import InstructionDurations +from qiskit.providers.fake_provider import FakeMelbourne -from .backends.fake_melbourne import FakeMelbourne from .utils import build_qv_model_circuit From 85929a9a6f5aa2cfa6ccdc57a8d3d6644e0fa7ba Mon Sep 17 00:00:00 2001 From: "Christopher J. Wood" Date: Thu, 5 May 2022 08:58:54 -0400 Subject: [PATCH 54/61] Replace ignis benchmarks with qiskit-experiments (Qiskit/qiskit-metapackage#1488) * Replace ignis benchmarks with qiskit-experiments * Simplify tomography benchmark * remove ignis from asv conf * Remove whitespace * Apply suggestions from code review Co-authored-by: Matthew Treinish * Fix typo Co-authored-by: Matthew Treinish --- test/benchmarks/randomized_benchmarking.py | 45 +++++++++------------- test/benchmarks/state_tomography.py | 42 ++++++++------------ 2 files changed, 35 insertions(+), 52 deletions(-) diff --git a/test/benchmarks/randomized_benchmarking.py b/test/benchmarks/randomized_benchmarking.py index dcb21d9d3273..fbcdf1737f78 100644 --- a/test/benchmarks/randomized_benchmarking.py +++ b/test/benchmarks/randomized_benchmarking.py @@ -14,12 +14,11 @@ # pylint: disable=no-member,invalid-name,missing-docstring,no-name-in-module # pylint: disable=attribute-defined-outside-init,unsubscriptable-object - -"""Module for estimating randomized benchmarking.""" +# pylint: disable=import-error import os import numpy as np -import qiskit.ignis.verification.randomized_benchmarking as rb +from qiskit_experiments.library import StandardRB try: from qiskit.compiler import transpile @@ -29,9 +28,7 @@ TRANSPILER_SEED_KEYWORD = 'seed_mapper' -def build_rb_circuit(nseeds=1, length_vector=None, - rb_pattern=None, length_multiplier=1, - seed_offset=0, align_cliffs=False, seed=None): +def build_rb_circuit(qubits, length_vector, num_samples=1, seed=None): """ Randomized Benchmarking sequences. """ @@ -39,45 +36,39 @@ def build_rb_circuit(nseeds=1, length_vector=None, np.random.seed(10) else: np.random.seed(seed) - rb_opts = {} - rb_opts['nseeds'] = nseeds - rb_opts['length_vector'] = length_vector - rb_opts['rb_pattern'] = rb_pattern - rb_opts['length_multiplier'] = length_multiplier - rb_opts['seed_offset'] = seed_offset - rb_opts['align_cliffs'] = align_cliffs # Generate the sequences try: - rb_circs, _ = rb.randomized_benchmarking_seq(**rb_opts) + rb_exp = StandardRB( + qubits, + lengths=length_vector, + num_samples=num_samples, + seed=seed, + ) except OSError: skip_msg = ('Skipping tests because ' 'tables are missing') raise NotImplementedError(skip_msg) - all_circuits = [] - for seq in rb_circs: - all_circuits += seq - return all_circuits + return rb_exp.circuits() class RandomizedBenchmarkingBenchmark: # parameters for RB (1&2 qubits): params = ([ - [[0]], # Single qubit RB - [[0, 1]], # Two qubit RB - [[0, 1], [2]] # Simultaneous RB + [0], # Single qubit RB + [0, 1], # Two qubit RB ],) - param_names = ['rb_pattern'] - version = '0.6.0' + param_names = ['qubits'] + version = '0.3.0' timeout = 600 - def setup(self, rb_pattern): + def setup(self, qubits): length_vector = np.arange(1, 200, 4) - nseeds = 1 + num_samples = 1 self.seed = 10 - self.circuits = build_rb_circuit(nseeds=nseeds, + self.circuits = build_rb_circuit(qubits=qubits, length_vector=length_vector, - rb_pattern=rb_pattern, + num_samples=num_samples, seed=self.seed) def teardown(self, _): diff --git a/test/benchmarks/state_tomography.py b/test/benchmarks/state_tomography.py index 7095a9b74b72..ce96c30ea075 100644 --- a/test/benchmarks/state_tomography.py +++ b/test/benchmarks/state_tomography.py @@ -14,40 +14,33 @@ # pylint: disable=missing-docstring,invalid-name,no-member,broad-except # pylint: disable=no-else-return, attribute-defined-outside-init - -from qiskit.ignis.verification import tomography as tomo +# pylint: disable=import-error import qiskit -from qiskit.quantum_info import state_fidelity +from qiskit_experiments.library import StateTomography class StateTomographyBench: params = [2, 3, 4, 5] param_names = ['n_qubits'] - version = '0.6.0' + version = '0.3.0' timeout = 120.0 def setup(self, _): - self.sv_backend = qiskit.BasicAer.get_backend('statevector_simulator') self.qasm_backend = qiskit.BasicAer.get_backend('qasm_simulator') def time_state_tomography_bell(self, n_qubits): - qr = qiskit.QuantumRegister(2) - bell = qiskit.QuantumCircuit(qr) - bell.h(qr[0]) - bell.cx(qr[0], qr[1]) - psi_bell = qiskit.execute( - bell, self.sv_backend).result().get_statevector(bell) + meas_qubits = [n_qubits - 2, n_qubits - 1] qr_full = qiskit.QuantumRegister(n_qubits) bell = qiskit.QuantumCircuit(qr_full) - bell.h(qr_full[n_qubits - 2]) - bell.cx(qr_full[n_qubits - 2], qr_full[n_qubits - 1]) - qst_bell = tomo.state_tomography_circuits(bell, - [qr_full[n_qubits - 2], - qr_full[n_qubits - 1]]) - job = qiskit.execute(qst_bell, self.qasm_backend, shots=5000) - rho_bell = tomo.StateTomographyFitter(job.result(), qst_bell).fit() - state_fidelity(psi_bell, rho_bell) + bell.h(qr_full[meas_qubits[0]]) + bell.cx(qr_full[meas_qubits[0]], qr_full[meas_qubits[1]]) + + qst_exp = StateTomography(bell, measurement_qubits=meas_qubits) + expdata = qst_exp.run( + self.qasm_backend, shots=5000).block_for_results() + expdata.analysis_results("state") + expdata.analysis_results("state_fidelity") def time_state_tomography_cat(self, n_qubits): qr = qiskit.QuantumRegister(n_qubits, 'qr') @@ -55,9 +48,8 @@ def time_state_tomography_cat(self, n_qubits): circ.h(qr[0]) for i in range(1, n_qubits): circ.cx(qr[0], qr[i]) - psi = qiskit.execute(circ, self.sv_backend).result().get_statevector() - qst_circ = tomo.state_tomography_circuits(circ, qr) - tomo_result = qiskit.execute( - qst_circ, self.qasm_backend, shots=5000).result() - rho = tomo.StateTomographyFitter(tomo_result, qst_circ).fit() - state_fidelity(psi, rho) + qst_exp = StateTomography(circ) + expdata = qst_exp.run( + self.qasm_backend, shots=5000).block_for_results() + expdata.analysis_results("state") + expdata.analysis_results("state_fidelity") From 79ff6ecbf28f2cc0d1470824c3e426f72fb438ce Mon Sep 17 00:00:00 2001 From: Naoki Kanazawa Date: Tue, 27 Sep 2022 00:14:42 +0900 Subject: [PATCH 55/61] Update pulse benchmarking suite (Qiskit/qiskit-metapackage#1607) - Add pulse defaults loading test. This mainly measures instmap construction. - Add lowering test. This measures conversion of block -> schedule. - Add ECR building tests with three major approaches. - Add parameterized block test with parameter scan, assuming calibration --- test/benchmarks/pulse/load_pulse_defaults.py | 582 ++++++++++++++++++ .../benchmarks/pulse/schedule_construction.py | 209 +++++-- test/benchmarks/pulse/schedule_lowering.py | 88 +++ .../schedule_to_instruction_conversion.py | 59 -- 4 files changed, 824 insertions(+), 114 deletions(-) create mode 100644 test/benchmarks/pulse/load_pulse_defaults.py create mode 100644 test/benchmarks/pulse/schedule_lowering.py delete mode 100644 test/benchmarks/pulse/schedule_to_instruction_conversion.py diff --git a/test/benchmarks/pulse/load_pulse_defaults.py b/test/benchmarks/pulse/load_pulse_defaults.py new file mode 100644 index 000000000000..a6a7f828ab17 --- /dev/null +++ b/test/benchmarks/pulse/load_pulse_defaults.py @@ -0,0 +1,582 @@ +# -*- coding: utf-8 -* + +# This code is part of Qiskit. +# +# (C) Copyright IBM 2020. +# +# This code is licensed under the Apache License, Version 2.0. You may +# obtain a copy of this license in the LICENSE.txt file in the root directory +# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. +# +# Any modifications or derivative works of this code must retain this +# copyright notice, and modified files need to carry a notice indicating +# that they have been altered from the originals. + +# pylint: disable=missing-docstring,invalid-name,no-member +# pylint: disable=attribute-defined-outside-init + +import numpy as np + +from qiskit.providers.models import PulseDefaults +from qiskit.compiler import schedule +from qiskit.circuit import QuantumCircuit, Gate + + +def gen_source(num_random_gate): + + # minimum data to instantiate pulse defaults. + # cmd def contains cx, rz, sx, u3, measure + # and random gate (custom waveform of 100 dt + 2 fc) + + qobj_dict = { + "qubit_freq_est": [5.0, 5.1], + "meas_freq_est": [7.0, 7.0], + "buffer": 0, + "pulse_library": [], + "cmd_def": [ + { + "name": "cx", + "qubits": [0, 1], + "sequence": [ + { + "ch": "d0", + "name": "fc", + "phase": -3.141592653589793, + "t0": 0, + }, + { + "ch": "d0", + "label": "Y90p_d0", + "name": "parametric_pulse", + "parameters": { + "amp": ( + 0.0022743565483134 + 0.14767107967944j + ), + "beta": 0.5218372954777448, + "duration": 96, + "sigma": 24, + }, + "pulse_shape": "drag", + "t0": 0 + }, + { + "ch": "d0", + "label": "CR90p_d0_u1", + "name": "parametric_pulse", + "parameters": { + "amp": ( + 0.03583301328943 - 0.0006486874906466j + ), + "duration": 1104, + "sigma": 64, + "width": 848, + }, + "pulse_shape": "gaussian_square", + "t0": 96, + }, + { + "ch": "d0", + "label": "CR90m_d0_u1", + "name": "parametric_pulse", + "parameters": { + "amp": ( + -0.03583301328943 + 0.000648687490646j + ), + "duration": 1104, + "sigma": 64, + "width": 848, + }, + "pulse_shape": "gaussian_square", + "t0": 1296, + }, + { + "ch": "d0", + "name": "fc", + "phase": -1.5707963267948966, + "t0": 2400, + }, + { + "ch": "d0", + "label": "X90p_d0", + "name": "parametric_pulse", + "parameters": { + "amp": ( + 0.14766707017470 - 0.002521280908868j + ), + "beta": 0.5218372954777448, + "duration": 96, + "sigma": 24, + }, + "pulse_shape": "drag", + "t0": 2400, + }, + { + "ch": "d1", + "name": "fc", + "phase": -1.5707963267948966, + "t0": 0, + }, + { + "ch": "d1", + "label": "X90p_d1", + "name": "parametric_pulse", + "parameters": { + "amp": ( + 0.19074973504459 + 0.004525711677119j + ), + "beta": -1.2815198779814807, + "duration": 96, + "sigma": 24, + }, + "pulse_shape": "drag", + "t0": 0, + }, + { + "ch": "d1", + "label": "Xp_d1", + "name": "parametric_pulse", + "parameters": { + "amp": (0.3872223088586379 + 0j), + "beta": -1.498502772395478, + "duration": 96, + "sigma": 24, + }, + "pulse_shape": "drag", + "t0": 1200, + }, + { + "ch": "d1", + "label": "Y90m_d1", + "name": "parametric_pulse", + "parameters": { + "amp": ( + 0.00285052543950 - 0.19078212177897j + ), + "beta": -1.2815198779814807, + "duration": 96, + "sigma": 24, + }, + "pulse_shape": "drag", + "t0": 2400, + }, + { + "ch": "u0", + "name": "fc", + "phase": -1.5707963267948966, + "t0": 0, + }, + { + "ch": "u1", + "name": "fc", + "phase": -3.141592653589793, + "t0": 0, + }, + { + "ch": "u1", + "label": "CR90p_u1", + "name": "parametric_pulse", + "parameters": { + "amp": ( + -0.1629668182698 - 0.8902610676540j + ), + "duration": 1104, + "sigma": 64, + "width": 848, + }, + "pulse_shape": "gaussian_square", + "t0": 96, + }, + { + "ch": "u1", + "label": "CR90m_u1", + "name": "parametric_pulse", + "parameters": { + "amp": ( + 0.16296681826986 + 0.8902610676540j + ), + "duration": 1104, + "sigma": 64, + "width": 848, + }, + "pulse_shape": "gaussian_square", + "t0": 1296, + }, + { + "ch": "u1", + "name": "fc", + "phase": -1.5707963267948966, + "t0": 2400, + }, + ], + }, + { + "name": "rz", + "qubits": [0], + "sequence": [ + { + "ch": "d0", + "name": "fc", + "phase": "-(P0)", + "t0": 0, + }, + { + "ch": "u1", + "name": "fc", + "phase": "-(P0)", + "t0": 0, + }, + ], + }, + { + "name": "rz", + "qubits": [1], + "sequence": [ + { + "ch": "d1", + "name": "fc", + "phase": "-(P0)", + "t0": 0, + }, + { + "ch": "u0", + "name": "fc", + "phase": "-(P0)", + "t0": 0, + }, + ], + }, + { + "name": "sx", + "qubits": [0], + "sequence": [ + { + "ch": "d0", + "label": "X90p_d0", + "name": "parametric_pulse", + "parameters": { + "amp": ( + 0.14766707017470 - 0.002521280908868j + ), + "beta": 0.5218372954777448, + "duration": 96, + "sigma": 24, + }, + "pulse_shape": "drag", + "t0": 0, + } + ], + }, + { + "name": "sx", + "qubits": [1], + "sequence": [ + { + "ch": "d1", + "label": "X90p_d0", + "name": "parametric_pulse", + "parameters": { + "amp": ( + 0.19074973504459 + 0.004525711677119j + ), + "beta": -1.2815198779814807, + "duration": 96, + "sigma": 24, + }, + "pulse_shape": "drag", + "t0": 0, + } + ], + }, + { + "name": "u3", + "qubits": [0], + "sequence": [ + { + "ch": "d0", + "name": "fc", + "phase": "-(P2)", + "t0": 0, + }, + { + "ch": "d0", + "label": "X90p_d0", + "name": "parametric_pulse", + "parameters": { + "amp": ( + 0.14766707017470 - 0.002521280908868j + ), + "beta": 0.5218372954777448, + "duration": 96, + "sigma": 24, + }, + "pulse_shape": "drag", + "t0": 0, + }, + { + "ch": "d0", + "name": "fc", + "phase": "-(P0)", + "t0": 96, + }, + { + "ch": "d0", + "label": "X90m_d0", + "name": "parametric_pulse", + "parameters": { + "amp": ( + -0.14767107967944 + 0.002274356548313j + ), + "beta": 0.5218372954777448, + "duration": 96, + "sigma": 24, + }, + "pulse_shape": "drag", + "t0": 96, + }, + { + "ch": "d0", + "name": "fc", + "phase": "-(P1)", + "t0": 192, + }, + { + "ch": "u1", + "name": "fc", + "phase": "-(P2)", + "t0": 0, + }, + { + "ch": "u1", + "name": "fc", + "phase": "-(P0)", + "t0": 96, + }, + { + "ch": "u1", + "name": "fc", + "phase": "-(P1)", + "t0": 192, + }, + ], + }, + { + "name": "u3", + "qubits": [1], + "sequence": [ + { + "ch": "d1", + "name": "fc", + "phase": "-(P2)", + "t0": 0, + }, + { + "ch": "d1", + "label": "X90p_d1", + "name": "parametric_pulse", + "parameters": { + "amp": ( + 0.19074973504459 + 0.004525711677119j + ), + "beta": -1.2815198779814807, + "duration": 96, + "sigma": 24, + }, + "pulse_shape": "drag", + "t0": 0, + }, + { + "ch": "d1", + "name": "fc", + "phase": "-(P0)", + "t0": 96, + }, + { + "ch": "d1", + "label": "X90m_d1", + "name": "parametric_pulse", + "parameters": { + "amp": ( + -0.19078212177897 - 0.002850525439509j + ), + "beta": -1.2815198779814807, + "duration": 96, + "sigma": 24, + }, + "pulse_shape": "drag", + "t0": 96, + }, + { + "ch": "d1", + "name": "fc", + "phase": "-(P1)", + "t0": 192, + }, + { + "ch": "u0", + "name": "fc", + "phase": "-(P2)", + "t0": 0, + }, + { + "ch": "u0", + "name": "fc", + "phase": "-(P0)", + "t0": 96, + }, + { + "ch": "u0", + "name": "fc", + "phase": "-(P1)", + "t0": 192, + }, + ], + }, + { + "name": "measure", + "qubits": [0, 1], + "sequence": [ + { + "ch": "m0", + "label": "M_m0", + "name": "parametric_pulse", + "parameters": { + "amp": ( + -0.3003200790496 + 0.3069634566518j + ), + "duration": 1792, + "sigma": 64, + "width": 1536, + }, + "pulse_shape": "gaussian_square", + "t0": 0, + }, + { + "ch": "m1", + "label": "M_m1", + "name": "parametric_pulse", + "parameters": { + "amp": ( + 0.26292757124962 + 0.14446138680205j + ), + "duration": 1792, + "sigma": 64, + "width": 1536, + }, + "pulse_shape": "gaussian_square", + "t0": 0, + }, + { + "ch": "m0", + "duration": 1504, + "name": "delay", + "t0": 1792, + }, + { + "ch": "m1", + "duration": 1504, + "name": "delay", + "t0": 1792, + }, + { + "duration": 1792, + "memory_slot": [0, 1], + "name": "acquire", + "qubits": [0, 1], + "t0": 0, + }, + ], + }, + ] + } + + # add random waveform gate entries to increase overhead + for i in range(num_random_gate): + for qind in (0, 1): + samples = np.random.random(100) + + gate_name = f"ramdom_gate_{i}" + sample_name = f"random_sample_q{qind}_{i}" + + qobj_dict["pulse_library"].append( + { + "name": sample_name, + "samples": samples, + } + ) + qobj_dict["cmd_def"].append( + { + "name": gate_name, + "qubits": [qind], + "sequence": [ + { + "ch": f"d{qind}", + "name": "fc", + "phase": "-(P0)", + "t0": 0, + }, + { + "ch": f"d{qind}", + "label": gate_name, + "name": sample_name, + "t0": 0, + }, + { + "ch": f"d{qind}", + "name": "fc", + "phase": "(P0)", + "t0": 100, + }, + ], + }, + ) + + return qobj_dict + + +class PulseDefaultsBench: + + params = ([0, 10, 100, 1000], ) + param_names = ["number of random gates", ] + + def setup(self, num_random_gate): + self.source = gen_source(num_random_gate) + + def time_building_defaults(self, _): + PulseDefaults.from_dict(self.source) + + +class CircuitSchedulingBench: + + params = ([1, 2, 3, 15], ) + param_names = ["number of unit cell repetition", ] + + def setup(self, repeat_unit_cell): + source = gen_source(1) + defaults = PulseDefaults.from_dict(source) + + self.inst_map = defaults.instruction_schedule_map + self.meas_map = [[0, 1]] + self.dt = 0.222e-9 + + rng = np.random.default_rng(123) + + qc = QuantumCircuit(2) + for _ in range(repeat_unit_cell): + randdom_gate = Gate("ramdom_gate_0", 1, list(rng.random(1))) + qc.cx(0, 1) + qc.append(randdom_gate, [0]) + qc.sx(0) + qc.rz(1.57, 0) + qc.append(randdom_gate, [1]) + qc.sx(1) + qc.rz(1.57, 1) + qc.measure_all() + self.qc = qc + + def time_scheduling_circuits(self, _): + schedule( + self.qc, + inst_map=self.inst_map, + meas_map=self.meas_map, + dt=self.dt, + ) diff --git a/test/benchmarks/pulse/schedule_construction.py b/test/benchmarks/pulse/schedule_construction.py index f9f615d48a2d..bfaf60391e2d 100644 --- a/test/benchmarks/pulse/schedule_construction.py +++ b/test/benchmarks/pulse/schedule_construction.py @@ -17,64 +17,163 @@ import numpy as np -from qiskit.pulse import Schedule, Gaussian, DriveChannel, Play, Waveform +from qiskit.circuit import Parameter, QuantumCircuit, Gate +from qiskit.pulse import builder, library, channels -def build_sample_pulse_schedule(number_of_unique_pulses, number_of_channels): - rng = np.random.RandomState(42) - sched = Schedule() - for _ in range(number_of_unique_pulses): - for channel in range(number_of_channels): - sched.append( - Play(Waveform(rng.random(50)), DriveChannel(channel)), - inplace=True, +class EchoedCrossResonanceConstructionBench: + + def setup(self): + + with builder.build() as x_ctrl: + builder.play( + library.Drag(160, 0.2, 40, 1.5), + channels.DriveChannel(0), + ) + self.x_ctrl = x_ctrl + + with builder.build() as cr45p: + builder.play( + library.GaussianSquare(800, 0.4, 64, 544), + channels.ControlChannel(0), ) - return sched - - -def build_parametric_pulse_schedule(number_of_unique_pulses, - number_of_channels): - sched = Schedule() - for _ in range(number_of_unique_pulses): - for channel in range(number_of_channels): - sched.append( - Play( - Gaussian(duration=25, sigma=4, amp=0.5j), - DriveChannel(channel), - ), - inplace=True, + builder.play( + library.GaussianSquare(800, 0.1, 64, 544), + channels.DriveChannel(1), ) - return sched - - -class ScheduleConstructionBench: - params = ([1, 2, 5], [8, 128, 2048]) - param_names = ['number_of_unique_pulses', 'number_of_channels'] - timeout = 600 - - def setup(self, unique_pulses, channels): - self.sample_sched = build_sample_pulse_schedule(unique_pulses, - channels) - self.parametric_sched = build_parametric_pulse_schedule(unique_pulses, - channels) - - def time_sample_pulse_schedule_construction(self, - unique_pulses, - channels): - build_sample_pulse_schedule(unique_pulses, channels) - - def time_parametric_pulse_schedule_construction(self, - unique_pulses, - channels): - build_parametric_pulse_schedule(unique_pulses, channels) - - def time_append_instruction(self, _, __): - self.sample_sched.append(self.parametric_sched, inplace=True) - - def time_insert_instruction_left_to_right(self, _, __): - sched = self.sample_sched.shift(self.parametric_sched.stop_time) - sched.insert( - self.parametric_sched.start_time, - self.parametric_sched, + self.cr45p = cr45p + + def time_full_scratch(self): + # Full scratch in a single builder context + with builder.build(): + with builder.align_sequential(): + with builder.align_left(): + builder.play( + library.GaussianSquare(800, 0.4, 64, 544), + channels.ControlChannel(0), + ) + builder.play( + library.GaussianSquare(800, 0.1, 64, 544), + channels.DriveChannel(1), + ) + builder.play( + library.Drag(160, 0.2, 40, 1.5), + channels.DriveChannel(0), + ) + with builder.phase_offset( + np.pi, + channels.ControlChannel(0), + channels.DriveChannel(1), + ): + with builder.align_left(): + builder.play( + library.GaussianSquare(800, 0.4, 64, 544), + channels.ControlChannel(0), + ) + builder.play( + library.GaussianSquare(800, 0.1, 64, 544), + channels.DriveChannel(1), + ) + builder.play( + library.Drag(160, 0.2, 40, 1.5), + channels.DriveChannel(0), + ) + + def time_with_call(self): + # Call subroutine, internally creates reference and assign immediately + with builder.build(): + with builder.align_sequential(): + builder.call(self.cr45p) + builder.call(self.x_ctrl) + with builder.phase_offset( + np.pi, + channels.ControlChannel(0), + channels.DriveChannel(1), + ): + builder.call(self.cr45p) + builder.call(self.x_ctrl) + + def time_assign_later(self): + # Create placeholder and assign subroutine at a later time + with builder.build() as temp_sched: + with builder.align_sequential(): + builder.reference("cr45p", "q0", "q1") + builder.reference("x", "q0") + with builder.phase_offset( + np.pi, + channels.ControlChannel(0), + channels.DriveChannel(1), + ): + builder.reference("cr45p", "q0", "q1") + builder.reference("x", "q0") + + temp_sched.assign_references( + { + ("cr45p", "q0", "q1"): self.cr45p, + ("x", "q0"): self.x_ctrl, + }, inplace=True, ) + + +class ParameterizedScheduleBench: + + params = [3, 11, 31, 51] + + def setup(self, nscan): + self.p0 = Parameter("P0") + self.p1 = Parameter("P1") + self.p2 = Parameter("P2") + + with builder.build() as schedule: + builder.play( + library.Constant(self.p0, self.p1), + channels.DriveChannel(self.p2), + ) + self.schedule = schedule + + with builder.build() as outer_schedule: + builder.reference("subroutine") + outer_schedule.assign_references( + {("subroutine", ): schedule}, inplace=True + ) + self.outer_schedule = outer_schedule + + gate = Gate("my_gate", 1, [self.p0, self.p1, self.p2]) + qc = QuantumCircuit(1) + qc.append(gate, [0]) + qc.add_calibration(gate, (0,), schedule) + self.qc = qc + + # list of parameters + self.amps = np.linspace(-1, 1, nscan) + + def time_assign_single_schedule(self, _): + + out = [] + for amp in self.amps: + assigned = self.schedule.assign_parameters( + {self.p0: 100, self.p1: amp, self.p2: 0}, + inplace=False, + ) + out.append(assigned) + + def time_assign_parameterized_subroutine(self, _): + + out = [] + for amp in self.amps: + assigned = self.outer_schedule.assign_parameters( + {self.p0: 100, self.p1: amp, self.p2: 0}, + inplace=False, + ) + out.append(assigned) + + def time_assign_through_pulse_gate(self, _): + + out = [] + for amp in self.amps: + assigned = self.qc.assign_parameters( + {self.p0: 100, self.p1: amp, self.p2: 0}, + inplace=False, + ) + out.append(assigned) diff --git a/test/benchmarks/pulse/schedule_lowering.py b/test/benchmarks/pulse/schedule_lowering.py new file mode 100644 index 000000000000..0b8c2e4909a3 --- /dev/null +++ b/test/benchmarks/pulse/schedule_lowering.py @@ -0,0 +1,88 @@ +# -*- coding: utf-8 -* + +# This code is part of Qiskit. +# +# (C) Copyright IBM 2020. +# +# This code is licensed under the Apache License, Version 2.0. You may +# obtain a copy of this license in the LICENSE.txt file in the root directory +# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. +# +# Any modifications or derivative works of this code must retain this +# copyright notice, and modified files need to carry a notice indicating +# that they have been altered from the originals. + +# pylint: disable=missing-docstring,invalid-name,no-member +# pylint: disable=attribute-defined-outside-init + +import numpy as np + +from qiskit.pulse import builder, library, channels +from qiskit.pulse.transforms import target_qobj_transform + + +def build_complicated_schedule(): + + with builder.build() as schedule: + with builder.align_sequential(): + with builder.align_right(): + with builder.phase_offset(np.pi, channels.ControlChannel(2)): + with builder.align_sequential(): + for _ in range(5): + builder.play( + library.GaussianSquare(640, 0.1, 64, 384), + channels.ControlChannel(2), + ) + builder.play( + library.Constant(1920, 0.1), + channels.DriveChannel(1), + ) + builder.barrier( + channels.DriveChannel(0), + channels.DriveChannel(1), + channels.DriveChannel(2), + ) + builder.delay(800, channels.DriveChannel(1)) + with builder.align_left(): + builder.play( + library.Drag(160, 0.3, 40, 1.5), + channels.DriveChannel(0), + ) + builder.play( + library.Drag(320, 0.2, 80, 1.5), + channels.DriveChannel(1), + ) + builder.play( + library.Drag(480, 0.1, 120, 1.5), + channels.DriveChannel(2), + ) + builder.reference("sub") + with builder.align_left(): + for i in range(3): + builder.play( + library.GaussianSquare(1600, 0.1, 64, 1344), + channels.MeasureChannel(i), + ) + builder.acquire( + 1600, + channels.AcquireChannel(i), + channels.MemorySlot(i), + ) + + with builder.build() as subroutine: + for i in range(3): + samples = np.random.random(160) + builder.play(samples, channels.DriveChannel(i)) + schedule.assign_references({("sub", ): subroutine}, inplace=True) + + return schedule + + +class ScheduleLoweringBench: + + def setup(self): + self.schedule_block = build_complicated_schedule() + + def time_lowering(self): + # Lower schedule block to generate job payload + target_qobj_transform(self.schedule_block) diff --git a/test/benchmarks/pulse/schedule_to_instruction_conversion.py b/test/benchmarks/pulse/schedule_to_instruction_conversion.py deleted file mode 100644 index c48f670fe7af..000000000000 --- a/test/benchmarks/pulse/schedule_to_instruction_conversion.py +++ /dev/null @@ -1,59 +0,0 @@ -# -*- coding: utf-8 -* - -# This code is part of Qiskit. -# -# (C) Copyright IBM 2020. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -# pylint: disable=missing-docstring,invalid-name,no-member -# pylint: disable=attribute-defined-outside-init - -from qiskit import schedule, QuantumCircuit, QuantumRegister -from qiskit.circuit import Gate -from qiskit.pulse import Schedule, Gaussian, DriveChannel, Play -from qiskit.providers.fake_provider import FakeOpenPulse2Q - - -def build_parametric_pulse_schedule(number_of_unique_pulses, - number_of_channels): - sched = Schedule() - for _ in range(number_of_unique_pulses): - for channel in range(number_of_channels): - sched.append( - Play( - Gaussian(duration=25, sigma=4, amp=0.5j), - DriveChannel(channel), - ), - inplace=True, - ) - return sched - - -class ScheduleToInstructionBench: - params = ([1, 2, 5], [8, 128, 2048]) - param_names = ['number_of_unique_pulses', 'number_of_channels'] - timeout = 600 - - def setup(self, unique_pulses, channels): - self.parametric_sched = build_parametric_pulse_schedule(unique_pulses, - channels) - qr = QuantumRegister(1) - self.qc = QuantumCircuit(qr) - self.qc.append(Gate('my_pulse', 1, []), qargs=[qr[0]]) - self.backend = FakeOpenPulse2Q() - self.inst_map = self.backend.defaults().instruction_schedule_map - self.add_inst_map = self.inst_map - self.add_inst_map.add('my_pulse', [0], self.parametric_sched) - - def time_build_instruction(self, _, __): - self.inst_map.add('my_pulse', [0], self.parametric_sched) - - def time_instruction_to_schedule(self, _, __): - schedule(self.qc, self.backend, inst_map=self.add_inst_map) From 87518009c74256c8d27be3e94f894581e8b50b28 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Wed, 26 Oct 2022 17:38:26 -0400 Subject: [PATCH 56/61] Reduce number of permutations for assembler benchmarks (Qiskit/qiskit-metapackage#1621) When running the full benchmark suite the assembler benchmarks take a disproportionately large amount of time to run, especially given the relatively low current importance of the assemble() function. This was primarily due to the number of permutations of the benchmark we ran. At the time all those permutations were added to verify the scaling of the function because it was a potential bottleneck, but this is no longer a concern. This commit drops the parameter sweeps down so that we only run 2 combinations for assemble, basically a fixed sized circuit either by itself or as a batch of 100. This should drastically decrease the runtime cost of these benchmarks but still give us some data for the function moving forward. --- test/benchmarks/assembler.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/benchmarks/assembler.py b/test/benchmarks/assembler.py index d27fe8a7a96f..9da2fab3851e 100644 --- a/test/benchmarks/assembler.py +++ b/test/benchmarks/assembler.py @@ -22,9 +22,9 @@ class AssemblerBenchmarks: - params = ([1, 2, 5, 8], - [8, 128, 1024, 2048, 4096], - [1, 5, 10, 50, 100]) + params = ([8], + [4096], + [1, 100]) param_names = ['n_qubits', 'depth', 'number of circuits'] timeout = 600 version = 2 @@ -40,9 +40,9 @@ def time_assemble_circuit(self, _, __, ___): class DisassemblerBenchmarks: - params = ([1, 2, 5, 8], - [8, 128, 1024, 2048, 4096], - [1, 5, 10, 50, 100]) + params = ([8], + [4096], + [1, 100]) param_names = ['n_qubits', 'depth', 'number of circuits'] timeout = 600 From b97e7dfb40c2f0e33d0f37a67f4be0aec8f5ad1e Mon Sep 17 00:00:00 2001 From: Jake Lishman Date: Fri, 28 Oct 2022 17:14:53 +0100 Subject: [PATCH 57/61] Add benchmarks for Sabre on large QFT and QV circuits (Qiskit/qiskit-metapackage#1622) * Add benchmarks for Sabre on large QFT and QV circuits Sabre is capable of handling these large benchmarks now, and it's of interest for us to track our performance on large systems. We don't anticipate running on them yet, but we will want to know in the future when further changes to routing and memory usage improve these benchmarks. * Fix lint * Fix lint properly * Precalculate trackers to avoid recomputation The tracking benchmarks here naively require a recomputation of the expensive swap-mapping, despite use wanting to just reuse things we already calculated during the timing phase. `asv` doesn't let us return trackers from the timing benchmarks directly, but we can still reduce one load of redundancy by pre-calculating all the tracker properties we care about only once in the cached setup method, and then just feeding that state into the actual benchmarks to retrieve the results they care about. This is rather hacky, but does successfully work around functionality we would like in `asv` to reduce runtime. --- test/benchmarks/qft.py | 63 +++++++++++++++++++++++- test/benchmarks/quantum_volume.py | 79 +++++++++++++++++++++++++++++++ 2 files changed, 141 insertions(+), 1 deletion(-) diff --git a/test/benchmarks/qft.py b/test/benchmarks/qft.py index 1bf0ab289e3e..fd49a47afa35 100644 --- a/test/benchmarks/qft.py +++ b/test/benchmarks/qft.py @@ -15,9 +15,13 @@ # pylint: disable=missing-docstring,invalid-name,no-member # pylint: disable=attribute-defined-outside-init +import itertools import math from qiskit import QuantumRegister, QuantumCircuit +from qiskit.converters import circuit_to_dag +from qiskit.transpiler import CouplingMap +from qiskit.transpiler.passes import SabreSwap try: from qiskit.compiler import transpile except ImportError: @@ -33,7 +37,9 @@ def build_model_circuit(qreg, circuit=None): for i in range(n): for j in range(i): - circuit.cu1(math.pi/float(2**(i-j)), qreg[i], qreg[j]) + # Using negative exponents so we safely underflow to 0 rather than + # raise `OverflowError`. + circuit.cp(math.pi * (2.0 ** (j-i)), qreg[i], qreg[j]) circuit.h(qreg[i]) return circuit @@ -56,3 +62,58 @@ def time_ibmq_backend_transpile(self, _): basis_gates=['u1', 'u2', 'u3', 'cx', 'id'], coupling_map=coupling_map, seed_transpiler=20220125) + + +class LargeQFTMappingTimeBench: + timeout = 600.0 # seconds + + heavy_hex_size = {115: 7, 409: 13, 1081: 21} + params = ([115, 409, 1081], ["lookahead", "decay"]) + param_names = ["n_qubits", "heuristic"] + + def setup(self, n_qubits, _heuristic): + qr = QuantumRegister(n_qubits, name="q") + self.dag = circuit_to_dag(build_model_circuit(qr)) + self.coupling = CouplingMap.from_heavy_hex( + self.heavy_hex_size[n_qubits] + ) + + def time_sabre_swap(self, _n_qubits, heuristic): + pass_ = SabreSwap(self.coupling, heuristic, seed=2022_10_27, trials=1) + pass_.run(self.dag) + + +class LargeQFTMappingTrackBench: + timeout = 600.0 # seconds, needs to account for the _entire_ setup. + + heavy_hex_size = {115: 7, 409: 13, 1081: 21} + params = ([115, 409, 1081], ["lookahead", "decay"]) + param_names = ["n_qubits", "heuristic"] + + # The benchmarks take a significant amount of time to run, and we don't + # want to unnecessarily run things twice to get the two pieces of tracking + # information we're interested in. We cheat by using the setup cache to do + # all the calculation work only once, and then each tracker just quickly + # pulls the result from the cache to return, saving the duplication. + + def setup_cache(self): + def setup(n_qubits, heuristic): + qr = QuantumRegister(n_qubits, name="q") + dag = circuit_to_dag(build_model_circuit(qr)) + coupling = CouplingMap.from_heavy_hex( + self.heavy_hex_size[n_qubits] + ) + pass_ = SabreSwap(coupling, heuristic, seed=2022_10_27, trials=1) + return pass_.run(dag) + + state = {} + for params in itertools.product(*self.params): + dag = setup(*params) + state[params] = {"depth": dag.depth(), "size": dag.size()} + return state + + def track_depth_sabre_swap(self, state, *params): + return state[params]["depth"] + + def track_size_sabre_swap(self, state, *params): + return state[params]["size"] diff --git a/test/benchmarks/quantum_volume.py b/test/benchmarks/quantum_volume.py index e3b964df837e..08bcbbf773b2 100644 --- a/test/benchmarks/quantum_volume.py +++ b/test/benchmarks/quantum_volume.py @@ -21,9 +21,14 @@ """Module for estimating quantum volume. See arXiv:1811.12926 [quant-ph]""" +import itertools + import numpy as np from qiskit.compiler import transpile +from qiskit.converters import circuit_to_dag +from qiskit.transpiler import CouplingMap +from qiskit.transpiler.passes import SabreSwap from .utils import build_qv_model_circuit @@ -54,3 +59,77 @@ def time_ibmq_backend_transpile(self, _, translation): coupling_map=self.coupling_map, translation_method=translation, seed_transpiler=20220125) + + +class LargeQuantumVolumeMappingTimeBench: + timeout = 600.0 # seconds + heavy_hex_distance = {115: 7, 409: 13, 1081: 21} + allowed_sizes = {(115, 100), (115, 10), (409, 10), (1081, 10)} + n_qubits = sorted({n_qubits for n_qubits, _ in allowed_sizes}) + depths = sorted({depth for _, depth in allowed_sizes}) + + params = (n_qubits, depths, ["lookahead", "decay"]) + param_names = ["n_qubits", "depth", "heuristic"] + + def setup(self, n_qubits, depth, _): + if (n_qubits, depth) not in self.allowed_sizes: + raise NotImplementedError + seed = 2022_10_27 + self.dag = circuit_to_dag( + build_qv_model_circuit(n_qubits, depth, seed) + ) + self.coupling = CouplingMap.from_heavy_hex( + self.heavy_hex_distance[n_qubits] + ) + + def time_sabre_swap(self, _n_qubits, _depth, heuristic): + pass_ = SabreSwap(self.coupling, heuristic, seed=2022_10_27, trials=1) + pass_.run(self.dag) + + +class LargeQuantumVolumeMappingTrackBench: + timeout = 600.0 # seconds + + allowed_sizes = {(115, 100), (115, 10), (409, 10), (1081, 10)} + heuristics = ["lookahead", "decay"] + n_qubits = sorted({n_qubits for n_qubits, _ in allowed_sizes}) + depths = sorted({depth for _, depth in allowed_sizes}) + + params = (n_qubits, depths, heuristics) + param_names = ["n_qubits", "depth", "heuristic"] + + # The benchmarks take a significant amount of time to run, and we don't + # want to unnecessarily run things twice to get the two pieces of tracking + # information we're interested in. We cheat by using the setup cache to do + # all the calculation work only once, and then each tracker just quickly + # pulls the result from the cache to return, saving the duplication. + + def setup_cache(self): + heavy_hex_distance = {115: 7, 409: 13, 1081: 21} + seed = 2022_10_27 + + def setup(n_qubits, depth, heuristic): + dag = circuit_to_dag( + build_qv_model_circuit(n_qubits, depth, seed) + ) + coupling = CouplingMap.from_heavy_hex(heavy_hex_distance[n_qubits]) + return SabreSwap(coupling, heuristic, seed=seed, trials=1).run(dag) + + state = {} + for params in itertools.product(*self.params): + n_qubits, depth, _ = params + if (n_qubits, depth) not in self.allowed_sizes: + continue + dag = setup(*params) + state[params] = {"depth": dag.depth(), "size": dag.size()} + return state + + def setup(self, _state, n_qubits, depth, _heuristic): + if (n_qubits, depth) not in self.allowed_sizes: + raise NotImplementedError + + def track_depth_sabre_swap(self, state, *params): + return state[params]["depth"] + + def track_size_sabre_swap(self, state, *params): + return state[params]["size"] From f97b7b117117db47a577123d50558ca6b38cea89 Mon Sep 17 00:00:00 2001 From: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com> Date: Mon, 27 Feb 2023 07:01:52 -0600 Subject: [PATCH 58/61] Upgrade Pylint to 2.16 (Qiskit/qiskit-metapackage#1672) --- test/benchmarks/quantum_info.py | 4 +++- test/benchmarks/random_circuit_hex.py | 2 +- test/benchmarks/randomized_benchmarking.py | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/test/benchmarks/quantum_info.py b/test/benchmarks/quantum_info.py index d7d653fbcf69..12ce2d2d26db 100644 --- a/test/benchmarks/quantum_info.py +++ b/test/benchmarks/quantum_info.py @@ -16,11 +16,13 @@ # pylint: disable=attribute-defined-outside-init import random + +import numpy as np + from qiskit.quantum_info import random_clifford, Clifford, \ decompose_clifford, random_pauli, SparsePauliOp from qiskit.quantum_info.operators.symplectic.random import random_pauli_list from qiskit.quantum_info import random_cnotdihedral, CNOTDihedral -import numpy as np class RandomCliffordBench: diff --git a/test/benchmarks/random_circuit_hex.py b/test/benchmarks/random_circuit_hex.py index d9c1807d95dc..0211a987795b 100644 --- a/test/benchmarks/random_circuit_hex.py +++ b/test/benchmarks/random_circuit_hex.py @@ -56,7 +56,7 @@ def make_circuit_ring(nq, depth, seed): if HAS_RANDOM_UNITARY: u = random_unitary(2, seed).data else: - u = random_unitary_matrix(2) + u = random_unitary_matrix(2) # pylint: disable=used-before-assignment # noqa angles = decomposer.angles(u) qc.u3(angles[0], angles[1], angles[2], q[i]) diff --git a/test/benchmarks/randomized_benchmarking.py b/test/benchmarks/randomized_benchmarking.py index fbcdf1737f78..0211466b2117 100644 --- a/test/benchmarks/randomized_benchmarking.py +++ b/test/benchmarks/randomized_benchmarking.py @@ -48,7 +48,9 @@ def build_rb_circuit(qubits, length_vector, num_samples=1, seed=None): except OSError: skip_msg = ('Skipping tests because ' 'tables are missing') - raise NotImplementedError(skip_msg) + raise NotImplementedError( # pylint: disable=raise-missing-from + skip_msg + ) return rb_exp.circuits() From 6721850bfab1f7d9fca78cb48db1963b925d591e Mon Sep 17 00:00:00 2001 From: Jake Lishman Date: Tue, 1 Aug 2023 15:47:19 +0100 Subject: [PATCH 59/61] Run black on benchmark suite --- test/benchmarks/assembler.py | 18 +- test/benchmarks/circuit_construction.py | 26 +- test/benchmarks/converters.py | 5 +- test/benchmarks/import.py | 2 +- test/benchmarks/isometry.py | 39 ++- test/benchmarks/mapping_passes.py | 171 ++++++++--- test/benchmarks/passes.py | 79 +++-- test/benchmarks/pulse/load_pulse_defaults.py | 80 ++---- .../benchmarks/pulse/schedule_construction.py | 23 +- test/benchmarks/pulse/schedule_lowering.py | 3 +- test/benchmarks/qft.py | 45 ++- test/benchmarks/quantum_info.py | 83 +++--- test/benchmarks/quantum_volume.py | 96 +++++-- test/benchmarks/queko.py | 269 +++++++++++++----- test/benchmarks/random_circuit_hex.py | 78 +++-- test/benchmarks/randomized_benchmarking.py | 112 +++++--- test/benchmarks/ripple_adder.py | 33 ++- test/benchmarks/scheduling_passes.py | 111 +++++--- test/benchmarks/state_tomography.py | 16 +- test/benchmarks/transpiler_benchmarks.py | 104 +++++-- test/benchmarks/transpiler_levels.py | 117 ++++---- test/benchmarks/transpiler_qualitative.py | 121 ++++---- test/benchmarks/utils.py | 82 ++++-- 23 files changed, 1099 insertions(+), 614 deletions(-) diff --git a/test/benchmarks/assembler.py b/test/benchmarks/assembler.py index 9da2fab3851e..251a0413e303 100644 --- a/test/benchmarks/assembler.py +++ b/test/benchmarks/assembler.py @@ -22,17 +22,14 @@ class AssemblerBenchmarks: - params = ([8], - [4096], - [1, 100]) - param_names = ['n_qubits', 'depth', 'number of circuits'] + params = ([8], [4096], [1, 100]) + param_names = ["n_qubits", "depth", "number of circuits"] timeout = 600 version = 2 def setup(self, n_qubits, depth, number_of_circuits): seed = 42 - self.circuit = random_circuit(n_qubits, depth, measure=True, - conditional=True, seed=seed) + self.circuit = random_circuit(n_qubits, depth, measure=True, conditional=True, seed=seed) self.circuits = [self.circuit] * number_of_circuits def time_assemble_circuit(self, _, __, ___): @@ -40,16 +37,13 @@ def time_assemble_circuit(self, _, __, ___): class DisassemblerBenchmarks: - params = ([8], - [4096], - [1, 100]) - param_names = ['n_qubits', 'depth', 'number of circuits'] + params = ([8], [4096], [1, 100]) + param_names = ["n_qubits", "depth", "number of circuits"] timeout = 600 def setup(self, n_qubits, depth, number_of_circuits): seed = 424242 - self.circuit = random_circuit(n_qubits, depth, measure=True, - conditional=True, seed=seed) + self.circuit = random_circuit(n_qubits, depth, measure=True, conditional=True, seed=seed) self.circuits = [self.circuit] * number_of_circuits self.qobj = assemble(self.circuits) diff --git a/test/benchmarks/circuit_construction.py b/test/benchmarks/circuit_construction.py index 5960f1bc1b97..0523a5dea3a1 100644 --- a/test/benchmarks/circuit_construction.py +++ b/test/benchmarks/circuit_construction.py @@ -28,15 +28,15 @@ def build_circuit(width, gates): while len(qc) < gates: for k in range(width): qc.h(qr[k]) - for k in range(width-1): - qc.cx(qr[k], qr[k+1]) + for k in range(width - 1): + qc.cx(qr[k], qr[k + 1]) return qc class CircuitConstructionBench: params = ([1, 2, 5, 8, 14, 20], [8, 128, 2048, 8192, 32768, 131072]) - param_names = ['width', 'gates'] + param_names = ["width", "gates"] timeout = 600 def setup(self, width, gates): @@ -54,7 +54,7 @@ def time_circuit_copy(self, _, __): def build_parameterized_circuit(width, gates, param_count): - params = [Parameter('param-%s' % x) for x in range(param_count)] + params = [Parameter("param-%s" % x) for x in range(param_count)] param_iter = itertools.cycle(params) qr = QuantumRegister(width) @@ -64,17 +64,16 @@ def build_parameterized_circuit(width, gates, param_count): for k in range(width): param = next(param_iter) qc.u2(0, param, qr[k]) - for k in range(width-1): + for k in range(width - 1): param = next(param_iter) - qc.crx(param, qr[k], qr[k+1]) + qc.crx(param, qr[k], qr[k + 1]) return qc, params class ParameterizedCircuitConstructionBench: - params = ([20], [8, 128, 2048, 8192, 32768, 131072], - [8, 128, 2048, 8192, 32768, 131072]) - param_names = ['width', 'gates', 'number of params'] + params = ([20], [8, 128, 2048, 8192, 32768, 131072], [8, 128, 2048, 8192, 32768, 131072]) + param_names = ["width", "gates", "number of params"] timeout = 600 def setup(self, _, gates, params): @@ -86,17 +85,14 @@ def time_build_parameterized_circuit(self, width, gates, params): class ParameterizedCircuitBindBench: - params = ([20], [8, 128, 2048, 8192, 32768, 131072], - [8, 128, 2048, 8192, 32768, 131072]) - param_names = ['width', 'gates', 'number of params'] + params = ([20], [8, 128, 2048, 8192, 32768, 131072], [8, 128, 2048, 8192, 32768, 131072]) + param_names = ["width", "gates", "number of params"] timeout = 600 def setup(self, width, gates, params): if params > gates: raise NotImplementedError - self.circuit, self.params = build_parameterized_circuit(width, - gates, - params) + self.circuit, self.params = build_parameterized_circuit(width, gates, params) def time_bind_params(self, _, __, ___): self.circuit.bind_parameters({x: 3.14 for x in self.params}) diff --git a/test/benchmarks/converters.py b/test/benchmarks/converters.py index 5e6fbc3a94cc..f92d13696db5 100644 --- a/test/benchmarks/converters.py +++ b/test/benchmarks/converters.py @@ -23,7 +23,7 @@ class ConverterBenchmarks: params = ([1, 2, 5, 8, 14, 20, 32, 53], [8, 128, 2048, 8192]) - param_names = ['n_qubits', 'depth'] + param_names = ["n_qubits", "depth"] timeout = 600 def setup(self, n_qubits, depth): @@ -38,8 +38,7 @@ def setup(self, n_qubits, depth): elif n_qubits == 14: if depth > 2048: raise NotImplementedError - self.qc = random_circuit(n_qubits, depth, measure=True, - conditional=True, seed=seed) + self.qc = random_circuit(n_qubits, depth, measure=True, conditional=True, seed=seed) self.dag = converters.circuit_to_dag(self.qc) self.qasm = qasm.Qasm(data=self.qc.qasm()).parse() diff --git a/test/benchmarks/import.py b/test/benchmarks/import.py index df7d4d608753..552f4818747c 100644 --- a/test/benchmarks/import.py +++ b/test/benchmarks/import.py @@ -23,4 +23,4 @@ class QiskitImport: def time_qiskit_import(self): - call((executable, '-c', 'import qiskit')) + call((executable, "-c", "import qiskit")) diff --git a/test/benchmarks/isometry.py b/test/benchmarks/isometry.py index 80fb05bf67c8..c29d35027cea 100644 --- a/test/benchmarks/isometry.py +++ b/test/benchmarks/isometry.py @@ -23,25 +23,46 @@ class IsometryTranspileBench: params = ([0, 1, 2, 3], [3, 4, 5, 6]) - param_names = ['number of input qubits', 'number of output qubits'] + param_names = ["number of input qubits", "number of output qubits"] def setup(self, m, n): q = QuantumRegister(n) qc = QuantumCircuit(q) - if not hasattr(qc, 'iso'): + if not hasattr(qc, "iso"): raise NotImplementedError - iso = random_unitary(2 ** n, seed=0).data[:, 0:2 ** m] + iso = random_unitary(2**n, seed=0).data[:, 0 : 2**m] if len(iso.shape) == 1: iso = iso.reshape((len(iso), 1)) qc.iso(iso, q[:m], q[m:]) self.circuit = qc def track_cnot_counts_after_mapping_to_ibmq_16_melbourne(self, *unused): - coupling = [[1, 0], [1, 2], [2, 3], [4, 3], [4, 10], [5, 4], - [5, 6], [5, 9], [6, 8], [7, 8], [9, 8], [9, 10], - [11, 3], [11, 10], [11, 12], [12, 2], [13, 1], [13, 12]] - circuit = transpile(self.circuit, basis_gates=['u1', 'u3', 'u2', 'cx'], - coupling_map=coupling, seed_transpiler=0) + coupling = [ + [1, 0], + [1, 2], + [2, 3], + [4, 3], + [4, 10], + [5, 4], + [5, 6], + [5, 9], + [6, 8], + [7, 8], + [9, 8], + [9, 10], + [11, 3], + [11, 10], + [11, 12], + [12, 2], + [13, 1], + [13, 12], + ] + circuit = transpile( + self.circuit, + basis_gates=["u1", "u3", "u2", "cx"], + coupling_map=coupling, + seed_transpiler=0, + ) counts = circuit.count_ops() - cnot_count = counts.get('cx', 0) + cnot_count = counts.get("cx", 0) return cnot_count diff --git a/test/benchmarks/mapping_passes.py b/test/benchmarks/mapping_passes.py index e80d3c6345b9..2a3e3f776117 100644 --- a/test/benchmarks/mapping_passes.py +++ b/test/benchmarks/mapping_passes.py @@ -26,56 +26,95 @@ class PassBenchmarks: - params = ([5, 14, 20], - [1024]) + params = ([5, 14, 20], [1024]) - param_names = ['n_qubits', 'depth'] + param_names = ["n_qubits", "depth"] timeout = 300 def setup(self, n_qubits, depth): seed = 42 - self.circuit = random_circuit(n_qubits, depth, measure=True, - conditional=True, reset=True, seed=seed, - max_operands=2) + self.circuit = random_circuit( + n_qubits, depth, measure=True, conditional=True, reset=True, seed=seed, max_operands=2 + ) self.fresh_dag = circuit_to_dag(self.circuit) - self.basis_gates = ['u1', 'u2', 'u3', 'cx', 'iid'] - self.cmap = [[0, 1], [1, 0], [1, 2], [1, 6], [2, 1], [2, 3], [3, 2], - [3, 4], [3, 8], [4, 3], [5, 6], [5, 10], [6, 1], [6, 5], - [6, 7], [7, 6], [7, 8], [7, 12], [8, 3], [8, 7], [8, 9], - [9, 8], [9, 14], [10, 5], [10, 11], [11, 10], [11, 12], - [11, 16], [12, 7], [12, 11], [12, 13], [13, 12], [13, 14], - [13, 18], [14, 9], [14, 13], [15, 16], [16, 11], [16, 15], - [16, 17], [17, 16], [17, 18], [18, 13], [18, 17], - [18, 19], [19, 18]] + self.basis_gates = ["u1", "u2", "u3", "cx", "iid"] + self.cmap = [ + [0, 1], + [1, 0], + [1, 2], + [1, 6], + [2, 1], + [2, 3], + [3, 2], + [3, 4], + [3, 8], + [4, 3], + [5, 6], + [5, 10], + [6, 1], + [6, 5], + [6, 7], + [7, 6], + [7, 8], + [7, 12], + [8, 3], + [8, 7], + [8, 9], + [9, 8], + [9, 14], + [10, 5], + [10, 11], + [11, 10], + [11, 12], + [11, 16], + [12, 7], + [12, 11], + [12, 13], + [13, 12], + [13, 14], + [13, 18], + [14, 9], + [14, 13], + [15, 16], + [16, 11], + [16, 15], + [16, 17], + [17, 16], + [17, 18], + [18, 13], + [18, 17], + [18, 19], + [19, 18], + ] self.coupling_map = CouplingMap(self.cmap) layout_pass = DenseLayout(self.coupling_map) layout_pass.run(self.fresh_dag) - self.layout = layout_pass.property_set['layout'] + self.layout = layout_pass.property_set["layout"] full_ancilla_pass = FullAncillaAllocation(self.coupling_map) - full_ancilla_pass.property_set['layout'] = self.layout + full_ancilla_pass.property_set["layout"] = self.layout self.full_ancilla_dag = full_ancilla_pass.run(self.fresh_dag) enlarge_pass = EnlargeWithAncilla() - enlarge_pass.property_set['layout'] = self.layout + enlarge_pass.property_set["layout"] = self.layout self.enlarge_dag = enlarge_pass.run(self.full_ancilla_dag) apply_pass = ApplyLayout() - apply_pass.property_set['layout'] = self.layout + apply_pass.property_set["layout"] = self.layout self.dag = apply_pass.run(self.enlarge_dag) self.backend_props = FakeSingapore().properties() def time_stochastic_swap(self, _, __): swap = StochasticSwap(self.coupling_map, seed=42) - swap.property_set['layout'] = self.layout + swap.property_set["layout"] = self.layout swap.run(self.dag) def time_sabre_swap(self, _, __): swap = SabreSwap(self.coupling_map, seed=42) - swap.property_set['layout'] = self.layout + swap.property_set["layout"] = self.layout swap.run(self.dag) def time_basic_swap(self, _, __): swap = BasicSwap(self.coupling_map) - swap.property_set['layout'] = self.layout + swap.property_set["layout"] = self.layout swap.run(self.dag) def time_csp_layout(self, _, __): @@ -86,22 +125,22 @@ def time_dense_layout(self, _, __): def time_layout_2q_distance(self, _, __): layout = Layout2qDistance(self.coupling_map) - layout.property_set['layout'] = self.layout + layout.property_set["layout"] = self.layout layout.run(self.dag) def time_apply_layout(self, _, __): layout = ApplyLayout() - layout.property_set['layout'] = self.layout + layout.property_set["layout"] = self.layout layout.run(self.dag) def time_full_ancilla_allocation(self, _, __): ancilla = FullAncillaAllocation(self.coupling_map) - ancilla.property_set['layout'] = self.layout + ancilla.property_set["layout"] = self.layout ancilla.run(self.fresh_dag) def time_enlarge_with_ancilla(self, _, __): ancilla = EnlargeWithAncilla() - ancilla.property_set['layout'] = self.layout + ancilla.property_set["layout"] = self.layout ancilla.run(self.full_ancilla_dag) def time_check_map(self, _, __): @@ -121,44 +160,82 @@ def time_sabre_layout(self, _, __): class RoutedPassBenchmarks: - params = ([5, 14, 20], - [1024]) + params = ([5, 14, 20], [1024]) - param_names = ['n_qubits', 'depth'] + param_names = ["n_qubits", "depth"] timeout = 300 def setup(self, n_qubits, depth): seed = 42 - self.circuit = random_circuit(n_qubits, depth, measure=True, - conditional=True, reset=True, seed=seed, - max_operands=2) + self.circuit = random_circuit( + n_qubits, depth, measure=True, conditional=True, reset=True, seed=seed, max_operands=2 + ) self.fresh_dag = circuit_to_dag(self.circuit) - self.basis_gates = ['u1', 'u2', 'u3', 'cx', 'iid'] - self.cmap = [[0, 1], [1, 0], [1, 2], [1, 6], [2, 1], [2, 3], [3, 2], - [3, 4], [3, 8], [4, 3], [5, 6], [5, 10], [6, 1], [6, 5], - [6, 7], [7, 6], [7, 8], [7, 12], [8, 3], [8, 7], [8, 9], - [9, 8], [9, 14], [10, 5], [10, 11], [11, 10], [11, 12], - [11, 16], [12, 7], [12, 11], [12, 13], [13, 12], [13, 14], - [13, 18], [14, 9], [14, 13], [15, 16], [16, 11], [16, 15], - [16, 17], [17, 16], [17, 18], [18, 13], [18, 17], - [18, 19], [19, 18]] + self.basis_gates = ["u1", "u2", "u3", "cx", "iid"] + self.cmap = [ + [0, 1], + [1, 0], + [1, 2], + [1, 6], + [2, 1], + [2, 3], + [3, 2], + [3, 4], + [3, 8], + [4, 3], + [5, 6], + [5, 10], + [6, 1], + [6, 5], + [6, 7], + [7, 6], + [7, 8], + [7, 12], + [8, 3], + [8, 7], + [8, 9], + [9, 8], + [9, 14], + [10, 5], + [10, 11], + [11, 10], + [11, 12], + [11, 16], + [12, 7], + [12, 11], + [12, 13], + [13, 12], + [13, 14], + [13, 18], + [14, 9], + [14, 13], + [15, 16], + [16, 11], + [16, 15], + [16, 17], + [17, 16], + [17, 18], + [18, 13], + [18, 17], + [18, 19], + [19, 18], + ] self.coupling_map = CouplingMap(self.cmap) layout_pass = DenseLayout(self.coupling_map) layout_pass.run(self.fresh_dag) - self.layout = layout_pass.property_set['layout'] + self.layout = layout_pass.property_set["layout"] full_ancilla_pass = FullAncillaAllocation(self.coupling_map) - full_ancilla_pass.property_set['layout'] = self.layout + full_ancilla_pass.property_set["layout"] = self.layout self.full_ancilla_dag = full_ancilla_pass.run(self.fresh_dag) enlarge_pass = EnlargeWithAncilla() - enlarge_pass.property_set['layout'] = self.layout + enlarge_pass.property_set["layout"] = self.layout self.enlarge_dag = enlarge_pass.run(self.full_ancilla_dag) apply_pass = ApplyLayout() - apply_pass.property_set['layout'] = self.layout + apply_pass.property_set["layout"] = self.layout self.dag = apply_pass.run(self.enlarge_dag) self.backend_props = FakeSingapore().properties() - self.routed_dag = StochasticSwap(self.coupling_map, - seed=42).run(self.dag) + self.routed_dag = StochasticSwap(self.coupling_map, seed=42).run(self.dag) def time_cxdirection(self, _, __): CXDirection(self.coupling_map).run(self.routed_dag) diff --git a/test/benchmarks/passes.py b/test/benchmarks/passes.py index deb1ba3c2be6..3a07f025e37d 100644 --- a/test/benchmarks/passes.py +++ b/test/benchmarks/passes.py @@ -25,64 +25,62 @@ class Collect2QPassBenchmarks: - params = ([5, 14, 20], - [1024]) + params = ([5, 14, 20], [1024]) - param_names = ['n_qubits', 'depth'] + param_names = ["n_qubits", "depth"] timeout = 300 def setup(self, n_qubits, depth): seed = 42 - self.circuit = random_circuit(n_qubits, depth, measure=True, - conditional=True, reset=True, seed=seed) + self.circuit = random_circuit( + n_qubits, depth, measure=True, conditional=True, reset=True, seed=seed + ) self.dag = circuit_to_dag(self.circuit) collect_blocks = Collect2qBlocks() collect_blocks.run(self.dag) - self.block_list = collect_blocks.property_set['block_list'] + self.block_list = collect_blocks.property_set["block_list"] def time_consolidate_blocks(self, _, __): _pass = ConsolidateBlocks() - _pass.property_set['block_list'] = self.block_list + _pass.property_set["block_list"] = self.block_list _pass.run(self.dag) class CommutativeAnalysisPassBenchmarks: - params = ([5, 14, 20], - [1024]) + params = ([5, 14, 20], [1024]) - param_names = ['n_qubits', 'depth'] + param_names = ["n_qubits", "depth"] timeout = 300 def setup(self, n_qubits, depth): seed = 42 - self.circuit = random_circuit(n_qubits, depth, measure=True, - conditional=True, reset=True, seed=seed) + self.circuit = random_circuit( + n_qubits, depth, measure=True, conditional=True, reset=True, seed=seed + ) self.dag = circuit_to_dag(self.circuit) commutative_analysis = CommutationAnalysis() - commutative_analysis.run( - self.dag) - self.commutation_set = commutative_analysis.property_set[ - 'commutation_set'] + commutative_analysis.run(self.dag) + self.commutation_set = commutative_analysis.property_set["commutation_set"] def time_commutative_cancellation(self, _, __): _pass = CommutativeCancellation() - _pass.property_set['commutation_set'] = self.commutation_set + _pass.property_set["commutation_set"] = self.commutation_set _pass.run(self.dag) class UnrolledPassBenchmarks: - params = ([5, 14, 20], - [1024]) + params = ([5, 14, 20], [1024]) - param_names = ['n_qubits', 'depth'] + param_names = ["n_qubits", "depth"] timeout = 300 def setup(self, n_qubits, depth): seed = 42 - self.circuit = random_circuit(n_qubits, depth, measure=True, - conditional=True, reset=True, seed=seed) + self.circuit = random_circuit( + n_qubits, depth, measure=True, conditional=True, reset=True, seed=seed + ) self.dag = circuit_to_dag(self.circuit) - self.basis_gates = ['u1', 'u2', 'u3', 'cx', 'id'] + self.basis_gates = ["u1", "u2", "u3", "cx", "id"] self.unrolled_dag = Unroller(self.basis_gates).run(self.dag) def time_optimize_1q(self, _, __): @@ -90,12 +88,13 @@ def time_optimize_1q(self, _, __): class MultipleBasisPassBenchmarks: - params = ([5, 14, 20], - [1024], - [['u', 'cx', 'id'], ['rx', 'ry', 'rz', 'r', 'rxx', 'id'], - ['rz', 'x', 'sx', 'cx', 'id']]) + params = ( + [5, 14, 20], + [1024], + [["u", "cx", "id"], ["rx", "ry", "rz", "r", "rxx", "id"], ["rz", "x", "sx", "cx", "id"]], + ) - param_names = ['n_qubits', 'depth', 'basis_gates'] + param_names = ["n_qubits", "depth", "basis_gates"] timeout = 300 def setup(self, n_qubits, depth, basis_gates): @@ -115,18 +114,18 @@ def time_basis_translator(self, _, __, ___): class PassBenchmarks: - params = ([5, 14, 20], - [1024]) + params = ([5, 14, 20], [1024]) - param_names = ['n_qubits', 'depth'] + param_names = ["n_qubits", "depth"] timeout = 300 def setup(self, n_qubits, depth): seed = 42 - self.circuit = random_circuit(n_qubits, depth, measure=True, - conditional=True, reset=True, seed=seed) + self.circuit = random_circuit( + n_qubits, depth, measure=True, conditional=True, reset=True, seed=seed + ) self.dag = circuit_to_dag(self.circuit) - self.basis_gates = ['u1', 'u2', 'u3', 'cx', 'id'] + self.basis_gates = ["u1", "u2", "u3", "cx", "id"] def time_unroller(self, _, __): Unroller(self.basis_gates).run(self.dag) @@ -189,7 +188,7 @@ def time_remove_final_measurements(self, _, __): RemoveFinalMeasurements().run(self.dag) def time_contains_instruction(self, _, __): - ContainsInstruction('cx').run(self.dag) + ContainsInstruction("cx").run(self.dag) def time_gates_in_basis(self, _, __): GatesInBasis(self.basis_gates).run(self.dag) @@ -199,16 +198,16 @@ def time_remove_barriers(self, _, __): class MultiQBlockPassBenchmarks: - params = ([5, 14, 20], - [1024], [1, 2, 3, 4, 5]) + params = ([5, 14, 20], [1024], [1, 2, 3, 4, 5]) - param_names = ['n_qubits', 'depth', 'max_block_size'] + param_names = ["n_qubits", "depth", "max_block_size"] timeout = 300 def setup(self, n_qubits, depth, _): seed = 42 - self.circuit = random_circuit(n_qubits, depth, measure=True, - conditional=True, reset=True, seed=seed) + self.circuit = random_circuit( + n_qubits, depth, measure=True, conditional=True, reset=True, seed=seed + ) self.dag = circuit_to_dag(self.circuit) def time_collect_multiq_block(self, _, __, max_block_size): diff --git a/test/benchmarks/pulse/load_pulse_defaults.py b/test/benchmarks/pulse/load_pulse_defaults.py index a6a7f828ab17..ad8feb842c34 100644 --- a/test/benchmarks/pulse/load_pulse_defaults.py +++ b/test/benchmarks/pulse/load_pulse_defaults.py @@ -49,24 +49,20 @@ def gen_source(num_random_gate): "label": "Y90p_d0", "name": "parametric_pulse", "parameters": { - "amp": ( - 0.0022743565483134 + 0.14767107967944j - ), + "amp": (0.0022743565483134 + 0.14767107967944j), "beta": 0.5218372954777448, "duration": 96, "sigma": 24, }, "pulse_shape": "drag", - "t0": 0 + "t0": 0, }, { "ch": "d0", "label": "CR90p_d0_u1", "name": "parametric_pulse", "parameters": { - "amp": ( - 0.03583301328943 - 0.0006486874906466j - ), + "amp": (0.03583301328943 - 0.0006486874906466j), "duration": 1104, "sigma": 64, "width": 848, @@ -79,9 +75,7 @@ def gen_source(num_random_gate): "label": "CR90m_d0_u1", "name": "parametric_pulse", "parameters": { - "amp": ( - -0.03583301328943 + 0.000648687490646j - ), + "amp": (-0.03583301328943 + 0.000648687490646j), "duration": 1104, "sigma": 64, "width": 848, @@ -100,9 +94,7 @@ def gen_source(num_random_gate): "label": "X90p_d0", "name": "parametric_pulse", "parameters": { - "amp": ( - 0.14766707017470 - 0.002521280908868j - ), + "amp": (0.14766707017470 - 0.002521280908868j), "beta": 0.5218372954777448, "duration": 96, "sigma": 24, @@ -121,9 +113,7 @@ def gen_source(num_random_gate): "label": "X90p_d1", "name": "parametric_pulse", "parameters": { - "amp": ( - 0.19074973504459 + 0.004525711677119j - ), + "amp": (0.19074973504459 + 0.004525711677119j), "beta": -1.2815198779814807, "duration": 96, "sigma": 24, @@ -149,9 +139,7 @@ def gen_source(num_random_gate): "label": "Y90m_d1", "name": "parametric_pulse", "parameters": { - "amp": ( - 0.00285052543950 - 0.19078212177897j - ), + "amp": (0.00285052543950 - 0.19078212177897j), "beta": -1.2815198779814807, "duration": 96, "sigma": 24, @@ -176,9 +164,7 @@ def gen_source(num_random_gate): "label": "CR90p_u1", "name": "parametric_pulse", "parameters": { - "amp": ( - -0.1629668182698 - 0.8902610676540j - ), + "amp": (-0.1629668182698 - 0.8902610676540j), "duration": 1104, "sigma": 64, "width": 848, @@ -191,9 +177,7 @@ def gen_source(num_random_gate): "label": "CR90m_u1", "name": "parametric_pulse", "parameters": { - "amp": ( - 0.16296681826986 + 0.8902610676540j - ), + "amp": (0.16296681826986 + 0.8902610676540j), "duration": 1104, "sigma": 64, "width": 848, @@ -254,9 +238,7 @@ def gen_source(num_random_gate): "label": "X90p_d0", "name": "parametric_pulse", "parameters": { - "amp": ( - 0.14766707017470 - 0.002521280908868j - ), + "amp": (0.14766707017470 - 0.002521280908868j), "beta": 0.5218372954777448, "duration": 96, "sigma": 24, @@ -275,9 +257,7 @@ def gen_source(num_random_gate): "label": "X90p_d0", "name": "parametric_pulse", "parameters": { - "amp": ( - 0.19074973504459 + 0.004525711677119j - ), + "amp": (0.19074973504459 + 0.004525711677119j), "beta": -1.2815198779814807, "duration": 96, "sigma": 24, @@ -302,9 +282,7 @@ def gen_source(num_random_gate): "label": "X90p_d0", "name": "parametric_pulse", "parameters": { - "amp": ( - 0.14766707017470 - 0.002521280908868j - ), + "amp": (0.14766707017470 - 0.002521280908868j), "beta": 0.5218372954777448, "duration": 96, "sigma": 24, @@ -323,9 +301,7 @@ def gen_source(num_random_gate): "label": "X90m_d0", "name": "parametric_pulse", "parameters": { - "amp": ( - -0.14767107967944 + 0.002274356548313j - ), + "amp": (-0.14767107967944 + 0.002274356548313j), "beta": 0.5218372954777448, "duration": 96, "sigma": 24, @@ -374,9 +350,7 @@ def gen_source(num_random_gate): "label": "X90p_d1", "name": "parametric_pulse", "parameters": { - "amp": ( - 0.19074973504459 + 0.004525711677119j - ), + "amp": (0.19074973504459 + 0.004525711677119j), "beta": -1.2815198779814807, "duration": 96, "sigma": 24, @@ -395,9 +369,7 @@ def gen_source(num_random_gate): "label": "X90m_d1", "name": "parametric_pulse", "parameters": { - "amp": ( - -0.19078212177897 - 0.002850525439509j - ), + "amp": (-0.19078212177897 - 0.002850525439509j), "beta": -1.2815198779814807, "duration": 96, "sigma": 24, @@ -440,9 +412,7 @@ def gen_source(num_random_gate): "label": "M_m0", "name": "parametric_pulse", "parameters": { - "amp": ( - -0.3003200790496 + 0.3069634566518j - ), + "amp": (-0.3003200790496 + 0.3069634566518j), "duration": 1792, "sigma": 64, "width": 1536, @@ -455,9 +425,7 @@ def gen_source(num_random_gate): "label": "M_m1", "name": "parametric_pulse", "parameters": { - "amp": ( - 0.26292757124962 + 0.14446138680205j - ), + "amp": (0.26292757124962 + 0.14446138680205j), "duration": 1792, "sigma": 64, "width": 1536, @@ -486,7 +454,7 @@ def gen_source(num_random_gate): }, ], }, - ] + ], } # add random waveform gate entries to increase overhead @@ -535,8 +503,10 @@ def gen_source(num_random_gate): class PulseDefaultsBench: - params = ([0, 10, 100, 1000], ) - param_names = ["number of random gates", ] + params = ([0, 10, 100, 1000],) + param_names = [ + "number of random gates", + ] def setup(self, num_random_gate): self.source = gen_source(num_random_gate) @@ -547,8 +517,10 @@ def time_building_defaults(self, _): class CircuitSchedulingBench: - params = ([1, 2, 3, 15], ) - param_names = ["number of unit cell repetition", ] + params = ([1, 2, 3, 15],) + param_names = [ + "number of unit cell repetition", + ] def setup(self, repeat_unit_cell): source = gen_source(1) diff --git a/test/benchmarks/pulse/schedule_construction.py b/test/benchmarks/pulse/schedule_construction.py index bfaf60391e2d..504b6044c5ea 100644 --- a/test/benchmarks/pulse/schedule_construction.py +++ b/test/benchmarks/pulse/schedule_construction.py @@ -22,7 +22,6 @@ class EchoedCrossResonanceConstructionBench: - def setup(self): with builder.build() as x_ctrl: @@ -61,9 +60,9 @@ def time_full_scratch(self): channels.DriveChannel(0), ) with builder.phase_offset( - np.pi, - channels.ControlChannel(0), - channels.DriveChannel(1), + np.pi, + channels.ControlChannel(0), + channels.DriveChannel(1), ): with builder.align_left(): builder.play( @@ -86,9 +85,9 @@ def time_with_call(self): builder.call(self.cr45p) builder.call(self.x_ctrl) with builder.phase_offset( - np.pi, - channels.ControlChannel(0), - channels.DriveChannel(1), + np.pi, + channels.ControlChannel(0), + channels.DriveChannel(1), ): builder.call(self.cr45p) builder.call(self.x_ctrl) @@ -100,9 +99,9 @@ def time_assign_later(self): builder.reference("cr45p", "q0", "q1") builder.reference("x", "q0") with builder.phase_offset( - np.pi, - channels.ControlChannel(0), - channels.DriveChannel(1), + np.pi, + channels.ControlChannel(0), + channels.DriveChannel(1), ): builder.reference("cr45p", "q0", "q1") builder.reference("x", "q0") @@ -134,9 +133,7 @@ def setup(self, nscan): with builder.build() as outer_schedule: builder.reference("subroutine") - outer_schedule.assign_references( - {("subroutine", ): schedule}, inplace=True - ) + outer_schedule.assign_references({("subroutine",): schedule}, inplace=True) self.outer_schedule = outer_schedule gate = Gate("my_gate", 1, [self.p0, self.p1, self.p2]) diff --git a/test/benchmarks/pulse/schedule_lowering.py b/test/benchmarks/pulse/schedule_lowering.py index 0b8c2e4909a3..8c600373b787 100644 --- a/test/benchmarks/pulse/schedule_lowering.py +++ b/test/benchmarks/pulse/schedule_lowering.py @@ -73,13 +73,12 @@ def build_complicated_schedule(): for i in range(3): samples = np.random.random(160) builder.play(samples, channels.DriveChannel(i)) - schedule.assign_references({("sub", ): subroutine}, inplace=True) + schedule.assign_references({("sub",): subroutine}, inplace=True) return schedule class ScheduleLoweringBench: - def setup(self): self.schedule_block = build_complicated_schedule() diff --git a/test/benchmarks/qft.py b/test/benchmarks/qft.py index fd49a47afa35..4067dbf84886 100644 --- a/test/benchmarks/qft.py +++ b/test/benchmarks/qft.py @@ -22,6 +22,7 @@ from qiskit.converters import circuit_to_dag from qiskit.transpiler import CouplingMap from qiskit.transpiler.passes import SabreSwap + try: from qiskit.compiler import transpile except ImportError: @@ -39,7 +40,7 @@ def build_model_circuit(qreg, circuit=None): for j in range(i): # Using negative exponents so we safely underflow to 0 rather than # raise `OverflowError`. - circuit.cp(math.pi * (2.0 ** (j-i)), qreg[i], qreg[j]) + circuit.cp(math.pi * (2.0 ** (j - i)), qreg[i], qreg[j]) circuit.h(qreg[i]) return circuit @@ -54,14 +55,32 @@ def setup(self, n): def time_ibmq_backend_transpile(self, _): # Run with ibmq_16_melbourne configuration - coupling_map = [[1, 0], [1, 2], [2, 3], [4, 3], [4, 10], [5, 4], - [5, 6], [5, 9], [6, 8], [7, 8], [9, 8], [9, 10], - [11, 3], [11, 10], [11, 12], [12, 2], [13, 1], - [13, 12]] - transpile(self.circuit, - basis_gates=['u1', 'u2', 'u3', 'cx', 'id'], - coupling_map=coupling_map, - seed_transpiler=20220125) + coupling_map = [ + [1, 0], + [1, 2], + [2, 3], + [4, 3], + [4, 10], + [5, 4], + [5, 6], + [5, 9], + [6, 8], + [7, 8], + [9, 8], + [9, 10], + [11, 3], + [11, 10], + [11, 12], + [12, 2], + [13, 1], + [13, 12], + ] + transpile( + self.circuit, + basis_gates=["u1", "u2", "u3", "cx", "id"], + coupling_map=coupling_map, + seed_transpiler=20220125, + ) class LargeQFTMappingTimeBench: @@ -74,9 +93,7 @@ class LargeQFTMappingTimeBench: def setup(self, n_qubits, _heuristic): qr = QuantumRegister(n_qubits, name="q") self.dag = circuit_to_dag(build_model_circuit(qr)) - self.coupling = CouplingMap.from_heavy_hex( - self.heavy_hex_size[n_qubits] - ) + self.coupling = CouplingMap.from_heavy_hex(self.heavy_hex_size[n_qubits]) def time_sabre_swap(self, _n_qubits, heuristic): pass_ = SabreSwap(self.coupling, heuristic, seed=2022_10_27, trials=1) @@ -100,9 +117,7 @@ def setup_cache(self): def setup(n_qubits, heuristic): qr = QuantumRegister(n_qubits, name="q") dag = circuit_to_dag(build_model_circuit(qr)) - coupling = CouplingMap.from_heavy_hex( - self.heavy_hex_size[n_qubits] - ) + coupling = CouplingMap.from_heavy_hex(self.heavy_hex_size[n_qubits]) pass_ = SabreSwap(coupling, heuristic, seed=2022_10_27, trials=1) return pass_.run(dag) diff --git a/test/benchmarks/quantum_info.py b/test/benchmarks/quantum_info.py index 12ce2d2d26db..fc83ab3f12b9 100644 --- a/test/benchmarks/quantum_info.py +++ b/test/benchmarks/quantum_info.py @@ -19,74 +19,76 @@ import numpy as np -from qiskit.quantum_info import random_clifford, Clifford, \ - decompose_clifford, random_pauli, SparsePauliOp +from qiskit.quantum_info import ( + random_clifford, + Clifford, + decompose_clifford, + random_pauli, + SparsePauliOp, +) from qiskit.quantum_info.operators.symplectic.random import random_pauli_list from qiskit.quantum_info import random_cnotdihedral, CNOTDihedral class RandomCliffordBench: - params = ['1,3000', '2,2500', '3,2000', '4,1500', '5,1000', '6,700'] - param_names = ['nqubits,length'] + params = ["1,3000", "2,2500", "3,2000", "4,1500", "5,1000", "6,700"] + param_names = ["nqubits,length"] def time_random_clifford(self, nqubits_length): - (nqubits, length) = map(int, nqubits_length.split(',')) + (nqubits, length) = map(int, nqubits_length.split(",")) for _ in range(length): random_clifford(nqubits) class CliffordComposeBench: - params = ['1,7000', '2,5000', '3,5000', '4,2500', '5,2000'] - param_names = ['nqubits,length'] + params = ["1,7000", "2,5000", "3,5000", "4,2500", "5,2000"] + param_names = ["nqubits,length"] def setup(self, nqubits_length): - (nqubits, length) = map(int, nqubits_length.split(',')) - self.random_clifford = \ - [random_clifford(nqubits) for _ in range(length)] + (nqubits, length) = map(int, nqubits_length.split(",")) + self.random_clifford = [random_clifford(nqubits) for _ in range(length)] def time_compose(self, nqubits_length): - (nqubits, length) = map(int, nqubits_length.split(',')) + (nqubits, length) = map(int, nqubits_length.split(",")) clifford = Clifford(np.eye(2 * nqubits)) for i in range(length): clifford.compose(self.random_clifford[i]) class CliffordDecomposeBench: - params = ['1,1000', '2,500', '3,100', '4,50', '5,10'] - param_names = ['nqubits,length'] + params = ["1,1000", "2,500", "3,100", "4,50", "5,10"] + param_names = ["nqubits,length"] def setup(self, nqubits_length): - (nqubits, length) = map(int, nqubits_length.split(',')) - self.random_clifford = \ - [random_clifford(nqubits) for _ in range(length)] + (nqubits, length) = map(int, nqubits_length.split(",")) + self.random_clifford = [random_clifford(nqubits) for _ in range(length)] def time_decompose(self, nqubits_length): - length = int(nqubits_length.split(',')[1]) + length = int(nqubits_length.split(",")[1]) for i in range(length): decompose_clifford(self.random_clifford[i]) class RandomCnotDihedralBench: - params = ['1,2000', '2,1500', '3,1200', '4,1000', '5,800', '6,700'] - param_names = ['nqubits,length'] + params = ["1,2000", "2,1500", "3,1200", "4,1000", "5,800", "6,700"] + param_names = ["nqubits,length"] def time_random_cnotdihedral(self, nqubits_length): - (nqubits, length) = map(int, nqubits_length.split(',')) + (nqubits, length) = map(int, nqubits_length.split(",")) for _ in range(length): random_cnotdihedral(nqubits) class CnotDihedralComposeBench: - params = ['1,1500', '2,400', '3,100', '4,40', '5,10'] - param_names = ['nqubits,length'] + params = ["1,1500", "2,400", "3,100", "4,40", "5,10"] + param_names = ["nqubits,length"] def setup(self, nqubits_length): - (nqubits, length) = map(int, nqubits_length.split(',')) - self.random_cnotdihedral = \ - [random_cnotdihedral(nqubits) for _ in range(length)] + (nqubits, length) = map(int, nqubits_length.split(",")) + self.random_cnotdihedral = [random_cnotdihedral(nqubits) for _ in range(length)] def time_compose(self, nqubits_length): - (nqubits, length) = map(int, nqubits_length.split(',')) + (nqubits, length) = map(int, nqubits_length.split(",")) cxdihedral = CNOTDihedral(num_qubits=nqubits) for i in range(length): cxdihedral.compose(self.random_cnotdihedral[i]) @@ -119,6 +121,7 @@ def time_evolve_by_clifford(self, num_qubits): c1 = random_clifford(num_qubits) self.p1.evolve(c1) + time_evolve_by_clifford.params = [10] @@ -127,10 +130,8 @@ class PauliListBench: param_names = ["num_qubits", "length"] def setup(self, num_qubits, length): - self.pl1 = random_pauli_list(num_qubits=num_qubits, size=length, - phase=True) - self.pl2 = random_pauli_list(num_qubits=num_qubits, size=length, - phase=True) + self.pl1 = random_pauli_list(num_qubits=num_qubits, size=length, phase=True) + self.pl2 = random_pauli_list(num_qubits=num_qubits, size=length, phase=True) def time_commutes(self, _, __): self.pl1.commutes(self.pl2) @@ -150,6 +151,7 @@ def time_group_qubit_wise_commuting(self, _, __): def time_evolve_by_clifford(self, num_qubits, __): c1 = random_clifford(num_qubits) self.pl1.evolve(c1) + time_evolve_by_clifford.params = [[20], [100]] @@ -158,14 +160,11 @@ class PauliListQargsBench: param_names = ["num_qubits", "length"] def setup(self, num_qubits, length): - half_qubits = int(num_qubits/2) + half_qubits = int(num_qubits / 2) - self.pl1 = random_pauli_list(num_qubits=num_qubits, size=length, - phase=True) - self.pl2 = random_pauli_list(num_qubits=half_qubits, size=length, - phase=True) - self.qargs = [random.randint(0, num_qubits - 1) - for _ in range(half_qubits)] + self.pl1 = random_pauli_list(num_qubits=num_qubits, size=length, phase=True) + self.pl2 = random_pauli_list(num_qubits=half_qubits, size=length, phase=True) + self.qargs = [random.randint(0, num_qubits - 1) for _ in range(half_qubits)] def time_commutes_with_qargs(self, _, __): self.pl1.commutes(self.pl2, self.qargs) @@ -179,10 +178,8 @@ class SparsePauliOpBench: param_names = ["num_qubits", "length"] def setup(self, num_qubits, length): - self.p1 = SparsePauliOp( - random_pauli_list(num_qubits=num_qubits, size=length, phase=True)) - self.p2 = SparsePauliOp( - random_pauli_list(num_qubits=num_qubits, size=length, phase=True)) + self.p1 = SparsePauliOp(random_pauli_list(num_qubits=num_qubits, size=length, phase=True)) + self.p2 = SparsePauliOp(random_pauli_list(num_qubits=num_qubits, size=length, phase=True)) def time_compose(self, _, __): self.p1.compose(self.p2) @@ -195,16 +192,20 @@ def time_tensor(self, _, __): def time_add(self, _, __): _ = self.p1 + self.p2 + time_add.params = [[50, 100, 150, 200], [10000]] def time_to_list(self, _, __): self.p1.to_list() + time_to_list.params = [[2, 4, 6, 8, 10], [50]] def time_to_operator(self, _, __): self.p1.to_operator() + time_to_operator.params = [[2, 4, 6, 8, 10], [50]] def time_to_matrix(self, _, __): self.p1.to_matrix() + time_to_matrix.params = [[2, 4, 6, 8, 10], [50]] diff --git a/test/benchmarks/quantum_volume.py b/test/benchmarks/quantum_volume.py index 08bcbbf773b2..8fb627a95045 100644 --- a/test/benchmarks/quantum_volume.py +++ b/test/benchmarks/quantum_volume.py @@ -34,31 +34,81 @@ class QuantumVolumeBenchmark: - params = ([1, 2, 3, 5, 8, 14, 20, 27], ['translator', 'synthesis']) - param_names = ['Number of Qubits', 'Basis Translation Method'] + params = ([1, 2, 3, 5, 8, 14, 20, 27], ["translator", "synthesis"]) + param_names = ["Number of Qubits", "Basis Translation Method"] version = 3 def setup(self, width, _): random_seed = np.random.seed(10) self.circuit = build_qv_model_circuit(width, width, random_seed) self.coupling_map = [ - [0, 1], [1, 0], [1, 2], [1, 4], [2, 1], [2, 3], [3, 2], [3, 5], - [4, 1], [4, 7], [5, 3], [5, 8], [6, 7], [7, 4], [7, 6], [7, 10], - [8, 5], [8, 9], [8, 11], [9, 8], [10, 7], [10, 12], [11, 8], - [11, 14], [12, 10], [12, 13], [12, 15], [13, 12], [13, 14], - [14, 11], [14, 13], [14, 16], [15, 12], [15, 18], [16, 14], - [16, 19], [17, 18], [18, 15], [18, 17], [18, 21], [19, 16], - [19, 20], [19, 22], [20, 19], [21, 18], [21, 23], [22, 19], - [22, 25], [23, 21], [23, 24], [24, 23], [24, 25], [25, 22], - [25, 24], [25, 26], [26, 25]] - self.basis = ['id', 'rz', 'sx', 'x', 'cx', 'reset'] + [0, 1], + [1, 0], + [1, 2], + [1, 4], + [2, 1], + [2, 3], + [3, 2], + [3, 5], + [4, 1], + [4, 7], + [5, 3], + [5, 8], + [6, 7], + [7, 4], + [7, 6], + [7, 10], + [8, 5], + [8, 9], + [8, 11], + [9, 8], + [10, 7], + [10, 12], + [11, 8], + [11, 14], + [12, 10], + [12, 13], + [12, 15], + [13, 12], + [13, 14], + [14, 11], + [14, 13], + [14, 16], + [15, 12], + [15, 18], + [16, 14], + [16, 19], + [17, 18], + [18, 15], + [18, 17], + [18, 21], + [19, 16], + [19, 20], + [19, 22], + [20, 19], + [21, 18], + [21, 23], + [22, 19], + [22, 25], + [23, 21], + [23, 24], + [24, 23], + [24, 25], + [25, 22], + [25, 24], + [25, 26], + [26, 25], + ] + self.basis = ["id", "rz", "sx", "x", "cx", "reset"] def time_ibmq_backend_transpile(self, _, translation): - transpile(self.circuit, - basis_gates=self.basis, - coupling_map=self.coupling_map, - translation_method=translation, - seed_transpiler=20220125) + transpile( + self.circuit, + basis_gates=self.basis, + coupling_map=self.coupling_map, + translation_method=translation, + seed_transpiler=20220125, + ) class LargeQuantumVolumeMappingTimeBench: @@ -75,12 +125,8 @@ def setup(self, n_qubits, depth, _): if (n_qubits, depth) not in self.allowed_sizes: raise NotImplementedError seed = 2022_10_27 - self.dag = circuit_to_dag( - build_qv_model_circuit(n_qubits, depth, seed) - ) - self.coupling = CouplingMap.from_heavy_hex( - self.heavy_hex_distance[n_qubits] - ) + self.dag = circuit_to_dag(build_qv_model_circuit(n_qubits, depth, seed)) + self.coupling = CouplingMap.from_heavy_hex(self.heavy_hex_distance[n_qubits]) def time_sabre_swap(self, _n_qubits, _depth, heuristic): pass_ = SabreSwap(self.coupling, heuristic, seed=2022_10_27, trials=1) @@ -109,9 +155,7 @@ def setup_cache(self): seed = 2022_10_27 def setup(n_qubits, depth, heuristic): - dag = circuit_to_dag( - build_qv_model_circuit(n_qubits, depth, seed) - ) + dag = circuit_to_dag(build_qv_model_circuit(n_qubits, depth, seed)) coupling = CouplingMap.from_heavy_hex(heavy_hex_distance[n_qubits]) return SabreSwap(coupling, heuristic, seed=seed, trials=1).run(dag) diff --git a/test/benchmarks/queko.py b/test/benchmarks/queko.py index 1ae8f36b53ff..fbe55de774b1 100644 --- a/test/benchmarks/queko.py +++ b/test/benchmarks/queko.py @@ -22,8 +22,7 @@ class QUEKOTranspilerBench: - params = ([0, 1, 2, 3], - [None, "sabre"]) + params = ([0, 1, 2, 3], [None, "sabre"]) param_names = ["optimization level", "routing/layout method"] timeout = 600 @@ -145,91 +144,219 @@ def setup(self, optimization_level, routing_method): [50, 49], [50, 41], [51, 44], - [52, 48]] + [52, 48], + ] self.tokyo_coupling_map = [ - [0, 1], [1, 2], [2, 3], [3, 4], - [0, 5], [1, 6], [1, 7], [2, 6], [2, 7], [3, 8], [3, 9], [4, 8], - [4, 9], [5, 6], [6, 7], [7, 8], [8, 9], [5, 10], [5, 11], [6, 10], - [6, 11], [7, 12], [7, 13], [8, 12], [8, 13], [9, 14], [10, 11], - [11, 12], [12, 13], [13, 14], [10, 15], [11, 16], [11, 17], - [12, 16], [12, 17], [13, 18], [13, 19], [14, 18], [14, 19], - [15, 16], [16, 17], [17, 18], [18, 19] + [0, 1], + [1, 2], + [2, 3], + [3, 4], + [0, 5], + [1, 6], + [1, 7], + [2, 6], + [2, 7], + [3, 8], + [3, 9], + [4, 8], + [4, 9], + [5, 6], + [6, 7], + [7, 8], + [8, 9], + [5, 10], + [5, 11], + [6, 10], + [6, 11], + [7, 12], + [7, 13], + [8, 12], + [8, 13], + [9, 14], + [10, 11], + [11, 12], + [12, 13], + [13, 14], + [10, 15], + [11, 16], + [11, 17], + [12, 16], + [12, 17], + [13, 18], + [13, 19], + [14, 18], + [14, 19], + [15, 16], + [16, 17], + [17, 18], + [18, 19], ] self.sycamore_coupling_map = [ - [0, 6], [1, 6], [1, 7], [2, 7], [2, 8], [3, 8], [3, 9], [4, 9], - [4, 10], [5, 10], [5, 11], [6, 12], [6, 13], [7, 13], [7, 14], - [8, 14], [8, 15], [9, 15], [9, 16], [10, 16], [10, 17], [11, 17], - [12, 18], [13, 18], [13, 19], [14, 19], [14, 20], [15, 20], - [15, 21], [16, 21], [16, 22], [17, 22], [17, 23], [18, 24], - [18, 25], [19, 25], [19, 26], [20, 26], [20, 27], [21, 27], - [21, 28], [22, 28], [22, 29], [23, 29], [24, 30], [25, 30], - [25, 31], [26, 31], [26, 32], [27, 32], [27, 33], [28, 33], - [28, 34], [29, 34], [29, 35], [30, 36], [30, 37], [31, 37], - [31, 38], [32, 38], [32, 39], [33, 39], [33, 40], [34, 40], - [34, 41], [35, 41], [36, 42], [37, 42], [37, 43], [38, 43], - [38, 44], [39, 44], [39, 45], [40, 45], [40, 46], [41, 46], - [41, 47], [42, 48], [42, 49], [43, 49], [43, 50], [44, 50], - [44, 51], [45, 51], [45, 52], [46, 52], [46, 53], [47, 53] + [0, 6], + [1, 6], + [1, 7], + [2, 7], + [2, 8], + [3, 8], + [3, 9], + [4, 9], + [4, 10], + [5, 10], + [5, 11], + [6, 12], + [6, 13], + [7, 13], + [7, 14], + [8, 14], + [8, 15], + [9, 15], + [9, 16], + [10, 16], + [10, 17], + [11, 17], + [12, 18], + [13, 18], + [13, 19], + [14, 19], + [14, 20], + [15, 20], + [15, 21], + [16, 21], + [16, 22], + [17, 22], + [17, 23], + [18, 24], + [18, 25], + [19, 25], + [19, 26], + [20, 26], + [20, 27], + [21, 27], + [21, 28], + [22, 28], + [22, 29], + [23, 29], + [24, 30], + [25, 30], + [25, 31], + [26, 31], + [26, 32], + [27, 32], + [27, 33], + [28, 33], + [28, 34], + [29, 34], + [29, 35], + [30, 36], + [30, 37], + [31, 37], + [31, 38], + [32, 38], + [32, 39], + [33, 39], + [33, 40], + [34, 40], + [34, 41], + [35, 41], + [36, 42], + [37, 42], + [37, 43], + [38, 43], + [38, 44], + [39, 44], + [39, 45], + [40, 45], + [40, 46], + [41, 46], + [41, 47], + [42, 48], + [42, 49], + [43, 49], + [43, 50], + [44, 50], + [44, 51], + [45, 51], + [45, 52], + [46, 52], + [46, 53], + [47, 53], ] self.basis_gates = ["id", "rz", "sx", "x", "cx"] - self.qasm_path = os.path.abspath( - os.path.join(os.path.dirname(__file__), "qasm")) + self.qasm_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "qasm")) self.bigd = QuantumCircuit.from_qasm_file( - os.path.join(self.qasm_path, "20QBT_45CYC_.0D1_.1D2_3.qasm")) + os.path.join(self.qasm_path, "20QBT_45CYC_.0D1_.1D2_3.qasm") + ) self.bss = QuantumCircuit.from_qasm_file( - os.path.join(self.qasm_path, "53QBT_100CYC_QSE_3.qasm")) + os.path.join(self.qasm_path, "53QBT_100CYC_QSE_3.qasm") + ) self.bntf = QuantumCircuit.from_qasm_file( - os.path.join(self.qasm_path, "54QBT_25CYC_QSE_3.qasm")) + os.path.join(self.qasm_path, "54QBT_25CYC_QSE_3.qasm") + ) - def track_depth_bntf_optimal_depth_25(self, optimization_level, - routing_method): - return transpile(self.bntf, coupling_map=self.sycamore_coupling_map, - basis_gates=self.basis_gates, - routing_method=routing_method, - layout_method=routing_method, - optimization_level=optimization_level, - seed_transpiler=0).depth() + def track_depth_bntf_optimal_depth_25(self, optimization_level, routing_method): + return transpile( + self.bntf, + coupling_map=self.sycamore_coupling_map, + basis_gates=self.basis_gates, + routing_method=routing_method, + layout_method=routing_method, + optimization_level=optimization_level, + seed_transpiler=0, + ).depth() - def track_depth_bss_optimal_depth_100(self, optimization_level, - routing_method): - return transpile(self.bss, coupling_map=self.rochester_coupling_map, - basis_gates=self.basis_gates, - routing_method=routing_method, - layout_method=routing_method, - optimization_level=optimization_level, - seed_transpiler=0).depth() + def track_depth_bss_optimal_depth_100(self, optimization_level, routing_method): + return transpile( + self.bss, + coupling_map=self.rochester_coupling_map, + basis_gates=self.basis_gates, + routing_method=routing_method, + layout_method=routing_method, + optimization_level=optimization_level, + seed_transpiler=0, + ).depth() - def track_depth_bigd_optimal_depth_45(self, optimization_level, - routing_method): - return transpile(self.bigd, coupling_map=self.tokyo_coupling_map, - basis_gates=self.basis_gates, - routing_method=routing_method, - layout_method=routing_method, - optimization_level=optimization_level, - seed_transpiler=0).depth() + def track_depth_bigd_optimal_depth_45(self, optimization_level, routing_method): + return transpile( + self.bigd, + coupling_map=self.tokyo_coupling_map, + basis_gates=self.basis_gates, + routing_method=routing_method, + layout_method=routing_method, + optimization_level=optimization_level, + seed_transpiler=0, + ).depth() def time_transpile_bntf(self, optimization_level, routing_method): - transpile(self.bntf, coupling_map=self.sycamore_coupling_map, - basis_gates=self.basis_gates, - routing_method=routing_method, - layout_method=routing_method, - optimization_level=optimization_level, - seed_transpiler=0).depth() + transpile( + self.bntf, + coupling_map=self.sycamore_coupling_map, + basis_gates=self.basis_gates, + routing_method=routing_method, + layout_method=routing_method, + optimization_level=optimization_level, + seed_transpiler=0, + ).depth() def time_transpile_bss(self, optimization_level, routing_method): - transpile(self.bss, coupling_map=self.rochester_coupling_map, - basis_gates=self.basis_gates, - routing_method=routing_method, - layout_method=routing_method, - optimization_level=optimization_level, - seed_transpiler=0).depth() + transpile( + self.bss, + coupling_map=self.rochester_coupling_map, + basis_gates=self.basis_gates, + routing_method=routing_method, + layout_method=routing_method, + optimization_level=optimization_level, + seed_transpiler=0, + ).depth() def time_transpile_bigd(self, optimization_level, routing_method): - transpile(self.bigd, coupling_map=self.tokyo_coupling_map, - basis_gates=self.basis_gates, - routing_method=routing_method, - layout_method=routing_method, - optimization_level=optimization_level, - seed_transpiler=0).depth() + transpile( + self.bigd, + coupling_map=self.tokyo_coupling_map, + basis_gates=self.basis_gates, + routing_method=routing_method, + layout_method=routing_method, + optimization_level=optimization_level, + seed_transpiler=0, + ).depth() diff --git a/test/benchmarks/random_circuit_hex.py b/test/benchmarks/random_circuit_hex.py index 0211a987795b..5b69100ae2c8 100644 --- a/test/benchmarks/random_circuit_hex.py +++ b/test/benchmarks/random_circuit_hex.py @@ -22,15 +22,19 @@ try: from qiskit.compiler import transpile - TRANSPILER_SEED_KEYWORD = 'seed_transpiler' + + TRANSPILER_SEED_KEYWORD = "seed_transpiler" except ImportError: from qiskit.transpiler import transpile - TRANSPILER_SEED_KEYWORD = 'seed_mapper' + + TRANSPILER_SEED_KEYWORD = "seed_mapper" try: from qiskit.quantum_info.random import random_unitary + HAS_RANDOM_UNITARY = True except ImportError: from qiskit.tools.qi.qi import random_unitary_matrix + HAS_RANDOM_UNITARY = False @@ -70,7 +74,7 @@ def make_circuit_ring(nq, depth, seed): class BenchRandomCircuitHex: params = [2 * i for i in range(2, 8)] - param_names = ['n_qubits'] + param_names = ["n_qubits"] version = 3 def setup(self, n): @@ -80,22 +84,58 @@ def setup(self, n): def time_ibmq_backend_transpile(self, _): # Run with ibmq_16_melbourne configuration - coupling_map = [[1, 0], [1, 2], [2, 3], [4, 3], [4, 10], [5, 4], - [5, 6], [5, 9], [6, 8], [7, 8], [9, 8], [9, 10], - [11, 3], [11, 10], [11, 12], [12, 2], [13, 1], - [13, 12]] - transpile(self.circuit, - basis_gates=['u1', 'u2', 'u3', 'cx', 'id'], - coupling_map=coupling_map, - **{TRANSPILER_SEED_KEYWORD: self.seed}) + coupling_map = [ + [1, 0], + [1, 2], + [2, 3], + [4, 3], + [4, 10], + [5, 4], + [5, 6], + [5, 9], + [6, 8], + [7, 8], + [9, 8], + [9, 10], + [11, 3], + [11, 10], + [11, 12], + [12, 2], + [13, 1], + [13, 12], + ] + transpile( + self.circuit, + basis_gates=["u1", "u2", "u3", "cx", "id"], + coupling_map=coupling_map, + **{TRANSPILER_SEED_KEYWORD: self.seed}, + ) def track_depth_ibmq_backend_transpile(self, _): # Run with ibmq_16_melbourne configuration - coupling_map = [[1, 0], [1, 2], [2, 3], [4, 3], [4, 10], [5, 4], - [5, 6], [5, 9], [6, 8], [7, 8], [9, 8], [9, 10], - [11, 3], [11, 10], [11, 12], [12, 2], [13, 1], - [13, 12]] - return transpile(self.circuit, - basis_gates=['u1', 'u2', 'u3', 'cx', 'id'], - coupling_map=coupling_map, - **{TRANSPILER_SEED_KEYWORD: self.seed}).depth() + coupling_map = [ + [1, 0], + [1, 2], + [2, 3], + [4, 3], + [4, 10], + [5, 4], + [5, 6], + [5, 9], + [6, 8], + [7, 8], + [9, 8], + [9, 10], + [11, 3], + [11, 10], + [11, 12], + [12, 2], + [13, 1], + [13, 12], + ] + return transpile( + self.circuit, + basis_gates=["u1", "u2", "u3", "cx", "id"], + coupling_map=coupling_map, + **{TRANSPILER_SEED_KEYWORD: self.seed}, + ).depth() diff --git a/test/benchmarks/randomized_benchmarking.py b/test/benchmarks/randomized_benchmarking.py index 0211466b2117..1a998cafcae8 100644 --- a/test/benchmarks/randomized_benchmarking.py +++ b/test/benchmarks/randomized_benchmarking.py @@ -22,10 +22,12 @@ try: from qiskit.compiler import transpile - TRANSPILER_SEED_KEYWORD = 'seed_transpiler' + + TRANSPILER_SEED_KEYWORD = "seed_transpiler" except ImportError: from qiskit.transpiler import transpile - TRANSPILER_SEED_KEYWORD = 'seed_mapper' + + TRANSPILER_SEED_KEYWORD = "seed_mapper" def build_rb_circuit(qubits, length_vector, num_samples=1, seed=None): @@ -46,58 +48,94 @@ def build_rb_circuit(qubits, length_vector, num_samples=1, seed=None): seed=seed, ) except OSError: - skip_msg = ('Skipping tests because ' - 'tables are missing') - raise NotImplementedError( # pylint: disable=raise-missing-from - skip_msg - ) + skip_msg = "Skipping tests because " "tables are missing" + raise NotImplementedError(skip_msg) # pylint: disable=raise-missing-from return rb_exp.circuits() class RandomizedBenchmarkingBenchmark: # parameters for RB (1&2 qubits): - params = ([ - [0], # Single qubit RB - [0, 1], # Two qubit RB - ],) - param_names = ['qubits'] - version = '0.3.0' + params = ( + [ + [0], # Single qubit RB + [0, 1], # Two qubit RB + ], + ) + param_names = ["qubits"] + version = "0.3.0" timeout = 600 def setup(self, qubits): length_vector = np.arange(1, 200, 4) num_samples = 1 self.seed = 10 - self.circuits = build_rb_circuit(qubits=qubits, - length_vector=length_vector, - num_samples=num_samples, - seed=self.seed) + self.circuits = build_rb_circuit( + qubits=qubits, length_vector=length_vector, num_samples=num_samples, seed=self.seed + ) def teardown(self, _): - os.environ['QISKIT_IN_PARALLEL'] = 'FALSE' + os.environ["QISKIT_IN_PARALLEL"] = "FALSE" def time_ibmq_backend_transpile(self, __): # Run with ibmq_16_melbourne configuration - coupling_map = [[1, 0], [1, 2], [2, 3], [4, 3], [4, 10], [5, 4], - [5, 6], [5, 9], [6, 8], [7, 8], [9, 8], [9, 10], - [11, 3], [11, 10], [11, 12], [12, 2], [13, 1], - [13, 12]] - - transpile(self.circuits, - basis_gates=['u1', 'u2', 'u3', 'cx', 'id'], - coupling_map=coupling_map, optimization_level=0, - **{TRANSPILER_SEED_KEYWORD: self.seed}) + coupling_map = [ + [1, 0], + [1, 2], + [2, 3], + [4, 3], + [4, 10], + [5, 4], + [5, 6], + [5, 9], + [6, 8], + [7, 8], + [9, 8], + [9, 10], + [11, 3], + [11, 10], + [11, 12], + [12, 2], + [13, 1], + [13, 12], + ] + + transpile( + self.circuits, + basis_gates=["u1", "u2", "u3", "cx", "id"], + coupling_map=coupling_map, + optimization_level=0, + **{TRANSPILER_SEED_KEYWORD: self.seed}, + ) def time_ibmq_backend_transpile_single_thread(self, __): - os.environ['QISKIT_IN_PARALLEL'] = 'TRUE' + os.environ["QISKIT_IN_PARALLEL"] = "TRUE" # Run with ibmq_16_melbourne configuration - coupling_map = [[1, 0], [1, 2], [2, 3], [4, 3], [4, 10], [5, 4], - [5, 6], [5, 9], [6, 8], [7, 8], [9, 8], [9, 10], - [11, 3], [11, 10], [11, 12], [12, 2], [13, 1], - [13, 12]] - - transpile(self.circuits, - basis_gates=['u1', 'u2', 'u3', 'cx', 'id'], - coupling_map=coupling_map, optimization_level=0, - **{TRANSPILER_SEED_KEYWORD: self.seed}) + coupling_map = [ + [1, 0], + [1, 2], + [2, 3], + [4, 3], + [4, 10], + [5, 4], + [5, 6], + [5, 9], + [6, 8], + [7, 8], + [9, 8], + [9, 10], + [11, 3], + [11, 10], + [11, 12], + [12, 2], + [13, 1], + [13, 12], + ] + + transpile( + self.circuits, + basis_gates=["u1", "u2", "u3", "cx", "id"], + coupling_map=coupling_map, + optimization_level=0, + **{TRANSPILER_SEED_KEYWORD: self.seed}, + ) diff --git a/test/benchmarks/ripple_adder.py b/test/benchmarks/ripple_adder.py index ddc6a4e2b727..a8fef7816fd8 100644 --- a/test/benchmarks/ripple_adder.py +++ b/test/benchmarks/ripple_adder.py @@ -23,7 +23,7 @@ class RippleAdderConstruction: params = ([10, 50, 100, 200, 500],) - param_names = ['size'] + param_names = ["size"] version = 1 timeout = 600 @@ -32,27 +32,30 @@ def time_build_ripple_adder(self, size): class RippleAdderTranspile: - params = ([10, 20], - [0, 1, 2, 3]) - param_names = ['size', 'level'] + params = ([10, 20], [0, 1, 2, 3]) + param_names = ["size", "level"] version = 1 timeout = 600 def setup(self, size, _): - edge_len = int((2*size + 2)**0.5)+1 + edge_len = int((2 * size + 2) ** 0.5) + 1 self.coupling_map = CouplingMap.from_grid(edge_len, edge_len) self.circuit = build_ripple_adder_circuit(size) def time_transpile_square_grid_ripple_adder(self, _, level): - transpile(self.circuit, - coupling_map=self.coupling_map, - basis_gates=['u1', 'u2', 'u3', 'cx', 'id'], - optimization_level=level, - seed_transpiler=20220125) + transpile( + self.circuit, + coupling_map=self.coupling_map, + basis_gates=["u1", "u2", "u3", "cx", "id"], + optimization_level=level, + seed_transpiler=20220125, + ) def track_depth_transpile_square_grid_ripple_adder(self, _, level): - return transpile(self.circuit, - coupling_map=self.coupling_map, - basis_gates=['u1', 'u2', 'u3', 'cx', 'id'], - optimization_level=level, - seed_transpiler=20220125).depth() + return transpile( + self.circuit, + coupling_map=self.coupling_map, + basis_gates=["u1", "u2", "u3", "cx", "id"], + optimization_level=level, + seed_transpiler=20220125, + ).depth() diff --git a/test/benchmarks/scheduling_passes.py b/test/benchmarks/scheduling_passes.py index 4f900066ecc6..823ee6fc9725 100644 --- a/test/benchmarks/scheduling_passes.py +++ b/test/benchmarks/scheduling_passes.py @@ -32,43 +32,87 @@ class SchedulingPassBenchmarks: - params = ([5, 10, 20], - [500, 1000]) - param_names = ['n_qubits', 'depth'] + params = ([5, 10, 20], [500, 1000]) + param_names = ["n_qubits", "depth"] timeout = 300 def setup(self, n_qubits, depth): seed = 42 - self.circuit = random_circuit(n_qubits, depth, measure=True, - conditional=True, reset=True, seed=seed, - max_operands=2) - self.basis_gates = ['rz', 'sx', 'x', 'cx', 'id', 'reset'] - self.cmap = [[0, 1], [1, 0], [1, 2], [1, 6], [2, 1], [2, 3], [3, 2], - [3, 4], [3, 8], [4, 3], [5, 6], [5, 10], [6, 1], [6, 5], - [6, 7], [7, 6], [7, 8], [7, 12], [8, 3], [8, 7], [8, 9], - [9, 8], [9, 14], [10, 5], [10, 11], [11, 10], [11, 12], - [11, 16], [12, 7], [12, 11], [12, 13], [13, 12], [13, 14], - [13, 18], [14, 9], [14, 13], [15, 16], [16, 11], [16, 15], - [16, 17], [17, 16], [17, 18], [18, 13], [18, 17], - [18, 19], [19, 18]] + self.circuit = random_circuit( + n_qubits, depth, measure=True, conditional=True, reset=True, seed=seed, max_operands=2 + ) + self.basis_gates = ["rz", "sx", "x", "cx", "id", "reset"] + self.cmap = [ + [0, 1], + [1, 0], + [1, 2], + [1, 6], + [2, 1], + [2, 3], + [3, 2], + [3, 4], + [3, 8], + [4, 3], + [5, 6], + [5, 10], + [6, 1], + [6, 5], + [6, 7], + [7, 6], + [7, 8], + [7, 12], + [8, 3], + [8, 7], + [8, 9], + [9, 8], + [9, 14], + [10, 5], + [10, 11], + [11, 10], + [11, 12], + [11, 16], + [12, 7], + [12, 11], + [12, 13], + [13, 12], + [13, 14], + [13, 18], + [14, 9], + [14, 13], + [15, 16], + [16, 11], + [16, 15], + [16, 17], + [17, 16], + [17, 18], + [18, 13], + [18, 17], + [18, 19], + [19, 18], + ] self.coupling_map = CouplingMap(self.cmap) - self.transpiled_circuit = transpile(self.circuit, - basis_gates=self.basis_gates, - coupling_map=self.coupling_map, - optimization_level=1) + self.transpiled_circuit = transpile( + self.circuit, + basis_gates=self.basis_gates, + coupling_map=self.coupling_map, + optimization_level=1, + ) self.dag = circuit_to_dag(self.transpiled_circuit) - self.durations = InstructionDurations([ - ("rz", None, 0), - ("id", None, 160), - ("sx", None, 160), - ("x", None, 160), - ("cx", None, 800), - ("measure", None, 3200), - ("reset", None, 3600), - ], dt=1e-9) + self.durations = InstructionDurations( + [ + ("rz", None, 0), + ("id", None, 160), + ("sx", None, 160), + ("x", None, 160), + ("cx", None, 800), + ("measure", None, 3200), + ("reset", None, 3600), + ], + dt=1e-9, + ) self.timed_dag = TimeUnitConversion(self.durations).run(self.dag) _pass = ALAPSchedule(self.durations) - _pass.property_set['time_unit'] = "dt" + _pass.property_set["time_unit"] = "dt" self.scheduled_dag = _pass.run(self.timed_dag) def time_time_unit_conversion_pass(self, _, __): @@ -76,16 +120,13 @@ def time_time_unit_conversion_pass(self, _, __): def time_alap_schedule_pass(self, _, __): _pass = ALAPSchedule(self.durations) - _pass.property_set['time_unit'] = "dt" + _pass.property_set["time_unit"] = "dt" _pass.run(self.timed_dag) def time_asap_schedule_pass(self, _, __): _pass = ASAPSchedule(self.durations) - _pass.property_set['time_unit'] = "dt" + _pass.property_set["time_unit"] = "dt" _pass.run(self.timed_dag) def time_dynamical_decoupling_pass(self, _, __): - DynamicalDecoupling( - self.durations, - dd_sequence=[XGate(), XGate()] - ).run(self.scheduled_dag) + DynamicalDecoupling(self.durations, dd_sequence=[XGate(), XGate()]).run(self.scheduled_dag) diff --git a/test/benchmarks/state_tomography.py b/test/benchmarks/state_tomography.py index ce96c30ea075..73932d741789 100644 --- a/test/benchmarks/state_tomography.py +++ b/test/benchmarks/state_tomography.py @@ -22,12 +22,12 @@ class StateTomographyBench: params = [2, 3, 4, 5] - param_names = ['n_qubits'] - version = '0.3.0' + param_names = ["n_qubits"] + version = "0.3.0" timeout = 120.0 def setup(self, _): - self.qasm_backend = qiskit.BasicAer.get_backend('qasm_simulator') + self.qasm_backend = qiskit.BasicAer.get_backend("qasm_simulator") def time_state_tomography_bell(self, n_qubits): meas_qubits = [n_qubits - 2, n_qubits - 1] @@ -37,19 +37,17 @@ def time_state_tomography_bell(self, n_qubits): bell.cx(qr_full[meas_qubits[0]], qr_full[meas_qubits[1]]) qst_exp = StateTomography(bell, measurement_qubits=meas_qubits) - expdata = qst_exp.run( - self.qasm_backend, shots=5000).block_for_results() + expdata = qst_exp.run(self.qasm_backend, shots=5000).block_for_results() expdata.analysis_results("state") expdata.analysis_results("state_fidelity") def time_state_tomography_cat(self, n_qubits): - qr = qiskit.QuantumRegister(n_qubits, 'qr') - circ = qiskit.QuantumCircuit(qr, name='cat') + qr = qiskit.QuantumRegister(n_qubits, "qr") + circ = qiskit.QuantumCircuit(qr, name="cat") circ.h(qr[0]) for i in range(1, n_qubits): circ.cx(qr[0], qr[i]) qst_exp = StateTomography(circ) - expdata = qst_exp.run( - self.qasm_backend, shots=5000).block_for_results() + expdata = qst_exp.run(self.qasm_backend, shots=5000).block_for_results() expdata.analysis_results("state") expdata.analysis_results("state_fidelity") diff --git a/test/benchmarks/transpiler_benchmarks.py b/test/benchmarks/transpiler_benchmarks.py index f05b0a1d2db4..f115656d52e6 100644 --- a/test/benchmarks/transpiler_benchmarks.py +++ b/test/benchmarks/transpiler_benchmarks.py @@ -21,7 +21,6 @@ class TranspilerBenchSuite: - def _build_cx_circuit(self): cx_register = qiskit.QuantumRegister(2) cx_circuit = qiskit.QuantumCircuit(cx_register) @@ -42,39 +41,92 @@ def _build_single_gate_circuit(self): def setup(self): self.single_gate_circuit = self._build_single_gate_circuit() self.cx_circuit = self._build_cx_circuit() - self.qasm_path = os.path.abspath( - os.path.join(os.path.dirname(__file__), 'qasm')) - large_qasm_path = os.path.join(self.qasm_path, 'test_eoh_qasm.qasm') + self.qasm_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "qasm")) + large_qasm_path = os.path.join(self.qasm_path, "test_eoh_qasm.qasm") self.large_qasm = qiskit.QuantumCircuit.from_qasm_file(large_qasm_path) self.coupling_map = [ - [0, 1], [1, 0], [1, 2], [1, 4], [2, 1], [2, 3], [3, 2], [3, 5], - [4, 1], [4, 7], [5, 3], [5, 8], [6, 7], [7, 4], [7, 6], [7, 10], - [8, 5], [8, 9], [8, 11], [9, 8], [10, 7], [10, 12], [11, 8], - [11, 14], [12, 10], [12, 13], [12, 15], [13, 12], [13, 14], - [14, 11], [14, 13], [14, 16], [15, 12], [15, 18], [16, 14], - [16, 19], [17, 18], [18, 15], [18, 17], [18, 21], [19, 16], - [19, 20], [19, 22], [20, 19], [21, 18], [21, 23], [22, 19], - [22, 25], [23, 21], [23, 24], [24, 23], [24, 25], [25, 22], - [25, 24], [25, 26], [26, 25]] - self.basis = ['id', 'rz', 'sx', 'x', 'cx', 'reset'] + [0, 1], + [1, 0], + [1, 2], + [1, 4], + [2, 1], + [2, 3], + [3, 2], + [3, 5], + [4, 1], + [4, 7], + [5, 3], + [5, 8], + [6, 7], + [7, 4], + [7, 6], + [7, 10], + [8, 5], + [8, 9], + [8, 11], + [9, 8], + [10, 7], + [10, 12], + [11, 8], + [11, 14], + [12, 10], + [12, 13], + [12, 15], + [13, 12], + [13, 14], + [14, 11], + [14, 13], + [14, 16], + [15, 12], + [15, 18], + [16, 14], + [16, 19], + [17, 18], + [18, 15], + [18, 17], + [18, 21], + [19, 16], + [19, 20], + [19, 22], + [20, 19], + [21, 18], + [21, 23], + [22, 19], + [22, 25], + [23, 21], + [23, 24], + [24, 23], + [24, 25], + [25, 22], + [25, 24], + [25, 26], + [26, 25], + ] + self.basis = ["id", "rz", "sx", "x", "cx", "reset"] def time_single_gate_compile(self): - circ = qiskit.compiler.transpile(self.single_gate_circuit, - coupling_map=self.coupling_map, - basis_gates=self.basis, - seed_transpiler=20220125) + circ = qiskit.compiler.transpile( + self.single_gate_circuit, + coupling_map=self.coupling_map, + basis_gates=self.basis, + seed_transpiler=20220125, + ) qiskit.compiler.assemble(circ) def time_cx_compile(self): - circ = qiskit.compiler.transpile(self.cx_circuit, - coupling_map=self.coupling_map, - basis_gates=self.basis, - seed_transpiler=20220125) + circ = qiskit.compiler.transpile( + self.cx_circuit, + coupling_map=self.coupling_map, + basis_gates=self.basis, + seed_transpiler=20220125, + ) qiskit.compiler.assemble(circ) def time_compile_from_large_qasm(self): - circ = qiskit.compiler.transpile(self.large_qasm, - coupling_map=self.coupling_map, - basis_gates=self.basis, - seed_transpiler=20220125) + circ = qiskit.compiler.transpile( + self.large_qasm, + coupling_map=self.coupling_map, + basis_gates=self.basis, + seed_transpiler=20220125, + ) qiskit.compiler.assemble(circ) diff --git a/test/benchmarks/transpiler_levels.py b/test/benchmarks/transpiler_levels.py index 9e6e3ecabb82..52da423acde9 100644 --- a/test/benchmarks/transpiler_levels.py +++ b/test/benchmarks/transpiler_levels.py @@ -27,7 +27,7 @@ class TranspilerLevelBenchmarks: params = [0, 1, 2, 3] - param_names = ['transpiler optimization level'] + param_names = ["transpiler optimization level"] timeout = 600 def setup(self, _): @@ -147,71 +147,92 @@ def setup(self, _): [50, 49], [50, 41], [51, 44], - [52, 48]] - self.basis_gates = ['u1', 'u2', 'u3', 'cx', 'id'] + [52, 48], + ] + self.basis_gates = ["u1", "u2", "u3", "cx", "id"] self.qv_50_x_20 = build_qv_model_circuit(50, 20, 0) self.qv_14_x_14 = build_qv_model_circuit(14, 14, 0) - self.qasm_path = os.path.abspath( - os.path.join(os.path.dirname(__file__), 'qasm')) - large_qasm_path = os.path.join(self.qasm_path, 'test_eoh_qasm.qasm') + self.qasm_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "qasm")) + large_qasm_path = os.path.join(self.qasm_path, "test_eoh_qasm.qasm") self.large_qasm = QuantumCircuit.from_qasm_file(large_qasm_path) self.melbourne = FakeMelbourne() - self.durations = InstructionDurations([ - ("u1", None, 0), - ("id", None, 160), - ("u2", None, 160), - ("u3", None, 320), - ("cx", None, 800), - ("measure", None, 3200), - ], dt=1e-9) + self.durations = InstructionDurations( + [ + ("u1", None, 0), + ("id", None, 160), + ("u2", None, 160), + ("u3", None, 320), + ("cx", None, 800), + ("measure", None, 3200), + ], + dt=1e-9, + ) def time_quantum_volume_transpile_50_x_20(self, transpiler_level): - transpile(self.qv_50_x_20, basis_gates=self.basis_gates, - coupling_map=self.rochester_coupling_map, - seed_transpiler=0, - optimization_level=transpiler_level) + transpile( + self.qv_50_x_20, + basis_gates=self.basis_gates, + coupling_map=self.rochester_coupling_map, + seed_transpiler=0, + optimization_level=transpiler_level, + ) def track_depth_quantum_volume_transpile_50_x_20(self, transpiler_level): - return transpile(self.qv_50_x_20, basis_gates=self.basis_gates, - coupling_map=self.rochester_coupling_map, - seed_transpiler=0, - optimization_level=transpiler_level).depth() + return transpile( + self.qv_50_x_20, + basis_gates=self.basis_gates, + coupling_map=self.rochester_coupling_map, + seed_transpiler=0, + optimization_level=transpiler_level, + ).depth() def time_transpile_from_large_qasm(self, transpiler_level): - transpile(self.large_qasm, basis_gates=self.basis_gates, - coupling_map=self.rochester_coupling_map, - seed_transpiler=0, - optimization_level=transpiler_level) + transpile( + self.large_qasm, + basis_gates=self.basis_gates, + coupling_map=self.rochester_coupling_map, + seed_transpiler=0, + optimization_level=transpiler_level, + ) def track_depth_transpile_from_large_qasm(self, transpiler_level): - return transpile(self.large_qasm, basis_gates=self.basis_gates, - coupling_map=self.rochester_coupling_map, - seed_transpiler=0, - optimization_level=transpiler_level).depth() - - def time_transpile_from_large_qasm_backend_with_prop(self, - transpiler_level): - transpile(self.large_qasm, self.melbourne, seed_transpiler=0, - optimization_level=transpiler_level) - - def track_depth_transpile_from_large_qasm_backend_with_prop( - self, transpiler_level): - return transpile(self.large_qasm, self.melbourne, seed_transpiler=0, - optimization_level=transpiler_level).depth() + return transpile( + self.large_qasm, + basis_gates=self.basis_gates, + coupling_map=self.rochester_coupling_map, + seed_transpiler=0, + optimization_level=transpiler_level, + ).depth() + + def time_transpile_from_large_qasm_backend_with_prop(self, transpiler_level): + transpile( + self.large_qasm, self.melbourne, seed_transpiler=0, optimization_level=transpiler_level + ) + + def track_depth_transpile_from_large_qasm_backend_with_prop(self, transpiler_level): + return transpile( + self.large_qasm, self.melbourne, seed_transpiler=0, optimization_level=transpiler_level + ).depth() def time_transpile_qv_14_x_14(self, transpiler_level): - transpile(self.qv_14_x_14, self.melbourne, seed_transpiler=0, - optimization_level=transpiler_level) + transpile( + self.qv_14_x_14, self.melbourne, seed_transpiler=0, optimization_level=transpiler_level + ) def track_depth_transpile_qv_14_x_14(self, transpiler_level): - return transpile(self.qv_14_x_14, self.melbourne, seed_transpiler=0, - optimization_level=transpiler_level).depth() + return transpile( + self.qv_14_x_14, self.melbourne, seed_transpiler=0, optimization_level=transpiler_level + ).depth() def time_schedule_qv_14_x_14(self, transpiler_level): - transpile(self.qv_14_x_14, self.melbourne, seed_transpiler=0, - optimization_level=transpiler_level, - scheduling_method="alap", - instruction_durations=self.durations) + transpile( + self.qv_14_x_14, + self.melbourne, + seed_transpiler=0, + optimization_level=transpiler_level, + scheduling_method="alap", + instruction_durations=self.durations, + ) # limit optimization levels to reduce time time_schedule_qv_14_x_14.params = [0, 1] diff --git a/test/benchmarks/transpiler_qualitative.py b/test/benchmarks/transpiler_qualitative.py index c59f250eea09..3b6e47663a0a 100644 --- a/test/benchmarks/transpiler_qualitative.py +++ b/test/benchmarks/transpiler_qualitative.py @@ -23,76 +23,91 @@ class TranspilerQualitativeBench: - params = ([0, 1, 2, 3], - ["stochastic", "sabre"], - ["dense", "noise_adaptive", "sabre"]) + params = ([0, 1, 2, 3], ["stochastic", "sabre"], ["dense", "noise_adaptive", "sabre"]) param_names = ["optimization level", "routing method", "layout method"] timeout = 600 # pylint: disable=unused-argument def setup(self, optimization_level, routing_method, layout_method): self.backend = FakeToronto() - self.qasm_path = os.path.abspath( - os.path.join(os.path.dirname(__file__), "qasm")) + self.qasm_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "qasm")) self.depth_4gt10_v1_81 = QuantumCircuit.from_qasm_file( - os.path.join(self.qasm_path, "depth_4gt10-v1_81.qasm")) + os.path.join(self.qasm_path, "depth_4gt10-v1_81.qasm") + ) self.depth_4mod5_v0_19 = QuantumCircuit.from_qasm_file( - os.path.join(self.qasm_path, "depth_4mod5-v0_19.qasm")) + os.path.join(self.qasm_path, "depth_4mod5-v0_19.qasm") + ) self.depth_mod8_10_178 = QuantumCircuit.from_qasm_file( - os.path.join(self.qasm_path, "depth_mod8-10_178.qasm")) + os.path.join(self.qasm_path, "depth_mod8-10_178.qasm") + ) self.time_cnt3_5_179 = QuantumCircuit.from_qasm_file( - os.path.join(self.qasm_path, "time_cnt3-5_179.qasm")) + os.path.join(self.qasm_path, "time_cnt3-5_179.qasm") + ) self.time_cnt3_5_180 = QuantumCircuit.from_qasm_file( - os.path.join(self.qasm_path, "time_cnt3-5_180.qasm")) + os.path.join(self.qasm_path, "time_cnt3-5_180.qasm") + ) self.time_qft_16 = QuantumCircuit.from_qasm_file( - os.path.join(self.qasm_path, "time_qft_16.qasm")) + os.path.join(self.qasm_path, "time_qft_16.qasm") + ) - def track_depth_transpile_4gt10_v1_81(self, optimization_level, - routing_method, layout_method): - return transpile(self.depth_4gt10_v1_81, self.backend, - routing_method=routing_method, - layout_method=layout_method, - optimization_level=optimization_level, - seed_transpiler=0).depth() + def track_depth_transpile_4gt10_v1_81(self, optimization_level, routing_method, layout_method): + return transpile( + self.depth_4gt10_v1_81, + self.backend, + routing_method=routing_method, + layout_method=layout_method, + optimization_level=optimization_level, + seed_transpiler=0, + ).depth() - def track_depth_transpile_4mod5_v0_19(self, optimization_level, - routing_method, layout_method): - return transpile(self.depth_4mod5_v0_19, self.backend, - routing_method=routing_method, - layout_method=layout_method, - optimization_level=optimization_level, - seed_transpiler=0).depth() + def track_depth_transpile_4mod5_v0_19(self, optimization_level, routing_method, layout_method): + return transpile( + self.depth_4mod5_v0_19, + self.backend, + routing_method=routing_method, + layout_method=layout_method, + optimization_level=optimization_level, + seed_transpiler=0, + ).depth() - def track_depth_transpile_mod8_10_178(self, optimization_level, - routing_method, layout_method): - return transpile(self.depth_mod8_10_178, self.backend, - routing_method=routing_method, - layout_method=layout_method, - optimization_level=optimization_level, - seed_transpiler=0).depth() + def track_depth_transpile_mod8_10_178(self, optimization_level, routing_method, layout_method): + return transpile( + self.depth_mod8_10_178, + self.backend, + routing_method=routing_method, + layout_method=layout_method, + optimization_level=optimization_level, + seed_transpiler=0, + ).depth() - def time_transpile_time_cnt3_5_179(self, optimization_level, - routing_method, layout_method): - transpile(self.time_cnt3_5_179, self.backend, - routing_method=routing_method, - layout_method=layout_method, - optimization_level=optimization_level, - seed_transpiler=0) + def time_transpile_time_cnt3_5_179(self, optimization_level, routing_method, layout_method): + transpile( + self.time_cnt3_5_179, + self.backend, + routing_method=routing_method, + layout_method=layout_method, + optimization_level=optimization_level, + seed_transpiler=0, + ) - def time_transpile_time_cnt3_5_180(self, optimization_level, - routing_method, layout_method): - transpile(self.time_cnt3_5_180, self.backend, - routing_method=routing_method, - layout_method=layout_method, - optimization_level=optimization_level, - seed_transpiler=0) + def time_transpile_time_cnt3_5_180(self, optimization_level, routing_method, layout_method): + transpile( + self.time_cnt3_5_180, + self.backend, + routing_method=routing_method, + layout_method=layout_method, + optimization_level=optimization_level, + seed_transpiler=0, + ) - def time_transpile_time_qft_16(self, optimization_level, - routing_method, layout_method): - transpile(self.time_qft_16, self.backend, - routing_method=routing_method, - layout_method=layout_method, - optimization_level=optimization_level, - seed_transpiler=0) + def time_transpile_time_qft_16(self, optimization_level, routing_method, layout_method): + transpile( + self.time_qft_16, + self.backend, + routing_method=routing_method, + layout_method=layout_method, + optimization_level=optimization_level, + seed_transpiler=0, + ) diff --git a/test/benchmarks/utils.py b/test/benchmarks/utils.py index d084c1ba9635..0b311a0af027 100644 --- a/test/benchmarks/utils.py +++ b/test/benchmarks/utils.py @@ -21,16 +21,39 @@ from qiskit.quantum_info.random import random_unitary from qiskit.circuit import QuantumRegister, ClassicalRegister, QuantumCircuit from qiskit.circuit import Reset -from qiskit.circuit.library import (IGate, U1Gate, U2Gate, U3Gate, XGate, - YGate, ZGate, HGate, SGate, SdgGate, TGate, - TdgGate, RXGate, RYGate, RZGate, CXGate, - CYGate, CZGate, CHGate, CRZGate, CU1Gate, - CU3Gate, SwapGate, RZZGate, - CCXGate, CSwapGate) - - -def random_circuit(n_qubits, depth, max_operands=3, measure=False, - conditional=False, reset=False, seed=None): +from qiskit.circuit.library import ( + IGate, + U1Gate, + U2Gate, + U3Gate, + XGate, + YGate, + ZGate, + HGate, + SGate, + SdgGate, + TGate, + TdgGate, + RXGate, + RYGate, + RZGate, + CXGate, + CYGate, + CZGate, + CHGate, + CRZGate, + CU1Gate, + CU3Gate, + SwapGate, + RZZGate, + CCXGate, + CSwapGate, +) + + +def random_circuit( + n_qubits, depth, max_operands=3, measure=False, conditional=False, reset=False, seed=None +): """Generate random circuit of arbitrary size and form. Args: @@ -52,20 +75,34 @@ def random_circuit(n_qubits, depth, max_operands=3, measure=False, if max_operands < 1 or max_operands > 3: raise Exception("max_operands must be between 1 and 3") - one_q_ops = [IGate, U1Gate, U2Gate, U3Gate, XGate, YGate, ZGate, - HGate, SGate, SdgGate, TGate, TdgGate, RXGate, RYGate, RZGate] + one_q_ops = [ + IGate, + U1Gate, + U2Gate, + U3Gate, + XGate, + YGate, + ZGate, + HGate, + SGate, + SdgGate, + TGate, + TdgGate, + RXGate, + RYGate, + RZGate, + ] one_param = [U1Gate, RXGate, RYGate, RZGate, RZZGate, CU1Gate, CRZGate] two_param = [U2Gate] three_param = [U3Gate, CU3Gate] - two_q_ops = [CXGate, CYGate, CZGate, CHGate, CRZGate, - CYGate, CU3Gate, SwapGate, RZZGate] + two_q_ops = [CXGate, CYGate, CZGate, CHGate, CRZGate, CYGate, CU3Gate, SwapGate, RZZGate] three_q_ops = [CCXGate, CSwapGate] - qr = QuantumRegister(n_qubits, 'q') + qr = QuantumRegister(n_qubits, "q") qc = QuantumCircuit(n_qubits) if measure or conditional: - cr = ClassicalRegister(n_qubits, 'c') + cr = ClassicalRegister(n_qubits, "c") qc.add_register(cr) if reset: @@ -84,8 +121,7 @@ def random_circuit(n_qubits, depth, max_operands=3, measure=False, num_operands = rng.choice(range(max_possible_operands)) + 1 rng.shuffle(remaining_qubits) operands = remaining_qubits[:num_operands] - remaining_qubits = [ - q for q in remaining_qubits if q not in operands] + remaining_qubits = [q for q in remaining_qubits if q not in operands] if num_operands == 1: operation = rng.choice(one_q_ops) elif num_operands == 2: @@ -100,7 +136,7 @@ def random_circuit(n_qubits, depth, max_operands=3, measure=False, num_angles = 3 else: num_angles = 0 - angles = [rng.uniform(0, 2*np.pi) for x in range(num_angles)] + angles = [rng.uniform(0, 2 * np.pi) for x in range(num_angles)] register_operands = [qr[i] for i in operands] op = operation(*angles) @@ -130,9 +166,9 @@ def build_qv_model_circuit(width, depth, seed=None): # Generate uniformly random permutation Pj of [0...n-1] perm = np.random.permutation(width) # For each pair p in Pj, generate Haar random SU(4) - for k in range(int(np.floor(width/2))): + for k in range(int(np.floor(width / 2))): U = random_unitary(4) - pair = int(perm[2*k]), int(perm[2*k+1]) + pair = int(perm[2 * k]), int(perm[2 * k + 1]) circuit.append(U, [pair[0], pair[1]]) return circuit @@ -146,7 +182,7 @@ def build_ripple_adder_circuit(size): b = QuantumRegister(n, "b") cin = QuantumRegister(1, "cin") cout = QuantumRegister(1, "cout") - ans = ClassicalRegister(n+1, "ans") + ans = ClassicalRegister(n + 1, "ans") qc = QuantumCircuit(a, b, cin, cout, ans, name="rippleadd") def majority(p, a, b, c): @@ -176,7 +212,7 @@ def unmajority(p, a, b, c): # Set the inputs to the adder qc.x(a[0]) # Set input a = 0...0001 - qc.x(b) # Set input b = 1...1111 + qc.x(b) # Set input b = 1...1111 # Apply the adder qc += adder_subcircuit From 2530ca86f0f9289c9124f340bfc2eb1c6c7c1c78 Mon Sep 17 00:00:00 2001 From: Jake Lishman Date: Tue, 1 Aug 2023 15:49:18 +0100 Subject: [PATCH 60/61] Fix Terra's lint complaints --- test/benchmarks/__init__.py | 11 ++++++++++ test/benchmarks/assembler.py | 4 +--- test/benchmarks/circuit_construction.py | 4 +--- test/benchmarks/converters.py | 4 +--- test/benchmarks/import.py | 4 +--- test/benchmarks/isometry.py | 4 +--- test/benchmarks/mapping_passes.py | 4 +--- test/benchmarks/passes.py | 4 +--- test/benchmarks/pulse/__init__.py | 11 ++++++++++ test/benchmarks/pulse/load_pulse_defaults.py | 4 +--- .../benchmarks/pulse/schedule_construction.py | 4 +--- test/benchmarks/pulse/schedule_lowering.py | 4 +--- test/benchmarks/qasm/__init__.py | 11 ++++++++++ test/benchmarks/qft.py | 4 +--- test/benchmarks/quantum_info.py | 4 +--- test/benchmarks/quantum_volume.py | 21 +++++++------------ test/benchmarks/queko.py | 4 +--- test/benchmarks/random_circuit_hex.py | 4 +--- test/benchmarks/randomized_benchmarking.py | 6 ++---- test/benchmarks/ripple_adder.py | 4 +--- test/benchmarks/scheduling_passes.py | 4 +--- test/benchmarks/state_tomography.py | 7 +++---- test/benchmarks/transpiler_benchmarks.py | 4 +--- test/benchmarks/transpiler_levels.py | 4 +--- test/benchmarks/transpiler_qualitative.py | 4 +--- test/benchmarks/utils.py | 4 +--- 26 files changed, 66 insertions(+), 81 deletions(-) diff --git a/test/benchmarks/__init__.py b/test/benchmarks/__init__.py index e69de29bb2d1..c7325a848299 100644 --- a/test/benchmarks/__init__.py +++ b/test/benchmarks/__init__.py @@ -0,0 +1,11 @@ +# This code is part of Qiskit. +# +# (C) Copyright IBM 2023 +# +# This code is licensed under the Apache License, Version 2.0. You may +# obtain a copy of this license in the LICENSE.txt file in the root directory +# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. +# +# Any modifications or derivative works of this code must retain this +# copyright notice, and modified files need to carry a notice indicating +# that they have been altered from the originals. diff --git a/test/benchmarks/assembler.py b/test/benchmarks/assembler.py index 251a0413e303..3899c05e92bb 100644 --- a/test/benchmarks/assembler.py +++ b/test/benchmarks/assembler.py @@ -1,8 +1,6 @@ -# -*- coding: utf-8 -*- - # This code is part of Qiskit. # -# (C) Copyright IBM 2019. +# (C) Copyright IBM 2023 # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory diff --git a/test/benchmarks/circuit_construction.py b/test/benchmarks/circuit_construction.py index 0523a5dea3a1..6e984823dff0 100644 --- a/test/benchmarks/circuit_construction.py +++ b/test/benchmarks/circuit_construction.py @@ -1,8 +1,6 @@ -# -*- coding: utf-8 -* - # This code is part of Qiskit. # -# (C) Copyright IBM 2018, 2019. +# (C) Copyright IBM 2023 # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory diff --git a/test/benchmarks/converters.py b/test/benchmarks/converters.py index f92d13696db5..041e40dd6de1 100644 --- a/test/benchmarks/converters.py +++ b/test/benchmarks/converters.py @@ -1,8 +1,6 @@ -# -*- coding: utf-8 -*- - # This code is part of Qiskit. # -# (C) Copyright IBM 2019. +# (C) Copyright IBM 2023 # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory diff --git a/test/benchmarks/import.py b/test/benchmarks/import.py index 552f4818747c..fcfb382919cb 100644 --- a/test/benchmarks/import.py +++ b/test/benchmarks/import.py @@ -1,8 +1,6 @@ -# -*- coding: utf-8 -*- - # This code is part of Qiskit. # -# (C) Copyright IBM 2019. +# (C) Copyright IBM 2023 # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory diff --git a/test/benchmarks/isometry.py b/test/benchmarks/isometry.py index c29d35027cea..e4e696beba43 100644 --- a/test/benchmarks/isometry.py +++ b/test/benchmarks/isometry.py @@ -1,8 +1,6 @@ -# -*- coding: utf-8 -*- - # This code is part of Qiskit. # -# (C) Copyright IBM 2019. +# (C) Copyright IBM 2023 # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory diff --git a/test/benchmarks/mapping_passes.py b/test/benchmarks/mapping_passes.py index 2a3e3f776117..fb6ca35316aa 100644 --- a/test/benchmarks/mapping_passes.py +++ b/test/benchmarks/mapping_passes.py @@ -1,8 +1,6 @@ -# -*- coding: utf-8 -*- - # This code is part of Qiskit. # -# (C) Copyright IBM 2019. +# (C) Copyright IBM 2023 # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory diff --git a/test/benchmarks/passes.py b/test/benchmarks/passes.py index 3a07f025e37d..1f93fcd9956e 100644 --- a/test/benchmarks/passes.py +++ b/test/benchmarks/passes.py @@ -1,8 +1,6 @@ -# -*- coding: utf-8 -*- - # This code is part of Qiskit. # -# (C) Copyright IBM 2019. +# (C) Copyright IBM 2023 # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory diff --git a/test/benchmarks/pulse/__init__.py b/test/benchmarks/pulse/__init__.py index e69de29bb2d1..c7325a848299 100644 --- a/test/benchmarks/pulse/__init__.py +++ b/test/benchmarks/pulse/__init__.py @@ -0,0 +1,11 @@ +# This code is part of Qiskit. +# +# (C) Copyright IBM 2023 +# +# This code is licensed under the Apache License, Version 2.0. You may +# obtain a copy of this license in the LICENSE.txt file in the root directory +# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. +# +# Any modifications or derivative works of this code must retain this +# copyright notice, and modified files need to carry a notice indicating +# that they have been altered from the originals. diff --git a/test/benchmarks/pulse/load_pulse_defaults.py b/test/benchmarks/pulse/load_pulse_defaults.py index ad8feb842c34..1b7fa5cc1719 100644 --- a/test/benchmarks/pulse/load_pulse_defaults.py +++ b/test/benchmarks/pulse/load_pulse_defaults.py @@ -1,8 +1,6 @@ -# -*- coding: utf-8 -* - # This code is part of Qiskit. # -# (C) Copyright IBM 2020. +# (C) Copyright IBM 2023 # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory diff --git a/test/benchmarks/pulse/schedule_construction.py b/test/benchmarks/pulse/schedule_construction.py index 504b6044c5ea..13b889a19513 100644 --- a/test/benchmarks/pulse/schedule_construction.py +++ b/test/benchmarks/pulse/schedule_construction.py @@ -1,8 +1,6 @@ -# -*- coding: utf-8 -* - # This code is part of Qiskit. # -# (C) Copyright IBM 2020. +# (C) Copyright IBM 2023 # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory diff --git a/test/benchmarks/pulse/schedule_lowering.py b/test/benchmarks/pulse/schedule_lowering.py index 8c600373b787..38b09a8411be 100644 --- a/test/benchmarks/pulse/schedule_lowering.py +++ b/test/benchmarks/pulse/schedule_lowering.py @@ -1,8 +1,6 @@ -# -*- coding: utf-8 -* - # This code is part of Qiskit. # -# (C) Copyright IBM 2020. +# (C) Copyright IBM 2023 # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory diff --git a/test/benchmarks/qasm/__init__.py b/test/benchmarks/qasm/__init__.py index e69de29bb2d1..c7325a848299 100644 --- a/test/benchmarks/qasm/__init__.py +++ b/test/benchmarks/qasm/__init__.py @@ -0,0 +1,11 @@ +# This code is part of Qiskit. +# +# (C) Copyright IBM 2023 +# +# This code is licensed under the Apache License, Version 2.0. You may +# obtain a copy of this license in the LICENSE.txt file in the root directory +# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. +# +# Any modifications or derivative works of this code must retain this +# copyright notice, and modified files need to carry a notice indicating +# that they have been altered from the originals. diff --git a/test/benchmarks/qft.py b/test/benchmarks/qft.py index 4067dbf84886..4533ba413cbc 100644 --- a/test/benchmarks/qft.py +++ b/test/benchmarks/qft.py @@ -1,8 +1,6 @@ -# -*- coding: utf-8 -* - # This code is part of Qiskit. # -# (C) Copyright IBM 2018, 2019. +# (C) Copyright IBM 2023 # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory diff --git a/test/benchmarks/quantum_info.py b/test/benchmarks/quantum_info.py index fc83ab3f12b9..b4fb8fb67dc0 100644 --- a/test/benchmarks/quantum_info.py +++ b/test/benchmarks/quantum_info.py @@ -1,8 +1,6 @@ -# -*- coding: utf-8 -* - # This code is part of Qiskit. # -# (C) Copyright IBM 2021. +# (C) Copyright IBM 2023 # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory diff --git a/test/benchmarks/quantum_volume.py b/test/benchmarks/quantum_volume.py index 8fb627a95045..6f45db4edc35 100644 --- a/test/benchmarks/quantum_volume.py +++ b/test/benchmarks/quantum_volume.py @@ -1,19 +1,14 @@ -# -*- coding: utf-8 -*- - -# Copyright 2018 IBM RESEARCH. All Rights Reserved. +# This code is part of Qiskit. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# (C) Copyright IBM 2023 # -# http://www.apache.org/licenses/LICENSE-2.0 +# This code is licensed under the Apache License, Version 2.0. You may +# obtain a copy of this license in the LICENSE.txt file in the root directory +# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============================================================================= +# Any modifications or derivative works of this code must retain this +# copyright notice, and modified files need to carry a notice indicating +# that they have been altered from the originals. # pylint: disable=missing-class-docstring,missing-function-docstring # pylint: disable=attribute-defined-outside-init diff --git a/test/benchmarks/queko.py b/test/benchmarks/queko.py index fbe55de774b1..7bc58bea9059 100644 --- a/test/benchmarks/queko.py +++ b/test/benchmarks/queko.py @@ -1,8 +1,6 @@ -# -*- coding: utf-8 -*- - # This code is part of Qiskit. # -# (C) Copyright IBM 2021. +# (C) Copyright IBM 2023 # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory diff --git a/test/benchmarks/random_circuit_hex.py b/test/benchmarks/random_circuit_hex.py index 5b69100ae2c8..bb6c0882ae06 100644 --- a/test/benchmarks/random_circuit_hex.py +++ b/test/benchmarks/random_circuit_hex.py @@ -1,8 +1,6 @@ -# -*- coding: utf-8 -*- - # This code is part of Qiskit. # -# (C) Copyright IBM 2018, 2019. +# (C) Copyright IBM 2023 # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory diff --git a/test/benchmarks/randomized_benchmarking.py b/test/benchmarks/randomized_benchmarking.py index 1a998cafcae8..4772a7ccb4cc 100644 --- a/test/benchmarks/randomized_benchmarking.py +++ b/test/benchmarks/randomized_benchmarking.py @@ -1,8 +1,6 @@ -# -*- coding: utf-8 -*- - # This code is part of Qiskit. # -# (C) Copyright IBM 2019. +# (C) Copyright IBM 2023 # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory @@ -48,7 +46,7 @@ def build_rb_circuit(qubits, length_vector, num_samples=1, seed=None): seed=seed, ) except OSError: - skip_msg = "Skipping tests because " "tables are missing" + skip_msg = "Skipping tests because tables are missing" raise NotImplementedError(skip_msg) # pylint: disable=raise-missing-from return rb_exp.circuits() diff --git a/test/benchmarks/ripple_adder.py b/test/benchmarks/ripple_adder.py index a8fef7816fd8..344a562f85d2 100644 --- a/test/benchmarks/ripple_adder.py +++ b/test/benchmarks/ripple_adder.py @@ -1,8 +1,6 @@ -# -*- coding: utf-8 -*- - # This code is part of Qiskit. # -# (C) Copyright IBM 2019. +# (C) Copyright IBM 2023 # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory diff --git a/test/benchmarks/scheduling_passes.py b/test/benchmarks/scheduling_passes.py index 823ee6fc9725..3d97ecdf67d3 100644 --- a/test/benchmarks/scheduling_passes.py +++ b/test/benchmarks/scheduling_passes.py @@ -1,8 +1,6 @@ -# -*- coding: utf-8 -*- - # This code is part of Qiskit. # -# (C) Copyright IBM 2021. +# (C) Copyright IBM 2023 # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory diff --git a/test/benchmarks/state_tomography.py b/test/benchmarks/state_tomography.py index 73932d741789..03496c9bf35f 100644 --- a/test/benchmarks/state_tomography.py +++ b/test/benchmarks/state_tomography.py @@ -1,8 +1,6 @@ -# -*- coding: utf-8 -*- - # This code is part of Qiskit. # -# (C) Copyright IBM 2017, 2019. +# (C) Copyright IBM 2023 # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory @@ -16,9 +14,10 @@ # pylint: disable=no-else-return, attribute-defined-outside-init # pylint: disable=import-error -import qiskit from qiskit_experiments.library import StateTomography +import qiskit + class StateTomographyBench: params = [2, 3, 4, 5] diff --git a/test/benchmarks/transpiler_benchmarks.py b/test/benchmarks/transpiler_benchmarks.py index f115656d52e6..a2ba39ab306d 100644 --- a/test/benchmarks/transpiler_benchmarks.py +++ b/test/benchmarks/transpiler_benchmarks.py @@ -1,8 +1,6 @@ -# -*- coding: utf-8 -* - # This code is part of Qiskit. # -# (C) Copyright IBM 2018. +# (C) Copyright IBM 2023 # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory diff --git a/test/benchmarks/transpiler_levels.py b/test/benchmarks/transpiler_levels.py index 52da423acde9..a8467ed5dc95 100644 --- a/test/benchmarks/transpiler_levels.py +++ b/test/benchmarks/transpiler_levels.py @@ -1,8 +1,6 @@ -# -*- coding: utf-8 -*- - # This code is part of Qiskit. # -# (C) Copyright IBM 2019. +# (C) Copyright IBM 2023 # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory diff --git a/test/benchmarks/transpiler_qualitative.py b/test/benchmarks/transpiler_qualitative.py index 3b6e47663a0a..6b64affe57c7 100644 --- a/test/benchmarks/transpiler_qualitative.py +++ b/test/benchmarks/transpiler_qualitative.py @@ -1,8 +1,6 @@ -# -*- coding: utf-8 -*- - # This code is part of Qiskit. # -# (C) Copyright IBM 2020. +# (C) Copyright IBM 2023 # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory diff --git a/test/benchmarks/utils.py b/test/benchmarks/utils.py index 0b311a0af027..19b6f990879b 100644 --- a/test/benchmarks/utils.py +++ b/test/benchmarks/utils.py @@ -1,8 +1,6 @@ -# -*- coding: utf-8 -*- - # This code is part of Qiskit. # -# (C) Copyright IBM 2019. +# (C) Copyright IBM 2023 # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory From 67a1412a17392b9002a637e5c45c4820f27f9def Mon Sep 17 00:00:00 2001 From: Jake Lishman Date: Tue, 1 Aug 2023 18:52:58 +0100 Subject: [PATCH 61/61] Add Terra-specific ASV configuration This is not directly copied from the metapackage because several components of it needed to changes as it came other, and it was mostly autogenerated or out-of-date anyway. We may want to tweak how requirements are managed and installed in the future. --- .gitignore | 1 + asv.conf.json | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 asv.conf.json diff --git a/.gitignore b/.gitignore index d131395fe509..3c88ffd7c610 100644 --- a/.gitignore +++ b/.gitignore @@ -98,6 +98,7 @@ celerybeat-schedule .env # virtualenv +.asv/ .venv venv/ ENV/ diff --git a/asv.conf.json b/asv.conf.json new file mode 100644 index 000000000000..70e736e26f75 --- /dev/null +++ b/asv.conf.json @@ -0,0 +1,25 @@ +{ + "version": 1, + "project": "qiskit", + "project_url": "https://qiskit.org", + "repo": ".", + "install_command": [ + "in-dir={env_dir} python -mpip install {wheel_file}[all] python-constraint qiskit-experiments==0.3.0" + ], + "uninstall_command": [ + "return-code=any python -mpip uninstall -y {project}" + ], + "build_command": [ + "pip install -U setuptools-rust", + "python setup.py build_rust --release", + "PIP_NO_BUILD_ISOLATION=false python -mpip wheel --no-deps --no-index -w {build_cache_dir} {build_dir}" + ], + "branches": ["main"], + "dvcs": "git", + "environment_type": "virtualenv", + "show_commit_url": "http://github.com/Qiskit/qiskit-terra/commit/", + "pythons": ["3.8", "3.9", "3.10", "3.11"], + "benchmark_dir": "test/benchmarks", + "env_dir": ".asv/env", + "results_dir": ".asv/results" +}