next up previous contents
Next: About this document ... Up: A distributed array communication Previous: Irregular collective communications   Contents

Schedules

In general the collective communication functions introduced in the last few sections involve two phases: an inspector phase in which the arguments are analysed to determine what communications and local copies will be needed to complete the operation, and an executor phase in which the schedule of these data transfers is actually performed. In iterative algorithms, it often happens that exactly the same communication pattern is repeated many times over. In this case it is wasteful to repeat the inspector phase in every iteration, because the data transfer schedule will be the same every time.

Adlib provides a class of schedule objects for each of its communication functions. The classes generally have the same names as the static functions, with the first letter capitalized (the name may also be extended with a result type). Each class has a series of constructors with arguments identical to the instances of the function. Every schedule class has one public method with no arguments called execute, which executes the schedule.

Using WriteHalo and Maxval schedules, the main loop of the red-black relaxation program from section 3.2, Figure 3.8 could be rewritten as in Figure 6.2.

Figure 6.2: Red-black relaxation, re-using communication schedules.
\begin{figure*}\small\begin{verbatim}WriteHalo writeHalo = new WriteHalo(u) ;...
... }
}} while(maxval.execute() > EPS)) ;\end{verbatim}\normalsize\end{figure*}


next up previous contents
Next: About this document ... Up: A distributed array communication Previous: Irregular collective communications   Contents
Bryan Carpenter 2002-07-12