next up previous
Next: Discussion Up: Semantic Checking in HPJava Previous: Compiling usage checks

Other Usage Rules

In this section we mention two usage guidelines which have some relationship to the usage rules of the previous sections, but which are not required to make a legal HPJava program, and are not checked by the translator.

The first relates to a coherence property of variables. Informally, we will call a variable coherent if, at corresponding stages of execution of an SPMD program, processes belonging to the variable's home group always hold identical values in their local copies of the variable. If the home group of a variable is a single process, the variable is trivially coherent.

Giving a precise formal definition of coherence is quite difficult, because it is difficult to define formally what is meant by ``corresponding stages of execution''. What we can give is a precise rule which will keep all variables in a program coherent. This rule, which looks similar to usage Rule 3, is

Rule 5   A variable should only be updated when the active process group is identical to the home group of the variable.

Assuming that any external method calls also respect the coherence property10 we assert that if this rule is applied throughout a program it will ensure all variable stay coherent. An HPspmd translater does not try to enforce this rule because the associated checks can be very expensive, and because judicious use of incoherence is often convenient.

It is often required that scalar arguments of collective operations should be coherent. There is another common requirement for arguments of collective operations--namely that all copies of all elements of distributed array arguments should be held in the group of processes that collectively invoke the operation. We will say that a distributed array $a$ is fully contained (in the active process group) if $a\mbox{\tt .grp()} \subseteq \mbox{\tt apg}$. Therefore a natural requirement is

Rule 6   All distributed array arguments of collective operations should be fully contained.

This rule is not required for all non-local operations. For example it is not required for get and put operations that implement one-sided communication. So it is not appropriate for the translator to try to enforce this rule. Instead checks such as
    ASSERT(apg.contains(a.grp())) ;
should appear inside the implementation of collective library functions, as required.

next up previous
Next: Discussion Up: Semantic Checking in HPJava Previous: Compiling usage checks
Bryan Carpenter 2002-07-11