next up previous contents index
Next: Two-dimensional Fourier transform Up: Parallel Programming in HPJava Previous: Distribution Groups and Replication   Contents   Index


Distributed Array Sections

In Chapter 1 we introduced the HPJava syntax for forming sections of multiarrays. This syntax carries over with very few changes to distributed arrays.

We have seen that the subscripts in a distributed array element reference are generally either index symbols or (restrictedly) integer expressions. Options for subscripts in distributed array section expressions are wider. As for multiarrays, a section subscript is allowed be a triplet. The section may also have some scalar subscripts, similar to those appearing in element references.

This fragment includes two examples of distributed array section expressions:

\begin{displaymath}
\begin{minipage}[t]{\linewidth}\small\begin{verbatim}Proc...
... : N / 2 - 1, 0 : N - 1 : 2]]) ;
}\end{verbatim}\end{minipage}\end{displaymath}

The first array section expression appears on the right hand side of the definition of b. It specifies b as an alias for the first row of a (Figure 4.1). In an array section expression, unlike in an array element reference, a scalar subscript is always allowed to be an integer expression4.1. The second array section expression appears as an argument to the method foo. It represents a two-dimensional, $N/2$ by $N/2$, subset of the elements of a, visualized in Figure 4.2.

Figure 4.1: A one-dimensional section of a two-dimensional array (shaded area).
\includegraphics{section1.eps}

Figure 4.2: A two-dimensional section of a two-dimensional array (shaded area).
\includegraphics{section2.eps}

Distributed array sections allow us to implement a number of interesting applications. They are often passed as arguments to library functions like remap, implementing various interesting patterns of communication and arithmetic on subarrays.



Subsections
next up previous contents index
Next: Two-dimensional Fourier transform Up: Parallel Programming in HPJava Previous: Distribution Groups and Replication   Contents   Index
Bryan Carpenter 2003-04-15