next up previous contents
Next: Independent DO Loops - Up: Data 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


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

Adam Marshall ©University of Liverpool, 1996
Fri Dec 6 15:03:35 GMT 1996
Not for commercial use.