Loop Count and Loop Distribution

Loop Count

The loop count directive indicates the loop count is likely to be an integer constant. The syntax for this directive is shown below:

Syntax

!DEC$ LOOP COUNT (n)

where n is an integer value.

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

Example: Using loop count

subroutine loop_count(a, b, N)

  integer :: i, N, b(N), c(N)

  !DEC$ LOOP COUNT (1000)

! This should enable software pipeling

! for this loop.

  do i = 1, 1000

    b(i) = a(i) + 1

  enddo

end subroutine loop_count

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. The syntax for this directive is shown below:

Syntax

!DEC$ DISTRIBUTE POINT

Loop distribution may cause large loops be distributed into smaller ones. This strategy might enable more loops to get software-pipelined.

Example: Using distribute point

subroutine dist1(a, b, c, d, N)

  integer :: i, N, a(N), b(N), c(N), d(N)

 !DEC$ DISTRIBUTE POINT

  do i = 1, N

    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

end subroutine dist1

 

subroutine dist2(a, b, c, d, N)

  integer :: i, N, a(N), b(N), c(N), d(N)

  do i = 1, N

    b(i) = a(i) + 1

    !DEC$  DISTRIBUTE POINT

 ! Distribution will start here, ignoring all

 ! loop-carried dependency.

    c(i) = a(i) + b(i)

    d(i) = c(i) + 1

  enddo

end subroutine dist2