** Next:** Syntax of Directives
**Up:** The HPF Model
** Previous:** Aggregate Communication Examples

The examples in Sections and were chosen so that parallelism and communication were not in conflict. The purpose of this section is to show cases where there is a tradeoff. The best implementation of all these examples will be machine dependent. As in the other sections, these examples do not necessarily reflect good programming practice.

Analyzing communication as in Sections
and does not completely determine a program's performance.
Consider the code:
REAL x(100), y(100)
!HPF DISTRIBUTE (BLOCK) ONTO procs:: x, y ... DO k = 3, 98 x(k) = y(k) * (x(k-1) + x(k) + x(k+1)) / 3.0 y(k) = x(k) + (y(k-1) + y(k-2) + y(k+1) + y(k+2)) / 4.0 ENDDO Only a few values need be communicated at the boundary of each processor. However, every iteration of the `DO` loop uses data computed on
previous iterations
for the references `x(k-1)`, `y(k-1)`, and `y(k-2)`.
Therefore, although there is little inherent communication, the
computation will run sequentially.

itemize This list is not exhaustive. The optimal strategy will be highly machine dependent.

- Evaluate each element of the right-hand side on the processor where
it will be stored.
This strategy potentially requires fetching three values (the elements of
`b`,`c`, and`d`) for each element computed. It always uses the maximum parallelism of the machine. - Evaluate each element of the right-hand side on the processor where
the corresponding elements of
`b(ix)`,`c(ix)`, and`d(ix)`are stored. Ignoring set-up costs, this potentially communicates one result for each element computed. If the values of`ix`are evenly distributed, then it also uses the maximum machine parallelism.

Thu Jul 21 17:05:43 CDT 1994