next up previous contents index
Next: Rules for distributed array Up: Some Rules and Definitions Previous: Some Rules and Definitions   Contents   Index

Rules for distributed control constructs

In earlier sections we have often referred informally to the ``active process group''. One concrete role of this group was as the default distribution target in distributed array constructors. We used the fact that the on construct establishes its group argument as the active process group inside the body of the construct. The other distributed control constructs, at and overall, also affect the active process group--you may want to revisit the discussion in section 2.5. We can use the notations introduced in the last section to state their effect more formally

First, for completeness, we restate the effect of the on construct and give an associated rule. As explained in section 2.2, the construct

\begin{displaymath}
\begin{minipage}[t]{\linewidth}\small\begin{verbatim}on(p) {
...
}\end{verbatim}\end{minipage}\end{displaymath}

changes the active group to $\mbox{\tt p}$ inside its body. The associated rule is:

Rule 1   The construct

\begin{displaymath}
\begin{minipage}[t]{\linewidth}\small\begin{verbatim}on(p) { ... }\end{verbatim}\end{minipage}\end{displaymath}

can only appear at a point in the program where p is contained in the active process group.

In other words, an on construct cannot add any new process to the active group. If this rule is not satisfied an hpjava.lang.GroupNotContainedException will be thrown on entering the construct.

Now, if the current active group is p, executing the construct construct

\begin{displaymath}
\begin{minipage}[t]{\linewidth}\small\begin{verbatim}at(i = x [n]) {
...
}\end{verbatim}\end{minipage}\end{displaymath}

or

\begin{displaymath}
\begin{minipage}[t]{\linewidth}\small\begin{verbatim}overall(i = x for l : u : s) {
...
}\end{verbatim}\end{minipage}\end{displaymath}

will change the active group to $\mbox{\tt p} / \mbox{\tt i}$ inside the bodies of the constructs.

The expression $\mbox{\tt p} / \mbox{\tt i}$ is only well defined if the location i belongs to a range distributed over a dimension of p5.1. So we can conclude that:

Rule 2   Unless x is a collapsed range, a control construct

\begin{displaymath}
\begin{minipage}[t]{\linewidth}\small\begin{verbatim}at(i = x [n]) { ... }\end{verbatim}\end{minipage}\end{displaymath}

or

\begin{displaymath}
\begin{minipage}[t]{\linewidth}\small\begin{verbatim}overall(i = x for l : u : s) { ... }\end{verbatim}\end{minipage}\end{displaymath}

can only appear at a point in the program where the process dimension of x occurs in the dimension set of the active process group.

If this rule is not satisfied an hpjava.lang.DimensionNotInGroupException will be thrown on entering the construct.

As an example of the application of this rule, notice that the the dimension set of the restricted group $\mbox{\tt p} / \mbox{x[n]}$ certainly does not include the process dimension associated with x. So one of the implications of rule 2 is that we should never expect to see exactly the two constructs above nested like this:

\begin{displaymath}
\begin{minipage}[t]{\linewidth}\small\begin{verbatim}at(i...
...x for l : u : s) { // ERROR
...
}\end{verbatim}\end{minipage}\end{displaymath}

This is good, because the outer construct already restricts control to a single coordinate value, and it doesn't make sense to try distributing control across all coordinates of the same process dimension inside that construct5.2.


next up previous contents index
Next: Rules for distributed array Up: Some Rules and Definitions Previous: Some Rules and Definitions   Contents   Index
Bryan Carpenter 2003-04-15