2020-03-25 17:46:32 +00:00
% vim: ft=tex
2020-03-29 10:43:03 +00:00
\chapter { Appendix}
2020-03-25 17:46:32 +00:00
2020-03-29 10:43:03 +00:00
\section { Source Code for the Benchmarks}
2020-03-25 17:46:32 +00:00
\label { ref:code_ benchmarks}
2020-04-06 16:32:33 +00:00
The benchmarks used in \ref { ref:performance} are based on this code. Note
2020-03-25 17:46:32 +00:00
that the execution time is measured which is inherently noisy. To account for
the noise several strategies are used:
2020-04-06 16:32:33 +00:00
\begin { enumerate} [1.]
2020-03-25 17:46:32 +00:00
\item { The same circuit is applied to the starting state several times. The
minimal result is used as the noise must be positive}
\item { Several circuits are applied to the starting state. The remaining
noise is mixed with the variance due to the different circuits.}
\item { Because the noise can be timely correlated (i.e. another process
requires processor time for a longer period) the tests have been
randomized such that the time correlated noise is distributed randomly over
several uncorrelated measurements.}
\end { enumerate}
The code used to benchmark the three regimes is analogous and not included here.
\lstinputlisting [title={Generating Data for the Dense State Vector vs. Graphical Simulator Benchmark}, language=Python, breaklines=true] { ../performance/generate_ data_ scaling_ qbits.py}
\lstinputlisting [title={Code for Measuring and Computing the Execution Time and Statistics}, language=Python, breaklines=true] { ../performance/measure_ circuit.py}
2020-03-29 10:43:03 +00:00
\section { Complete Graphical States from the Three Regimes}
2020-03-25 17:46:32 +00:00
\label { ref:complete_ graphs}
Because the whole graphs are barely percetible windows have been used
in Figure \ref { fig:graph_ high_ linear_ regime} and Figure \ref { fig:graph_ intermediate_ regime} .
2020-04-06 16:32:33 +00:00
For the sake of completeness the whole graphs are included here in
2020-03-25 17:46:32 +00:00
Figure \ref { fig:graph_ intermediate_ regime_ full} and Figure \ref { fig:graph_ high_ linear_ regime_ full} .
\begin { figure} [H]
\centering
\includegraphics [width=\linewidth] { graphics/graph_ intermediate_ regime.png}
\caption [Typical Graphical State in the Intermediate Regime] { Typical Graphical State in the Intermediate Regime}
\label { fig:graph_ intermediate_ regime_ full}
\end { figure}
\begin { figure} [H]
\centering
\includegraphics [width=\linewidth] { graphics/graph_ high_ linear_ regime.png}
\caption [Typical Graphical State in the High-Linear Regime] { Typical Graphical State in the High-Linear Regime}
\label { fig:graph_ high_ linear_ regime_ full}
\end { figure}
2020-03-29 10:43:03 +00:00
\section { Code to Generate the Example Graphs}
2020-03-25 17:46:32 +00:00
\label { ref:code_ example_ graphs}
2020-04-06 16:32:33 +00:00
This code has been used to generate the example graphs in \ref { ref:performance}
and \ref { ref:complete_ graphs} . Note that generating the graph is done with
a random circuit as in \ref { ref:code_ benchmarks} . The generated \lstinline { dot}
2020-03-25 17:46:32 +00:00
code is converted to an image using
\lstinline { dot i_ regime.dot -Tpng -o i_ regime.png} .
\lstinputlisting [title={Code used to Generate the Example Graphs}, language=Python, breaklines=true] { ../performance/regimes/graph_ intermediate_ regime.py}
2020-03-29 10:43:03 +00:00
\section { Code to Benchmark \lstinline { ufunc} Gates against Python}
2020-03-26 20:35:30 +00:00
\label { ref:benchmark_ ufunc_ py}
2020-04-06 16:32:33 +00:00
It has been mentioned several times that the implementation with
\lstinline { ufuncs} as gates is faster than a pure \lstinline { python}
implementation. To support this statement a simple benchmark is written. The
relatively simple Pauli $ X $ gate us implemented, more complicated gates like $ CX $ or $ H $
have worse performance when written in \lstinline { python} . The performance
improvement when in this example is a factor around $ 6 . 4 $ .
One must note that the tested \lstinline { python} code is not
realistic and in a possible application there would be a significant overhead.
2020-03-26 20:35:30 +00:00
\lstinputlisting [title={Code to Benchmark \lstinline{ufunc} Gates against Python}, language=Python, breaklines=True] { extra_ benchmark/benchmark.py}
2020-03-26 21:40:41 +00:00
When using \lstinline { result_ py[0::2] = qm_ state[1::2]} the result is identical and
2020-04-06 16:32:33 +00:00
the performance is only increased by a factor around $ 1 . 7 $ . This method is not
2020-03-26 21:40:41 +00:00
applicable to general act-qbits and the bit mask has to be used.