next up previous contents
Next: REDUCTION Variables and Statements Up: NEW Variables Previous: NEW Variables

Examples of NEW

!HPF$ INDEPENDENT, NEW(I)
DO I = 1, 10
   A(I) = B(I-1)
END DO

This example would be correct either with or without the NEW clause; in either case, the compiler could confidently parallelize the assignments to array A. Additionally however, the NEW clause asserts thatthe loop index I is not used after the completion of the loop. Some compilers may be able to use this information to avoid updating replicated copies of I on other processors, or to enable other optimazions.

!HPF$ INDEPENDENT, NEW (I2)
DO I1 = 1,N1
   !HPF INDEPENDENT, NEW (I3)
   DO I2 = 1,N2
      DO I3 = 2,N3   ! The inner loop is NOT independent!
          A(I1,I2,I3) = A(I1,I2,I3) - A(I1,I2,I3-1)*B(I1,I2,I3)
      END DO
   END DO
END DO

The inner loop is not independent because each element of A is computed from the preceding one. However, the two outer loops are independent because they access different elements of A. The NEW clauses are required, since the inner loop indices are assigned and used in different iterations of the outermost loops.