

\documentstyle[twocolumn]{article}

\setlength{\oddsidemargin}{0in}
\setlength{\evensidemargin}{0in}
\setlength{\topmargin}{-0.3in}
\setlength{\headheight}{0in}
\setlength{\headsep}{0in}
\setlength{\textwidth}{6.5in}
\setlength{\textheight}{9.8in}
\setlength{\parindent}{0in}

\begin{document}

\parskip 0.1in

\bf
\hfill Name:  $\underline{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \  \ \ \ \
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }$
\rm                         

{\bf Directions:} Work on this sheet (both sides, if needed) only;
{\bf do not turn in any supplementary sheets of paper}.  There is 
actually plenty of room for your answers, as long as you organize 
yourself BEFORE starting writing.  In order to get full credit, 
{\large\bf WRITE LEGIBLY} ($\infty$ points off for illegible 
handwriting!), and {\large\bf SHOW YOUR WORK}.  Make sure you work on 
the easier problems first (which will usually be the earlier problems, 
and within multi-part problems, the earlier parts).         

{\bf 1.}  This problem concerns Hyperquicksort.

\begin{itemize}
\item [(a)]  (20)  Consider an 8-node cube.  How many messages will
be passed altogether for the purpose sending medians?  (Note:  If
the same information traverses several links, that counts as several
messages.)

\item [(b)]  (20)  Now consider a 4-node cube instead.  Suppose the
initial array is in \underline{descending} order, exactly the
opposite of what we want.  Altogether, for a k-element array
how many element-transfers will take place during the sort?  
(Each time one array element is moved across a link that counts
as one element-transfer.  If two elements are moved across the
link, that is two element-transfers, and so on.)

\item [(c)]  (20)  Suppose we were to implement Hyperquicksort on
a set of $2 ^ m$ processors on an Ethernet, say using PVM, for
some m.  We would still assign numbers to the processors, in
order to set up partners, though of course there would be no
dedicated links between them.  Argue either for or against 
(choose one) staggering the pvm\_send() calls (called {\it programmed 
backoff} in the Davies paper).
\end{itemize}

{\bf 2.}  (40)  Write a program (a single source file) to run on an
8-mode subcube of the iPSC hypercube, which will implement the Sieve 
of Erathosthenes method of finding prime numbers.  Your program
\underline{must} comply with the following specifications:  The
program will declare an array of the first 8 primes:

\begin{verbatim}
int Prime8[8] = {2,3,5,7,11,13,17,19};
\end{verbatim}

CPU 0 will ``cross out every second integer,'' sending to CPU 1
the numbers 21, 23, 25, ..., 361.  CPU 1 will ``cross out every
third integer,'' passing to CPU 2 the numbers 23, 25, 29, 31, 35, 
..., 361.  CPU 3 will ``cross out every fifth integer,'' and so
on.  The output will be done by CPU 7, and will consist only of a 
count of the number of primes between 20 and $361 = 19 ^ 2$.


\end{document}

