It is important to be aware of the order of execution of a FORALL statement which is as follows,
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