next up previous contents
Next: Grouping Operators Together Up: Supporting Phases Previous: Choosing Optimal Phase Boundaries

Expressing Time

Accordingly, operators are grouped together simply by expressing that they are run sequentially (thus, whenever the application performs I/O on one of the operators in the group, it is guaranteeing that it has finished performing I/O on the earlier operators). Using this information, the COP compiler can determine where within a sequence of sequential operators to place phase boundaries (if any). For example, a broadcast to all the nodes, followed by a reduction, would be specified as


\begin{singlespace}
\begin{verbatim}
(sequential
 (broadcast 'b 0)
 (reduce 'r 0 'myfunc))\end{verbatim}\end{singlespace}

(The second and third arguments to the reduce specify respectively that the result should be left on node zero, and that the high-level application is supplying a function myfunc to combine values on each node.) The COP compiler can now choose whether to compile this construct to one phase or to two phases based on timing predictions.

If a series of operators will be used repetitively, the loop construct is used instead of sequential. A label for the loop is specified (as is done for operators), along with an approximate loop count. A loop construct indicates that the last phase in the loop may be followed by the first phase, which is (as is discussed later) important for correct phase changes on a scheduled router. Thus, if the broadcast and reduction were repetitively performed, the COP program might be given as


\begin{singlespace}
\begin{verbatim}
(loop 'l 1000
 (broadcast 'b 0)
 (reduce 'r 0 'myfunc))\end{verbatim}\end{singlespace}


next up previous contents
Next: Grouping Operators Together Up: Supporting Phases Previous: Choosing Optimal Phase Boundaries
Back to Chris Metcalf's home page