next up previous contents
Next: Reductions Up: Collective Communications Previous: Collective Communications   Contents

Regular Collective Communications

We already described two characteristic example of the regular communications, remap() and writeHalo(), in depth. In this section we describe other regular collective communications.

The method shift() is a communication schedule for shifting the elements of a distributed array along one of its dimensions, placing the result in another array. In general we have the signatures:

$\displaystyle \begin{minipage}[t]{\linewidth}\small\begin{tabbing}
\verb$ void ...
...$\verb$ [[-]] source,$ \\
\verb$ int shiftAmount)$
\end{tabbing}\end{minipage}$

and

$\displaystyle \begin{minipage}[t]{\linewidth}\small\begin{tabbing}
\verb$ void ...
...ource,$ \\
\verb$ int shiftAmount, int dimension)$
\end{tabbing}\end{minipage}$

where the variable $ T$ runs over all primitive types and Object, and the notation $ T$ # means a multiarray of arbitrary rank, with elements of type $ T$. The first form applies only for one dimensional multiarrays. The second form applies to multiarrays of any rank. The shiftAmount argument, which may be negative, specifies the amount and direction of the shift. In the second form the dimension argument is in the range $ 0, \ldots, R - 1$ where $ R$ is the rank of the arrays: it selects the array dimension in which the shift occurs. The source and destination arrays must have the same shape, and they must also be identically aligned. By design, shift() implements a simpler pattern of communication than general remap(). The alignment relation allows for a more efficient implementation. The library incorporates runtime checks on alignment relations between arguments, where these are required.

The shift() operation does not copy values from source that would go past the edge of destination, and at the other extreme of the range elements of destination that are not targetted by elements from source are unchanged from their input value. The related operation cshift() is essentially identical to shift() except that it implements a circular shift, rather than an ``edge-off'' shift.

Finally we mention the function broadcast(), which is actually a simplified form of remap(). There are two signatures:

$\displaystyle \begin{minipage}[t]{\linewidth}\small\begin{tabbing}
\verb$ $$T$\verb$ broadcast($$T$\verb$ [[]] source)$
\end{tabbing}\end{minipage}$

and

$\displaystyle \begin{minipage}[t]{\linewidth}\small\begin{tabbing}
\verb$ $$T$\verb$ broadcast($$T$\verb$ source, Group root)$
\end{tabbing}\end{minipage}$

The first form takes rank-0 distributed array as argument and broadcasts the element value to all processes of the active process group. Typically it is used with a scalar section to broadcast an element of a general array to all members of the active process group, as here:

$\displaystyle \begin{minipage}[t]{\linewidth}\small\begin{verbatim}
int [[-,-]]...
..., y]] ;
int n = 3 + Adlib.broadcast(a [[10, 10]]) ;\end{verbatim}\end{minipage}$

The second form of broadcast() just takes an ordinary Java value as the source. This value should be defined on the process or group of processes identified by root. It is broadcast to all members of the active process group.


next up previous contents
Next: Reductions Up: Collective Communications Previous: Collective Communications   Contents
Bryan Carpenter 2004-06-09