INDEPENDENT Loops
HPF gives additional opportunities for parallel implementation by using the INDEPENDENT directive to assert that the iterations of a do-loop can be done independently---that is, in any order or concurrently---without affecting the result . In effect, this directive changes a do-loop from an implicitly parallel construct to an explicitly parallel construct.
The INDEPENDENT directive must instantaneously precede the do-loop to which it applies. In its easiest form, it has no additional argument and asserts simply that no iteration of the do-loop can affect any other iteration.
Example 9
In the following code fragment, the directives indicate that the outer two loops are independent. The inner loop assigns the elements of A repeatedly and hence it is not independent.
!HPF$ INDEPENDENT
do i=1,n1 ! Loop over i independent
!HPF$ INDEPENDENT
do j=1,n2 ! Loop over j independent
do k=1,n3 ! Inner loop not independent
A(i,j) = A(i,j) + B(i,j,k)*C(i,j)
enddo enddo
enddo