next up previous contents index
Next: Translating other statement expressions Up: Basic translation Previous: Translating constructor invocations   Contents   Index


Translating distributed array restriction

The scheme is illustrated in Figure A.35. The basic operation is simple. Most of the complications come from the run-time checks need to ensure one doesn't produce an illegally distributed result.

If $e_{\mbox{\small loc}}$ is a range element of the form $e_{\mbox{\small rng}}\verb$[$n\verb$]$$, the macros RESTRICT_DIST_GROUP and CHECK_DIMENSION are defined as

\begin{displaymath}
\begin{minipage}[t]{\linewidth}\begin{tabbing}
$\mbox{\it RE...
...rb$.checkRestriction($$d$\verb$) ;$
\end{tabbing}\end{minipage}\end{displaymath}

where $e_{\mbox{\small rng}}' = {\bf T}^V_{s}\left[{e_{\mbox{\small rng}}}\right]$, and $n' = {\bf T}\left[{n}\right]$, and $d$ is the name of a new temporary. Otherwise, if $e_{\mbox{\small loc}}$ is a distributed index $i$ or a shifted index $i \pm d$, they are defined as

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

where in this case $\mbox{\it dim}$ is the dimension associated with $i$.

The restrict() calls may throw a DimensionNotInGroupException runtime exception if the location belongs to a range whose process dimension is not in $a$.grp(). Similarly, one of the calls to checkRestriction() will throw a DimensionNotInGroupException if any of the original array ranges is distributed over this process dimension--the restriction is supposed to occur in a dimension over which the array is replicated.

If the array $a$ is a sequential array that was created in non-HPspmd code, $p$ will be null and a NullPointerException will be thrown.

Figure A.36: Translation of other statement expressions.

SOURCE:

\begin{displaymath}
\begin{minipage}[t]{\linewidth}\begin{tabbing}
$e$\verb$ ;$
\end{tabbing}\end{minipage}\end{displaymath}

TRANSLATION:


\begin{displaymath}
\begin{minipage}[t]{\linewidth}\begin{tabbing}
${\bf T}_{\mb...
...{R-1}\left[{e}\right]$\verb$ ;$ \\
\end{tabbing}\end{minipage}\end{displaymath}

where:

\begin{displaymath}
\begin{array}{l}
\mbox{$e$ is a multiarray-valued expression in the source program.} \\
\end{array}\end{displaymath}


next up previous contents index
Next: Translating other statement expressions Up: Basic translation Previous: Translating constructor invocations   Contents   Index
Bryan Carpenter 2003-04-15