

\documentstyle[twocolumn]{article}

\setlength{\oddsidemargin}{-0.5in}
\setlength{\evensidemargin}{-0.5in}
\setlength{\topmargin}{-0.5in}
\setlength{\headheight}{0in}
\setlength{\headsep}{0in}
\setlength{\textwidth}{7.5in}
\setlength{\textheight}{9.8in}
\setlength{\parindent}{0in}
\setlength{\parskip}{0.1in}
\setlength{\columnseprule}{0.4pt}

\begin{document}

\bf
\hfill Name:  $\underline{ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }$
% \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
\rm
\bigskip
                                      
{\bf Directions:} Work on this sheet (both sides, if needed) only;
{\bf do not turn in any supplementary sheets of paper}.  
In order to get full credit, {\bf SHOW YOUR WORK.}

{\bf 1.}  (20) Write a MulSim function MinArr() which will find the minimum
value of an {\bf int} array in a parallel manner.  The function heading
will be

\begin{verbatim} 
int MinArr(int *A, int N) 
\end{verbatim}

with the arguments A and N being the array and array length,
respectively, and the return value being the minimum.  Your code must
be {\it completely general and self contained}, i.e. usable by any
MulSim program without modification.

{\bf Please write out your code on scratch paper first, then copy it
to your exam sheet, for maximum clarity and maximum credit.}

{\bf 2.} (20) Write a barrier function package for MPI.  It will apply
to all nodes, i.e. to MPI\_COMM\_WORLD.  The package will consist of two
functions with headings

\begin{verbatim}
NotMPIBarrInit(int TotBarrs)
\end{verbatim} 

\begin{verbatim}
NotMPIBarr(int BarrNum)
\end{verbatim}

The first function, to be called only by node 0, initializes the
indicated number of barriers.  The second function is the actual barrier
call.  You may call any of the MPI functions in our MPI sample program.

Keep your code as simple as possible (not necessarily as efficient as
possible); the aim here is to see what \underline{minimal} machinery
is needed.  

Give the contents of \#include file if your code sets up any special
data types or variables.  Your code must be {\it completely general and
self contained}, i.e. usable by any MPI program without modification.

{\bf Please write out your code on scratch paper first, then copy it
to your exam sheet, for maximum clarity and maximum credit.}

{\bf 3.}  (10) As mentioned in class, one of the advantages of the Linda
parallel processing environment is that nodes can join or leave the
computation at any time, without any ``announcement,'' request for
``permission'' and so on.  One of the implications of this is fault
tolerance:  If one node suddenly goes down, the system as a whole may
still be able to function.  But for the POSYBL implementation, this is
not the case; on the contrary, we cannot tolerate the loss of any node.
Explain carefully and fully.

{\bf 4.}  (10) Suppose our front end command line running the TupleDSM
example is

\begin{verbatim}
DSMFrontEnd MachineList prime 4 100 5 1
\end{verbatim}

At the time when all worker nodes have reached the {\bf while}
loop involving Debug, how many tuples are there in the tuple
space?  Give your answer both as a grand total and also as a sum
(``4 green tuples plus 15 round tuples plus 3 pizza tuples'').

{\bf 5.}  In addition to the traditional Linda operations in(), out()
and rd(), let us add zyx().  As an example (using the traditional Linda
syntax), the call

\begin{verbatim}
zyx("abc",? X,5,M); 
\end{verbatim}

would mean, ``Tuple Manager, please find a 3-component tuple whose first
component is a string and second and third components are integers.
Change (but do not remove from the tuple space) the tuple by adding 5
to the second component, and return the original value of the second
component in X.''  (Note that the 5, while part of the call, is not part
of the tuple, i.e. it is a 3-component tuple, not a 4-component tuple.)

\begin{itemize}

\item [(a)]  (5) Give the name of a similar operation (in a non-Linda
context) discussed in the notes.

\item [(b)] (10) Show how the same operation (in that particular example)
could be synthesized using in(), out() and/or rd().  Use POSYBL format.

\item [(c)]  (5) Since we could synthesize the operation anyway, what
would be the main advantage of adding a zyx() operation to the Linda
operation set?  Be very specific in your answer.

\end{itemize}

{\bf 6.}  Consider a 8-way $\Omega$ networks, in which each netword
node has 8 inputs and 8 outputs (instead of 2 of each).

\begin{itemize}

\item [(a)] (10) Fill in the blanks with numbers:  Say we have a 4096-node
system.  In the binary form of a PE's node i.d., number the bits as 0,
1, 2 and so on, starting from the most significant one, and number the
stages 0, 1, 2 and so on, with stage 0 being the first stage a message
hits after leaving a PE.  Then in stage 2 the routing out of that stage
of a message would be determined by bits \_\_\_\_\_\_\_\_\_ through
\_\_\_\_\_\_\_\_\_\_\_\_.

\item [(b)] (10) Fill in the blank with a fraction:  For the same
size system (number of PEs), an 8-way network would need only
\_\_\_\_\_\_\_\_\_\_\_ as many stages as a 2-way one.

\end{itemize}

\end{document}

