We will define the concept of a home group for every kind of variable that can occur in an HPspmd code in an HPJava program.
Suppose the distribution group of a distributed array is ,
and the list of subscripts
in the element reference
The home group for a local variable is simply the active process group at the point where the variable is declared.
The home group for an instance variable is the active process group in effect when the parent instance is created.
The home group for an element of a standard Java array is the active process group in effect when the array is created.
The home group for a static field can be taken to be the set of processes in which the program is initiated5.7.
Now, a good rule of thumb for updating variables in general is:
There are many places in HPJava programs where variables are required to be coherent. This is particularly true of arguments to collective operations. There are other places where it can be convenient to relax the coherence rule, which is one reason why it is only advisory (another reason is that it is probably relatively expensive to enforce this rule by runtime checks).
We call the style of programming in which all variables are held coherent the canonical HPspmd style. Out of the examples given so far in this document, the only one that doesn't follow canonical style is the Monte Carlo program of Figure 3.13. In that program the variable rand has home group p, but it is updated inside nested overall constructs, where the active process group is . Also, the initialization of rand involves a dependency on the crd() method of Dimension, which is intrinsically incoherent. All other variables in all other algorithmic examples are coherent5.9. The canonical HPspmd style has a close affinity with the pure data parallel programming style of languages like HPF.