
\section{Performance Results}

Tables~\ref{tab:ser1dpar} and \ref{tab:ser1dgrid} show the completion time 
of one iteration
of the main phases of the 1-D serial PIC code for a varying number
 of particles 
and varying  number of grid points, respectively. 
We repeated the main phase 225 times for the 1-D code, and 325 times for the
2-D code. The loop iteration time in the tables show the total time for
a specified number of  iterations. 
As can be seen from Table~\ref{tab:ser1dpar}, when the number of particles 
changes 
but the number of grid points remains constant, 
the execution time of the $push$ and $migrate$ steps of the particle push
phase and first step of the scatter phase increase linearly. 
On the other hand, {\tt FFT(), Poisson()} and the {\tt copy()} routines of
the scatter and gather phases take the same time.
When we keep the number of particles the same but increase the number
of grid points, the routines 
(except for the {\tt FFT(), Poisson()} and {\tt copy()}  stay
still. The  execution times of those three routines increases linearly
(Table~\ref{tab:ser1dgrid}).

We illustrate the execution time changes with respect to  the varying
number of particles and grid points  of 2-D serial PIC codes in
Tables~\ref{tab:ser2dpar} and \ref{tab:ser2dgrid}, respectively. 
The behavior of the 
 2-D figures are similar to the 1-D figures. 

When we compare the execution times of the 1-D problem with 
32K grid points and $\approx$4M particles to the 2-D problem with
128$\times$256$=$32K grid points and $\approx$3.4M particles, we notice
that the push step and first step of the scatter phase in the 2-D case
take more time. This may seem to be an anomally, but we should
remember that in the 2-D case there are nine points that participate
in the interpolation, while there are only three points in the 1-D case.
The same reasoning is valid for the push module. 

From these four tables we can conclude that the performance of the main 
routines of the program is either dependent on the number of particles or 
on the number of grid points. 

Next, we investigate the behavior of the main routines in parallel 
environments using HPF. Table~\ref{tab:hpf1dspeed} shows the speedup
pattern of the 1-D HPF routines for a different number of processors.
One observation is that
increasing the number of processors decreases almost linearly
the execution times of all the routines  except the {\tt FFT()} and 
{\tt copy()}.
These two routines involve interprocessor communication, therefore
increasing the number of processors does not really help to improve
their execution time. In other routines the computation is all
local, we therefore use more processors to divide the work into 
more parallel pieces, thus reducing the overall time.
Table~\ref{tab:hpf2dspeed} presents a similar pattern for the 2-D codes.

As seen in Table~\ref{tab:hpf1dpart} (1-D) and
Table~\ref{tab:hpf2dpart} (2-D), 
when we keep the number of grid points
and the number of processors constant and change the number of particles 
the {\tt FFT(), Poisson()}, and {\tt copy()} routines' execution times 
increase linearly 
while the other routines are unaffected.
Tables~\ref{tab:hpf1dgrid} and \ref{tab:hpf2dgrid}
demonstrate the case where the number of particles and 
processors are kept the same, and the number of grid points are changed
for 1-D and 2-D cases, respectively.
%As can be noticed easily, the 1-D and 2-D HPF test cases show a similar
% behavior to their serial counterparts.

In order to judge the success of HPF codes as compared to their message 
passing equivalents, we repeated the same experiments using 
message-passing programs written in SP-2's native MPL libraries. 
The speedups of the 1-D and 2-D MPL PIC codes (Tables~\ref{tab:mpl1dspeed},
\ref{tab:mpl2dspeed}) are similar to the 
HPF versions of the same codes.
Other cases for the MPL versions are summarized in 
Tables~\ref{tab:mpl1dpart} and \ref{tab:mpl1dgrid} for 1-D codes,
and in Tables~\ref{tab:mpl2dpart} and ~\ref{tab:mpl2dgrid} for 2-D codes.
The results are approximately equal to the HPF test results, which
proves that the HPF compilers can approach  the performance of
message-passing programs for simulating PIC methods. 
