next up previous contents index
Next: Creating distributed arrays Up: Basic translation Previous: Translating assignment expressions   Contents   Index


Translating multiarray creation

The pre-translator ensures that multiarray creation only appears on the right-hand-side of a top-level assignment, so we only need to consider that case. The scheme for the translation in non-HPspmd code is illustrated in Figure A.23.

In this case we must be creating a sequential multiarray and all extent expressions must be integers. The macro DEFINE_DIMENSION is defined as follows:

\begin{displaymath}
\begin{minipage}[t]{\linewidth}\begin{tabbing}
$\mbox{\it DE...
...verb$ $$s$\verb$ *= $$e_r$\verb$ ;$
\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 extent of the current dimension. The final value of $s$ is the total number of locally held elements.

Figure A.24: Translation of multiarray creation with on clause.
SOURCE:

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

TRANSLATION:


\begin{displaymath}
\begin{minipage}[t]{\linewidth}\begin{tabbing}
\verb$int $$s...
...Base($$p$\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}



Subsections
next up previous contents index
Next: Creating distributed arrays Up: Basic translation Previous: Translating assignment expressions   Contents   Index
Bryan Carpenter 2003-04-15