Fortran Programming Guide

f77: Apparent Dependencies

The f77 compiler may automatically eliminate a reference that appears to create a dependency transforming the compiled code. One of the many such transformations makes use of private versions of some of the arrays. Typically, the compiler does this if it can determine that such arrays are used in the original loops only as temporary storage.

Example: Using -autopar, with dependencies eliminated by private arrays:


      parameter (n=1000)
      real a(n), b(n), c(n,n)
      do i = 1, 1000                             <--Parallelized
        do k = 1, n                   
          a(k) = b(k) + 2.0
        end do
        do j = 1, n
          c(i,j) = a(j) + 2.3
        end do
      end do
      end

In the preceding example, the outer loop is parallelized and run on independent processors. Although the inner loop references to array a(*) appear to result in a data dependency, the compiler generates temporary private copies of the array to make the outer loop iterations independent.