next up previous contents index
Next: Restricted Groups Up: Distributed Array Sections Previous: Matrix multiplication with reduced   Contents   Index


Subranges

Let's take another look at the example of the array section in figure 4.2. We can capture this section in a named variable as follows

\begin{displaymath}
\begin{minipage}[t]{\linewidth}\small\begin{verbatim}floa...
... [[0 : N / 2 - 1, 0 : N - 1 : 2]] ;\end{verbatim}\end{minipage}\end{displaymath}

Now, what are the ranges of c--the objects returned by the rng() inquiry applied to c?

In fact they are a different sort of range from any considered so far--they are subranges. For completeness the HPJava language provides a special syntax for constructing subranges directly. Ranges equivalent to those of c can be created by

\begin{displaymath}
\begin{minipage}[t]{\linewidth}\small\begin{verbatim}Rang...
... ;
Range v = y [[0 : N - 1 : 2]] ;\end{verbatim}\end{minipage}\end{displaymath}

This syntax should look quite natural. It is modelled on the syntax for multiarray sections themselves.

The global indices associated with the subrange $v$, for example, are in the range $0, \ldots, v \mbox{\tt .size()}$. A subrange inherits locations from its parent range, but it specifically does not inherit global indices from the parent.

A non-trivial subrange is one for which the lower bound is not equal to zero, or the upper bound is not equal to ${\tt size()} - 1$, or the stride is not equal to 1.

A non-trivial subrange is never considered to have ghost extensions, even if its parent range does. This avoids various ambiguities that might otherwise crop up.

That covers the distributed ranges of sections. What about the distribution groups of sections? Now triplet subscripts don't cause problems--the distribution group of c above can be defined to be the same as the distribution group of the parent distributed array a. But the example of figure 4.1 is problematic. This was constructed using a scalar subscript, effectively as follows:

\begin{displaymath}
\begin{minipage}[t]{\linewidth}\small\begin{verbatim}floa...
... p ;float [[-]] b = a [[0, :]] ;\end{verbatim}\end{minipage}\end{displaymath}

The single range of b is clearly y, but identifying the distribution group of b with that of a doesn't seem to be right. If a one dimensional array is newly constructed with range y and distribution group p, like this:

\begin{displaymath}
\begin{minipage}[t]{\linewidth}\small\begin{verbatim}float [[-]] bnew = new float [[y]] on p ;\end{verbatim}\end{minipage}\end{displaymath}

it is understood to be replicated over the first dimension of p. The section b clearly isn't replicated in this way. Where does the information that b is localized to the top row of processes go?


next up previous contents index
Next: Restricted Groups Up: Distributed Array Sections Previous: Matrix multiplication with reduced   Contents   Index
Bryan Carpenter 2003-04-15