blockingsize

Date:

05-29-2011

NAME

blockingsize, noblocking - assert that the loop following the directive either is or is not involved in a cache blocking

SYNOPSIS

!DIR$ BLOCKINGSIZE(n1[,n2])

!DIR$ NOBLOCKING

IMPLEMENTATION

Cray Linux Environment (CLE)

DESCRIPTION

The BLOCKINGSIZE directive asserts that the loop following the directive is involved in a cache blocking situation for the primary or secondary cache.

The NOBLOCKING directive prevents the compiler from involving the subsequent loop in a cache blocking situation.

The BLOCKINGSIZE directive supports this argument:

n

Where n is an integer that indicates the block size. If the loop is involved in a blocking situation, it will have a block size of n1 for the primary cache and n2 for the secondary cache. The compiler attempts to include this loop within such a block but cannot guarantee this inclusion.

  • For n1, specify a value such that n1 .GE. 0. For n2, specify a value such that n2 .LE. 230.

  • If n1 or n2 are 0, the loop is not blocked, but the entire loop is inside the block.

Example 1: Using !dir$ blockingsize

In this example, the compiler makes 20 x 20 blocks when blocking, but it could block the loop nest such that loop K is not included in the file.

      SUBROUTINE AMAT(X,Y,Z,N,M,MM)
      REAL(KIND=8) X(100,100), Y(100,100), Z(100,100)
      DO K = 1, N
!DIR$ BLOCKABLE(J,I)
!DIR$ BLOCKING SIZE (20)
         DO J = 1, M
!DIR$ BLOCKING SIZE (20)
            DO I = 1, MM
               Z(I,K) = Z(I,K) + X(I,J)*Y(J,K)
            END DO
         END DO
      END DO
      END

If K is excluded, you can add a BLOCKINGSIZE(0) directive just before loop K to specify that the compiler should generate a loop such as the following example:

SUBROUTINE AMAT(X,Y,Z,N,M,MM)
REAL(KIND=8) X(100,100), Y(100,100), Z(100,100)
DO JJ = 1, M, 20
   DO II = 1, MM, 20
      DO K = 1, N
         DO J = JJ, MIN(M, JJ+19)
            DO I = II, MIN(MM, II+19)
               Z(I,K) = Z(I,K) + X(I,J)*Y(J,K)
            END DO
         END DO
      END DO
   END DO
END DO
END

Note that an INTERCHANGE directive can be applied to the same loop nest as a BLOCKINGSIZE directive. The BLOCKINGSIZE directive applies to the loop it directly precedes; it moves with that loop when an interchange is applied.

The NOBLOCKING directive prevents the compiler from involving the subsequent loop in a cache blocking situation.

SEE ALSO

intro_directives(7), interchange(7)

Cray Fortran Reference Manual