A basic principle of the HPspmd model is that a program can only directly reference locally held variables. Therefore we want to define the conditions under which it is legal to access a particular variable (most especially, a particular array element) at a particular point in a program.
In a distributed array element reference, as explained in section 2, a subscript in a distributed dimension of an array must be a bound location, and this location must be a location in the appropriate range of the array4. Hence
The rules just stated go a long way towards ensuring that only local elements are accessed, but they don't cover all cases. Consider the example of Figure 6. The subscripts on the element reference c[j] are legal--j is a location in c.rng(0) (which is equal to y). But, referring to Figure 5, the section c is localized to p/x--the top row of processes in the figure--whereas the on construct specifies that the element assignments are performed in the group p/x--the bottom row of processes.
Before we can give a general rule about accesses to elements of distributed arrays we need to refine the concept of the active process group. Suppose the set of processes currently executing the program text is represented by the group , and the construct
appears. For the body, , the active process group is changed to . The group must represent a subset of the processes in . Similarly, suppose the current active process group is , and the construct
appears. For the active process group is changed to . Unless is a collapsed range, the process dimension over which it is distributed must be a dimension of .
Applied recursively these rules define the active process group at any point in a legal HPJava program.
Next we will define the home group of a program variable. The home group of an ordinary variable (not a distributed array element) is the group that was active at the point of declaration of the variable. For a distributed array element the rule is similar to the definition of distribution groups of section: suppose the subscripts in the reference
include locations , then the home group of the array element is5
(if the array has a replicated distribution this group may contain several processes; otherwise it contains a single process).
An HPspmd rule for accessing a variable can be stated as follows: