This project aims to reproduce the results of CGO’18 paper “Qubit Allocation”.
Inside we have Enfield, IBM’s qiskit-sdk-py, benchmarks and scripts that shall help running the experiments.
There are some software dependencies: flex (2.6.1); bison (3.0.4); googletest; python3; and R (with ggplot2).
Installation and download of the qiskit-sdk-py can be found here.
Note that the only thing left to be done is to install the python dependencies with
pip the dependencies in the path
$ pip install -r requires.txt
Installation and download of the googletest framework can be found here.
After installing R, you should run it by issuing R in the command line, then:
The top-level of this project contains the following:
As qiskit-sdk-py is a python project there is nothing more to be done. Enfield must be compiled issuing the following:
# If you wish to run the unit tests $ ./compile-with-tests.sh # If you do not wish to run the unit tests $ ./compile.sh
Or, if one wants to compile manually:
$ cd enfield $ mkdir build $ cmake ../ -DENABLE_TESTS=ON $ make && make test
If you don’t have googletest framework, you should execute the following instead:
$ cd enfield $ mkdir build $ cmake ../ $ make && make test
After compiling, one should issue the command:
<number-of-runs> refers to the number of times each benchmark should be run. In this paper we have set it to
5. After executing this command (which should take a while), you should get these seven files:
(Note that the raw data files are in
csv format, first line being a header line)
With these in hands, one should be able to verify the paper’s results. There are also the results obtained for the paper inside the folder
results/ (both the images and as well as the raw data).
The above command runs three experiments. One can also run them separately as the table below shows:
Enfield lets the user tweak it by passing command line arguments. One of the things is the cost of the quantum transformations: reversal, swap and bridge. In order for passing more command lines to enfield’s execution in the scripts the user should only edit the file
enfield\_args in the
root directory (one command at each line).
For example, if one wishes to change the costs of reversal to
10, swap to
20 and bridge to
enfield_args should look like this:
--rev-cost 10 --swap-cost 20 --lcx-cost 30
It is not the same for qiskit-sdk-py. If one wants to tweak it also, he should change the hard-coded cost inside:
Enfield’s binary is in
enfield/build/tool/efd. It has some command line arguments, such as:
||show statistical information after execution|
||specify the qubit allocator to be used|
||specify the quantum architecture to be used|
-alloc can have the following values:
wpmwithout the initial allocation phase.
-arch can have the following values:
<filename>and loads as an architecture.
n is the number of vertices and
ai bi indicates an edge between them:
n a1 b1 a1 bn a2 b3 an bn ...
It also has command line arguments for changing the cost for each quantum transformation:
One example of usage:
$ enfield/build/tools/efd -i enfield-bench/ibm-benchmarks/pea.qasm \ -alloc wpm -arch ibmqx2 \ --rev-cost 8 --swap-cost 20 --lcx-cost 22 \ -stats
When running the experiments for qiskit-sdk-py, one should use the python script we implemented
qiskit-sdk-py/IBMFront.py. It should be used as follows:
$ python3 IBMFront.py <filename> <architecture>
<architecture> may be either:
$ python3 qiskit-sdk-py/IBMFront.py enfield-bench/ibm-benchmarks/grv.qasm ibmqx2