HPJava subgroups

<h1>Subgroups</h1>

A <em>subgroup</em> is some slice of a process grid, formed by
restricting the process coordinates in one or more dimensions to single
values.

<p>

It is quite natural and convenient to express this restriction procedure
in terms of a location.  If <tt>i</tt> is a location in a range
distributed over a dimension of <tt>p</tt>, then
<font color=Blue>
<pre>
  p / i
</pre>
</font>
represents a subgroup of <tt>p</tt> - the slice of <tt>p</tt> to which
location <tt>i</tt> is mapped.  It is a subgrid with one dimension
removed.  In the illustration below <tt>p</tt> is a 2 by 3 process grid
with ranges <tt>x</tt> and <tt>y</tt> distributed over its dimensions.

<p>

<img src="subgroups.gif">

<p>

Although the language overloads the <tt>/</tt> operator on groups
to make expressions like <tt>p / i</tt> legal, it is fairly unusual
to see an expression like this appearing explicitly in an HPJava program.
Their main role is in defining the semantics of the language.
The distributed control constructs <tt>overall</tt> and <tt>at</tt> change
the active process group in a way that has not been precisely specified so far.
Assume the current active process group is <tt>p</tt>, and <tt>x</tt> is
distributed over a dimension of <tt>p</tt>.  Inside either of the constructs
<font color=Blue>
<pre>
  at(i = x [n]) {
    ...
  }
</pre>
</font>
or
<font color=Blue>
<pre>
  overall(i = x) {
    ...
  }
</pre>
</font>
the active process group is reduced to <tt>p / i</tt>.  The effect of the
<tt>on</tt> construct on the APG was defined in earlier sections.
Together with new rules given here, we have a complete prescription for
computing the APG at any point in an HPJava program.

<p>

Subgroups can also be used to describe the <em>home group</em> of
an arbitrary array element.  Recall that for variables other than
array elements the home group was defined to be the APG in effect
at the time the variable was declared or constructed.  For an array
element, if the distribution group of the array as a whole (specified
implicitly or explicitly in the array constructor) is <tt>p</tt>, and
the array subscripts include locations <tt>i, j, ...</tt>, the home
group of the element is
<font color=Blue>
<pre>
  p / i / j / ...
</pre>
</font>

<b>Next:</b>
<a href="subranges.html">Subranges</a>

