\section{Numerical examples}
\label{sec:exp}

The presented algorithm has been prototyped and numerical experiments
have been carried out on a server which has an Intel Xeon quad-core
CPU with 2.0~GHz clock speed, and 24~GBytes memory. The GPU card
mounted on this server is NVIDIA's Tesla~C2070 (Fermi), which contains
448 cores (14 MPs $\times$ 32 cores per MP) running at a 1.30~GHz and
has 4~GBytes on-chip memory. Some initial results have been published
in~\cite{LiuTan1:DATE'12}.

The envelope-following method with the proposed Gear-2
sensitivity matrix computation is added to an open-source
SPICE\index{SPICE}, implemented in C~\cite{ngspice}.
Our envelope-following program is implemented by following
the algorithm mentioned in~\cite{Kato:COMPEL'06}.
To solve the Newton update equation,
different methods are used to compare the computation time,
such as direct LU, GMRES with explicitly formed matrix,
and GMRES with implicit matrix-vector multiplication (matrix-free).
Moreover, the matrix-free method is also incorporated to the same SPICE
simulator using CUDA C programming interface, as described in
Section~\ref{sec:gpu}.

\begin{figure}
  \centering
  \resizebox{.8\textwidth}{!}{\input{./Chapters/chapter16/figures/resonant_flyback.pdf_t}}
  \caption{Diagram of a zero-voltage quasi-resonant flyback converter.}
  \label{fig:flyback}
\end{figure}


\begin{figure}%[hbfp]
  \centering
  \resizebox{.6\textwidth}{!}{\input{./Chapters/chapter16/figures/pgMesh.pdf_t}}
  \caption{Illustration of power/ground network model.}
  \label{fig:pg}
\end{figure}

\begin{figure}
\centering
\subfigure[The whole plot]{
  \includegraphics[width=.6\textwidth]{./Chapters/chapter16/figures/flyback_wave_emb.eps}
  \label{fig:flybackWhole}
}
\subfigure[Detail of one EF simulation period]{
  \includegraphics[width=.6\textwidth]{./Chapters/chapter16/figures/flyback_zoomin_emb.eps}
  \label{fig:flybackZoom}
}
\caption{Flyback converter solution calculated by envelope-following.
The red curve is traditional SPICE simulation result, and
the back curve is the envelope-following output with simulation points
marked.}
\label{fig:flyback_wave}
\end{figure}


\begin{figure}%[hbfp]
  \centering
  \includegraphics[width=.6\textwidth]{./Chapters/chapter16/figures/buck_wave_emb.eps}
  \caption{Buck converter solution calculated by envelope-following.}
  \label{fig:buck_wave}
\end{figure}

We use several integrated on-chip converters as simulation examples
to measure running time and speedup. They include a Buck converter,
a quasi-resonant flyback converter (shown in Fig.~\ref{fig:flyback}),
and two boost converters.
Each converter is directly integrated with on-chip power grid networks,
since the performance of converters should be studied with their loads and
we can easily observe the waveforms at different nodes in a power
grid (see Fig.~\ref{fig:pg} for a simplified power grid structure).

Fig.~\ref{fig:flyback_wave}
and Fig.~\ref{fig:buck_wave}
shows the waveform at output node of the resonant flyback converter
and the Buck converter.
Note that on the envelope curve, the darker
dots in separated segments indicate the real simulation points were
calculated in those cycles, and the segments without dots are the
envelope jumps where no simulation were done.
It can be verified that the proposed Gear-2 envelope-following method
produces a envelope matching the original waveform well.

\begin{table}
\centering
\caption{CPU and GPU time comparisons (in seconds) for solving Newton update equation
  with the proposed Gear-2 sensitivity.
}
\vspace{0.1in}
\label{table:circuit}
{%\normalsize
\begin{tabular}{@{}c|c|c|c|c|c|c@{}}
\hline\hline
Circuit & Nodes & Direct & Explicit & \multicolumn{3}{c}{Implicit GMRES}\\ \cline{5-7}
         &       & LU   & GMRES     & CPU  & GPU & X \\
\hline
Buck       &  910   & 423.8  & 420.3 &  36.8  &  3.9 & 9.4$\times$  \\
Flyback    &  941   & 462.4  & 459.6 &  64.5  &  7.4 & 8.7$\times$  \\
Boost-1    &  976   & 695.1  & 687.7 &  73.2  &  6.2 & 11.8$\times$ \\
Boost-2    & 1093   & 729.5  & 720.8 &  71.0  &  8.5 & 9.9$\times$ \\
\hline\hline
\end{tabular}
}
\end{table}

For the comparison  of running time spent in solving
Newton update equation, Table~\ref{table:circuit} lists the time
costed by direct method, explicit GMRES, matrix-free GMRES,
and GPU matrix-free GMRES. All methods carry out the Gear-2 based
envelope-following method, but they handle the sensitivity and
equation solving in different implementation steps.
It is obvious that as long as the sensitivity matrix is explicitly formed,
such as the cases in direct method and explicitly GMRES,
the cost is much higher than the implicit methods.
When matrix-free technique is applied to generate matrix-vector
products implicitly, the computation cost is greatly reduced.
Thus, for the same example, implicit GMRES would be one order
of magnitude faster than explicit GMRES. Furthermore, our GPU parallel
implementation of implicit GMRES makes this method even faster,
with a further 10$\times$ speedup.
