next up previous contents index
Next: Distributed Array Restriction Up: Distributed Array Sections Previous: Mapping of distributed array   Contents   Index

Rank-0 Distributed Arrays

There is no restriction that the list of subscripts in an array section expression must include some triplets. It is legitimate for all the subscript to be ``scalar''. In this case the resulting distributed array has rank 0.

There is nothing pathological about rank-0 arrays. They logically maintain a single element, bundled with the distribution group over which this element is replicated. Because they are logically distributed arrays they can be passed as arguments to Adlib functions such as remap(). If a and b are distributed arrays, we cannot usually write a statement like

\begin{displaymath}
\begin{minipage}[t]{\linewidth}\small\begin{verbatim}a [10, 10] = b [30] ;\end{verbatim}\end{minipage}\end{displaymath}

because the elements involved are generally held on different processors. As we have seen, HPJava imposes constraints that forbid this kind of direct assignment between array element references. However, if it is really needed, we can usually achieve the same effect by writing

\begin{displaymath}
\begin{minipage}[t]{\linewidth}\small\begin{verbatim}Adlib.remap(a [[10, 10]], b [[30]]);\end{verbatim}\end{minipage}\end{displaymath}

The arguments are rank-0 sections holding just the destination and source elements.

There is a natural syntax for creating the new kind of object directly. Rank-0 distributed arrays (which we sometimes simply call ``scalars''), can be created as in this example:

\begin{displaymath}
\begin{minipage}[t]{\linewidth}\small\begin{verbatim}floa...
... a [[10, 10]]) ;float d = c [] ;\end{verbatim}\end{minipage}\end{displaymath}

This example illustrates one way to broadcast an element of a distributed array: remap it to a scalar replicated over the active process group. The element of the scalar is extracted through a distributed array element reference with an empty subscript list. Like any other distributed array, rank-0 distributed array creation expressions can have on clauses, specifying a non-default distribution group.


next up previous contents index
Next: Distributed Array Restriction Up: Distributed Array Sections Previous: Mapping of distributed array   Contents   Index
Bryan Carpenter 2003-04-15