next up previous contents index
Next: Distributed array creation without Up: Translating multiarray creation Previous: Translating multiarray creation   Contents   Index

Creating distributed arrays

The scheme for distributed array creation with an on clause is given in Figure A.24.

If the expression $e_r$ is a range the macro DEFINE_DIMENSION is defined as follows:

\begin{displaymath}
\begin{minipage}[t]{\linewidth}\begin{tabbing}
$\mbox{\it DE...
...verb$.remove($$e_r$\verb$.dim()) ;$
\end{tabbing}\end{minipage}\end{displaymath}

As each dimension is processed, the memory stride for the next dimension is computed by multiplying the variable $s$ by the number of locally held range elements in the current dimension. The variable $b$ is incremented to allow space for lower ghost regions, below the base of the physical array, if this is required for the ranges involved.

If the expression $e_r$ is an integer then $\mbox{\it DEFINE\_DIMENSION}\left(a'_r, e_r, s, b, t\right)$ is evaluated the same as $\mbox{\it DEFINE\_DIMENSION}\left(a'_r, e_r, s\right)$ in the previous subsection.

The call to checkContained() throws a GroupNotContainedException runtime exception if $p$ is not contained in the current APG. The variable $t$ is also introduced for run-time checking of correct usage. The calls to remove() will throw a DimensionNotInGroupException runtime exception if any range specified for the array is not distributed over a dimension in $p$, or if any two specified ranges are distributed over the same dimension.

The method arrayDim() on the Range class creates an instance of ArrayDim, with the memory stride specified in its argument. It is used in place of a call to the ArrayDim constructor because arrayDim() has the property that if the range is actually a collapsed range, the returned object will be an instance of the SeqArrayDim subclass. This allows a new array created with a collapsed range to be cast to an array with a sequential dimension, should it prove necessary at a later stage (see section A.4.21).

Figure A.25: Translation of multiarray creation expression without the on clause.
SOURCE:

\begin{displaymath}
\begin{minipage}[t]{\linewidth}\begin{tabbing}
$a$ \verb$ =...
...verb$]] $$\mbox{\it bras}$\verb$ ;$
\end{tabbing}\end{minipage}\end{displaymath}

TRANSLATION:


\begin{displaymath}
\begin{minipage}[t]{\linewidth}\begin{tabbing}
\verb$int $$s...
...\it apg}$\verb$, $$b$\verb$) ;$ \\
\end{tabbing}\end{minipage}\end{displaymath}

where:

\begin{displaymath}
\begin{array}{l}
\mbox{$T$ is a Java type,} \\
\mbox{$R$ ...
...ro {\it DEFINE\_DIMENSION} is defined in the text.}
\end{array}\end{displaymath}


next up previous contents index
Next: Distributed array creation without Up: Translating multiarray creation Previous: Translating multiarray creation   Contents   Index
Bryan Carpenter 2003-04-15