Optimal Layout Synthesizer of Quantum Circuits for Dynamically Field-Programmable Qubits Array. Open source under the BSD 3-Clause license.
Repo structure:
run.pyis an example of using the compiler. Refer topython run.py -hfor options.solve.pycontains the classDPQAwhere we encode the compilation problem to SMT, and usez3-solverto solve it.graphs.jsoncontains some random 3-regular graphs.animation.pycontains the classCodeGenthat generates DPQA instructions (five typesInit,Rydberg,Activate,Deactivate, andMove), and the classAnimatorthat generates animations from DPQA instructions. Refer topython animation.py -hfor options.results/is the default directory for the results.results/smt/contains the output of SMT variable assignments.results/code/contains the code files generated from SMT output.results/animations/contains a few example animations generated from code files.
How to use the compiler:
- We used a Python 3 environment with
z3-solver,networkx, andpython-sat, andmatplotlib. The Python scripts are run in the root directory of the repo. - Run
python run.py <S> <I>where<S>is the size of the random 3-regular graph,<I>is the id of the graph. To try other graphs, please editrun.pyas needed. - The specific runtimes can differ because of the hardware, environment, and updates of this repo. Please refer to branch(es) of this repo for specific versions corresponding to the paper(s), e.g., arxiv2306.03487
- (Optional) To generate animation, run
python animation.py <F>where<F>is the SMT output file, e.g.,results/smt/rand3reg_90_4.json.
Explaination of run.py:
- The main class is named
DPQAwhich is insolve.py.- When we initialize it, there is a mandatory argument
namewhich is used for saving output file (a JSON containing SMT variables). - Optionally, you can specify the directory for this file with argument
dir. - There is another optional argument
print_detailto specify the granularity of printout.
- When we initialize it, there is a mandatory argument
- We need to specify the architecture with
setArchitecturemethod ofDPQA. It takes in a list of 4 numbers, which are the number of columns of interaction sites, the number of rows of interaction sites, the number of AOD columns, and the number of AOD rows. - We need to specify the two-qubit gates in a list with
setProgrammethod ofDPQA. For example, a circuit CZ(0,1), CZ(1,2), CZ(0,1) will be[[0,1], [1,2], [0,1]]. - If all the gates are commutable with each other (e.g., the two-qubit gates in an iteration of QAOA), call the
setCommutationmethod ofDPQA. Otherwise, do not call it and the compiler will process the gates considering dependency. - We can set the ratio of switching from interative peeling to optimal (multi-stage) solving with
setOptimalRatiomethod ofDPQA. By default, the ratio is 0. - Finally, we can solve the formulated SMT problem with the
solvemethod ofDPQA.