Next: Parallel Programming and Locations
Up: The HPJava Language
Previous: Processes
Contents
Distributed Arrays
One of the most important feature HPJava adds to Java is the
distributed array. A distributed array is a generalized kind of
multiarray, a collective array shared by a number of processes. Like
an ordinary multiarray, a distributed array has a rectangular,
multidimensional index space, and stores a collection of
elements of fixed type. Unlike an ordinary array, associates elements
are distributed over the processes that share the array.
The type signatures and constructors of distributed arrays are similar
to those of sequential multiarrays (see the section
3.4.1). But the distribution
of the index space is parameterized by a special class, Range
or its subclasses. In the following HPJava program we create a
two-dimensional, N

N, array
of floating points distributed over the grid p. The
distribution of the array, a, for N = 8 is illustrated
in Figure 3.4.
Figure 3.4:
A two-dimensional array
distributed over p.
|
|
The subclass BlockRange for index range of the
array allows the index space of each array dimension to be divided
into consecutive blocks. Ranges of a single array should be
distributed over distinct dimensions of the same process grid.
The type signature of a multiarray is generally represented as
where
is the rank of the array and each term
attr
is either a single hyphen, -, for a distributed dimension or a
single asterisk, *, for a sequential dimension,
the term
bras is a string of zero or more bracket pairs,
[]. In principle,
can be any Java type other than an
array type. This signature represents the type of a multiarray
whose elements have Java type
bras
If `bras' is non-empty, the elements of the multiarray are (standard
Java) arrays.
Next: Parallel Programming and Locations
Up: The HPJava Language
Previous: Processes
Contents
Bryan Carpenter
2004-06-09