Steven Yuan
Professor Zhang
16:198:516 Programming Languages and Compilers II
5/12/2021
SIPF is an algorithm that frames Qubit Allocation as a combination of the Subgraph Isomorphism and Token Swapping Algorithms by Partitioning with a Failure Heuristic.
At least C++11.
make
: compile themapper
binarymake debug
: compile themapper
binary with debug flagsmake clean
: remove compiled files
mapper path/to/circuit.qasm path/to/coupling.txt [-optimal]
path/to/circuit.qasm
: QASM circuit file (seeqelib1.inc
for available quantum gates)path/to/coupling.txt
: coupling graph file (seecouplings/
for example architectures)-optimal
: optimal allocator (optional)
Examples:
mapper circuits/3qubits/or.qasm couplings/qx2.txt
mapper circuits/5qubits/4gt13_92.qasm couplings/2x3.txt -optimal
Modified Transformed Circuit with metadata and comments to standard output.
Example:
$ mapper circuits/3qubits/or.qasm couplings/qx2.txt
//Number of Swaps: 0
//Number of Mappings: 1
//Depth: 8
//Number of Gates: 17
OPENQASM 2.0;
include "qelib1.inc";
qreg q[5];
//Location of qubits: 0,1,2
x q[0];
tdg q[1];
h q[2];
cx q[2], q[1];
tdg q[0];
t q[1];
tdg q[2];
cx q[0], q[1];
sdg q[2];
cx q[2], q[0];
t q[1];
t q[0];
cx q[2], q[1];
tdg q[1];
cx q[2], q[0];
cx q[0], q[1];
h q[2];
Run git submodule update --init --recursive
to pull the git submodules:
enfield
jsoncpp
QUEKO-benchmark
Modify and run feedback.sh
with the variables:
output
: define output directory- Line 48: toggle the
-optimal
flag
In the output/
directory's record.txt
file, remove any tests that were Assertion failed
or No Mappings Possible
.
Run node report.js path/to/record.txt
to get the columns and values: circuit and coupling, depth, number of gates, real time, and user + sys time.
Follow the instructions in the README.md
file of the enfield
repository (path to jsoncpp
is path to the git submodule jsoncpp
).
Modify and run ./feedback-enfield.sh
with the variables:
output
: define output directory- Line 48: modify input arguments to the
efd
programefd
is inenfield/build/tools/efd
-i
: input QASM file-alloc
: define qubit allocator-stats
: show statistics-arch-file
: input coupling graph file (in JSON)
In the output/
directory's record.txt
file, remove any tests that were Killed
or ERROR
.
Run node report-enfield.js path/to/record.txt
to get the columns and values: circuit and coupling, depth, number of gates, real time, and user + sys time.
Checkout the lab1-review
branch.
Rebuild the mapper
binary.
Run:
lab1.sh
for generic initial mappingslab1-queko.sh
forQUEKO-benchmark
initial mappings