next up previous contents
Next: Independent DO Loops - Up: Expressing Parallel Execution Previous: MIMD Example

 

The INDEPENDENT Directive

INDEPENDENT appears in the executable area of a program unit -- it must prefix a DO loop or FORALL statement or construct. In both case the directive asserts that no `iteration' affects any other iteration either directly or indirectly.

For DO-loops INDEPENDENT means the iterations or assignments can be performed in any order (or equivalently, in parallel):

 !HPF$ INDEPENDENT
 DO i = 1,n
   x(i) = i**2
 END DO

Applying an INDEPENDENT directive to FORALL means that there does not have to be a synchronisation point between calculating the RHS expression and beginning to assign to the LHS. In other words, the whole RHS does not have to be evaluated before assignment to the LHS can begin. This should speed up execution.

 !HPF$ INDEPENDENT
 FORALL (i = 1:n) x(i) = i**2

Return to corresponding overview page gif


next up previous contents
Next: Independent DO Loops - Up: Expressing Parallel Execution Previous: MIMD Example

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