next up previous contents index
Next: Rank-0 Distributed Arrays Up: Distributed Array Sections Previous: Restricted Groups   Contents   Index

Mapping of distributed array sections

Collecting things together we can give a formal definition of the mapping (distribution group and ranges) of a general array section.

If the $r$th dimension of array $a$ is non-sequential, an integer section subscript, $n$, in this dimension behaves like a location-valued subscript, $a \mbox{\tt .rng(} r \mbox{\tt )[} n \mbox{\tt ]}$. Suppose any such integer subscripts are replaced by their equivalent location subscripts in this way. If the set of all location subscripts is now $i,
j, \ldots$, the distribution group of the section is

\begin{displaymath}
p / i / j / \ldots
\end{displaymath}

where $p$ is the distribution group of the parent array. For a shifted index, as a matter of definition,

\begin{displaymath}
\begin{minipage}[t]{\linewidth}\small\begin{tabbing}
\verb$ ...
...$ ${\em expression}\verb$) = p / i$
\end{tabbing}\end{minipage}\end{displaymath}

This makes sense--a shifted index is supposed to find an array element in the same process as the original location, albeit that the element could be in a ghost region.

The $k$th range of the section is determined by the $k$th triplet-valued subscript. If the $k$th triplet-valued subscript is $l \mbox{\tt :} u \mbox{\tt :} s$ in dimension $r$, the $k$th range of the section is $a \mbox{\tt .rng(} r \mbox{\tt )[} l \mbox{\tt :} u \mbox{\tt :} s \mbox{\tt ]}$.

Because, as noted in section 4.4 non-trivial subranges are never considered to have ghost extensions, a section constructed with non-trivial triplet subscripts in some dimensions is not be considered to have accessible ghost extensions in those dimensions, even if its parent array did.

It shouldn't come as a surprise that subranges and restricted groups can be used in array constructors, on the same footing as the ranges and groups described in earlier sections. This means that temporary arrays can be constructed with identical mapping to any given section. This facility is useful when writing generic library functions, like the matmul() of Figure 3.18, which must accept complete distributed arrays or distributed array sections without discrimination4.2.

In the last three sections we introduced some new pieces of syntax but did not give any full example programs that use them. The reason is that restricted groups and subranges largely exist ``below the surface'' in HPJava. The new notations are mainly needed to add a kind of closure to the language. In our experience it is fairly uncommon to see subgroups or subranges used explicitly in HPJava programs.


next up previous contents index
Next: Rank-0 Distributed Arrays Up: Distributed Array Sections Previous: Restricted Groups   Contents   Index
Bryan Carpenter 2003-04-15