Loop Count and Loop Distribution

LOOP COUNT (N) Directive

The LOOP COUNT (n) directive indicates the loop count is likely to be n.

The syntax for this directive is:

!DEC$ LOOP COUNT(n) or CDEC$ LOOP COUNT(n)

where n is an integer constant.

The value of loop count affects heuristics used in software pipelining, vectorization and loop-transformations.

LOOP COUNT (N)

!DEC$ LOOP COUNT (10000)
do i =1,m
b(i) = a(i) +1 ! This is likely to enable
       ! the loop to get software-
       ! pipelined
enddo

Loop Distribution Directive

The DISTRIBUTE POINT directive indicates to compiler a preference of performing loop distribution.

The syntax for this directive is:

!DEC$ DISTRIBUTE POINT or CDEC$ DISTRIBUTE POINT

Loop distribution may cause large loops be distributed into smaller ones. This may enable more loops to get software-pipelined. If the directive is placed inside a loop, the distribution is performed after the directive and any loop-carried dependency is ignored. If the directive is placed before a loop, the compiler will determine where to distribute and data dependency is observed. Currently only one distribute directive is supported if it is placed inside the loop.

DISTRIBUTE POINT

!DEC$ DISTRIBUTE POINT
do i =1, m
b(i) = a(i) +1
....
c(i) = a(i) + b(i) ! Compiler will decide where
         ! to distribute.
         ! Data dependency is observed
....
d(i) = c(i) + 1
enddo

do i =1, m
b(i) = a(i) +1
....
!DEC$  DISTRIBUTE POINT
call  sub(a, n)    ! Distribution will start here,
         ! ignoring all loop-carried
         ! dependency
c(i) = a(i) + b(i)
....
d(i) = c(i) + 1
enddo