
\documentclass[twocolumn]{article}

\setlength{\oddsidemargin}{-0.5in}
\setlength{\evensidemargin}{-0.5in}
\setlength{\topmargin}{0.0in}
\setlength{\headheight}{0in}
\setlength{\headsep}{0in}
\setlength{\textwidth}{7.0in}
\setlength{\textheight}{9.5in}
\setlength{\parindent}{0in}
\setlength{\parskip}{0.05in}
\setlength{\columnseprule}{0.3pt}
\usepackage{fancyvrb}
\usepackage{relsize}
\usepackage{hyperref}

\begin{document}

Name: \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_

Directions: {\bf Work only on this sheet} (on both sides, if needed); 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.

{\bf 1.} (25) Name the OpenMP functions analogous to {\bf
MPI\_Comm\_size()} and {\bf MPI\_Comm\_rank()}.

{\bf 2.} (25) Suppose OpenMP did not include the {\bf single} pragma.
Rewrite lines 91-92, p.51, without using that pragma.  Keep it short!
It just has to work, not necessarily be optimal.

{\bf 3.} (25) (Canceled.)

{\bf 4.} (25) Suppose we have the system on p.23, with low-order
interleaving, and we have a long array {\bf x}.  Say it takes one clock
cycle to move a message one hop in the network, e.g. from one diamond to
the one above it, and messages to access {\bf x[i]} and {\bf x[j]} leave
P2 and P1 at times 0 and 1, respectively.  Then give a mathematical
necessary and sufficient condition for there to be a ``collision''
between the two messages, i.e.  one will delay the other at some
diamond.  Express your answer in \underline{math}, not English.  Any
math symbol can be used, including ones made from letters such as {\tt
cos}. 

{\bf Solutions:}

{\bf 1.} 

\begin{Verbatim}[fontsize=\relsize{-2}]
omp_get_num_threads()
omp_get_thread_num()
\end{Verbatim}

{\bf 2.}

\begin{Verbatim}[fontsize=\relsize{-2}]
if (me == 0) { md = largeint; mv = 0; }
#pragma omp barrier
\end{Verbatim}

{\bf 4.} $(\textrm{i mod 8)} \leq (\textrm{j mod 8)}$

\end{document}

