next up previous
Next: Class libraries or syntax Up: Introduction to Java-Ad Previous: Subranges


Subgroups

A subgroup is some slice of a process array, formed by restricting the process coordinates in one or more dimensions to single values. Process arrays (class Procs) and subgroups have a common base class, Group. In general the argument of an on construct and the on clause in an array constructor is a member of Group. This implies that the active process group or the group over which an array is distributed may be just some a slice of a complete process array.

By definition, any group has a parent process array and a dimension set. In general the dimension set is some subset of the dimensions of the parent array. The restriction operation on a group takes a slice in a particular dimension. It is quite natural and convenient to express this restriction procedure is in terms of a location. If i is a location in a range distributed over a dimension of p, then

  p / i
represents a subgroup of p--the slice of p to which location i is mapped.

Using the / operator on groups explicitly is fairly unusual practise. But subgroups are occur naturally in two ways:

To illustrate how subgroups can be used--in particular how the effect of over on the active process group can be exploited--we return to the matrix multiplication example of figure 1. As a preliminary step, figure 9 is transcribes that program using the distributed control constructs developed over the last few sections. The changes are very minor. Because the active process group is formally changed to p, the on p clauses can be omitted from the array constructors. Use of the crd inquiry to obtain the integer subscript in the x range is replaced by use of an over construct. Now we want to change from distribution over a one-dimensional process array to a two-dimensional grid.

Figure 9: Matrix multiplication program using distributed control constructs.
\begin{figure}\small\begin{verbatim}Procs1 p = new Procs1(P) ;
on(p) {
Rang...
..., 1, 0, CYCL) ;
Adlib.copy(b, tmp) ;
}
}\end{verbatim}\normalsize\end{figure}

The result is given in figure 10. Inside the over(ip) construct there are P independent active process groups corresponding to the rows of the original grid. The temporary array tmp is replicated over these rows. The remap operation, working independently in the P separate groups, implements a broadcast of the array section representing the block of the a stored on process (ip + s) % P within each group.

Figure 10: Matrix multiplication on a grid of processors.
\begin{figure}\small\begin{verbatim}Procs2 p = new Procs2(P, P) ;
on(p) {
R...
..., 1, 0, CYCL) ;
Adlib.copy(b, tmp) ;
}
}\end{verbatim}\normalsize\end{figure}

The freedom to embed calls to collective communication functions inside distributed control constructs is a distinctive feature of Java-Ad. There are a few restrictions on what operations are allowed. In general the requirement is that all array arguments of a collective operation should be accessible at the point of call. An array is accesible if it is distributed over a group contained in the active process group.


next up previous
Next: Class libraries or syntax Up: Introduction to Java-Ad Previous: Subranges
Bryan Carpenter 2002-07-12