Loop Count and Loop Distribution

Loop Count

The LOOP COUNT(n) directive indicates the loop count is likely to be n, where n  is an integer constant.

The value of loop count affects heuristics used in software pipelining and data prefetch.

Example 1

!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

For more details on this directive, see "Directive Enhanced Compilation", section "General Directives", in the Intel® Fortran Language Reference.

Loop Distribution

The DISTRIBUTE POINT directive indicates a preference for performing loop distribution.

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. Multiple distribute directives are supported if they are placed inside the loop. When they are placed inside the loop, they cannot be put inside an IF statement.

Example 2: Example of distribute point Directive

!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