next up previous contents
Next: Do-loops and Forall Statements Up: Expressing Parallel Execution Previous: Forall Examples

 

Execution Process

It is important to be aware of the order of execution of a FORALL statement which is as follows,

  1. evaluate subscript expressions (< forall-triplet-list >),
  2. evaluate mask for all indices,
  3. for all .TRUE. mask elements, evaluate whole of RHS of assignment,
  4. assign RHSs to corresponding LHSs

Since FORALL is executed in parallel over a number of processors and since there is a distinct and rigid ordering implied in its execution, each processor must be sure that all other processors have completed the current step before any processor is allowed to continue. This means that there are synchronisations between every step in the execution process. In other words, every processor must have finished evaluating the subscript expressions before any processor begins to work out the mask. Likewise the mask calculation must been completed by every processor before calculation of the RHS may begin, and so on.

As always in Fortran, it is not permissible to perform assignment to the same element more than once in the body of a parallel assignment statement (such as FORALL). Compare this with parallel assignments to vector subscripted LHS's.

Return to corresponding overview page gif


next up previous contents
Next: Do-loops and Forall Statements Up: Expressing Parallel Execution Previous: Forall Examples

©University of Liverpool, 1997
Wed May 28 20:20:27 BST 1997
Not for commercial use.