Storage Directives
The directives described in this topic specify aspects of storing common blocks, variables, or arrays.
The directives described in this topic specify aspects of storing common blocks, variables, or arrays.
BLOCKABLE
!DIR$ BLOCKABLE (do_variable, do_variable [,do_variable] ... )- do_variable
- Loop control variable
The BLOCKABLE directive specifies that it is legal and desirable to cache block the subsequent loop nest, even when the compiler has not made such a determination. To be legally blockable, the nest must be perfect (without code between constituent loops), rectangular (trip counts of member loops are fixed over the life time of nest), and fully permutable (loop interchange and unrolling is legal at all levels). This directive both permits and requests blocking of the indicated loop nest.
BLOCKINGSIZE directive is also provided for the indicated loop, the following rules apply:- If
BLOCKINGSIZEis at least two, the indicated blockingsize is used. - If
BLOCKINGSIZEis zero, the loop itself is not blocked and it is treated as an inner loop (as part of the nest that traverses the cache block tile). - If
BLOCKINGSIZEis one, the loop itself is not blocked and it is treated as an outer loop (as a loop in the nest that moves from tile to tile).
BLOCKINGSIZE
!DIR$ BLOCKINGSIZE (n1 [,n2])!DIR$ noblocking- n1
- Specify a value greater than or equal to 0 for the primary cache.
- n2
- Specify a value less than or equal to 2**30 for the secondary cache.
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.
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 inclusion.
BLOCKINGSIZE Directive
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
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
ENDNOBLOCKING
!DIR$ NOBLOCKINGAsserts that the loop following the directive should not be cache blocked for the primary or secondary cache. It is an error to place a noblocking directive before a loop that is part of a blockable collection.
STACK
!DIR$ STACKThe STACK directive causes storage to be allocated to the stack in the program unit that contains the directive. This directive overrides the -ev command line option in specific program units of a compilation unit. For more information about the -ev command line option, see Miscellaneous Fortran Specific Options.
Data specified in the specification part of a module or in a DATA statement is always allocated to static storage. This directive has no effect on this static storage allocation.
All SAVE statements are honored in program units that also contain a STACK directive. This directive does not override the SAVE statement.
If the compiler finds a STACK directive and a SAVE statement without any objects specified in the same program unit, a warning message is issued.
- It must be specified within the scope of a program unit.
- If it is specified in the specification part of a module, a message is issued. The
STACKdirective is allowed in the scope of a module procedure.