%$Id: case-studies.tex,v 1.8 1997/07/30 19:50:02 cierniak Exp $

\section{CASE STUDY}

The 107.mgrid program is part of the SPEC CPU95 (floating point)
benchmark. It is a multi-grid solver in a 3D potential field. Its
reference dataset is quite large but the program itself is just 500
lines of FORTRAN~77 code. It is also one of the easiest to parallelize
by an automatic parallelizer.

We use it as a case study to illustrate:
\begin{itemize}
\item Annotating the application source with runtime performance
  information on maintaining correlation between application source
  and compiler transformed source.
\item Automatic parallelization information. This also includes array
  region information when the parallelizer cannot parallelize the
  loop.
\item Combining runtime performance information with compiler
  information.
\end{itemize}

Figure \ref{mgrid:one} shows a snapshot of jCITE when the mgrid
program is loaded and the programmer asks to see the number of cycles
(the histogram labeled {\tt cy\_hwc}) each line of mgrid has consumed.
The cycles are measured using program counter sampling whenever the
R10000 processor's internal cycle measurement counter overflows. The
programmer can also ask jCITE to hypertext/annotate all the loops that
were parallelized or were not parallelized. Notice how the scrollbars
are also painted to show the program hot-spots.

\begin{figure}[htbp]
\centerline{\psfig{figure=EPS/paper-mgrid1.eps,width=5.0in}}
\caption{Annotated performance information.}
\label{mgrid:one}
\end{figure}

The left window is the original source annotated with cycle counts
from the R10000 hardware counters and parallelization information. A
histogram view of the per line cycle counts is overlayed on top of the
source window. Navigating the histogram navigates the source and
transformed source. The snapshot was taking with the mouse over the
line with the largest number of processor cycles (43.4 \% of all
cycles).  This corresponds to the 3D array assignment in the
subroutine {\tt resid}.

For the loop nest presented in the figure, the compiler has
parallelized the outermost loop and so has partitioned the {\tt I2}
loop amongst all the processors. The figure also shows that the
compiler has removed a number of array references out of the loop.
This snapshot is from a pre-release version of the automatic
parallelizer.

jCITE's architecture is illustrated in Figure \ref{black:box}. jCITE
takes several inputs---the original source, the transformed source,
assembly, compiler information file, and performance experiment data
files if any.  Its output is a visual representation showing how all
its inputs relate to one another.  At present jCITE works for
Fortran~77 and C.

\begin{figure}[!htbp]
\centerline{\psfig{figure=EPS/paper-arch1.eps,width=5.0in}}
\caption{Black Box Architecture of jCITE}
\label{black:box}
\end{figure}

