next up previous
Next: Distributed loops. Up: HPJava: Data Parallel Extensions Previous: The on construct and

Locations and the at construct.

Subscripting operations on distributed arrays are subject to a strict restriction. As already emphasized, the HPJava model is explicitly SPMD. An array access such as

  a [17, 23] = 13 ;

is legal, but only if the local process holds the element in question. The language provides further constructs to alleviate the inconvenience of this restriction.

The idea of a location is introduced. A location can be viewed as an abstract element, or ``slot'', of a distributed range (conversely, a range can be thought of as a set of locations). An individual location is described by an object of the class Location. Any location is mapped to a particular slice of a process grid. The syntax x[n] represents location n in range x. Locations are used to parametrize a new distributed control construct called the at construct. This is analogous to on, except that its body is executed only on processes that hold the specified location. Locations can also be used directly as array subscripts, in place on integers. The array access above can be safely written as:

  Location i = x [17], j = y [23] ;
  at(i)
    at(j)
      a [i, j] = 13 ;

Locations used as array subscripts must be elements of the corresponding ranges of the array.



Theresa Canzian
Mon Jul 27 22:18:44 EDT 1998