Using Fortran Intrinsics

Intel® Fortran supports all standard Fortran intrinsic procedures and provides Intel-specific intrinsic procedures to extend the language functionality. The Intel-specific intrinsic procedures are provided in libifcore.lib. For more details on these intrinsic procedures, see the Intel® Fortran Language Reference.

This topic provides an example of an Intel-extended intrinsic that is helpful in developing efficient applications on IA-32, Intel® 64, and IA-64 architectures.

CACHESIZE Intrinsic

The intrinsic CACHESIZE(n) returns the size in kilobytes of the cache at level n; one (1) represents the first level cache. Zero (0) is returned for a nonexistent cache level.

Use this intrinsic in any situation you would like to tailor algorithms for the cache hierarchy on the target processor. For example, an application may query the cache size and use the result to select block sizes in algorithms that operate on matrices.

Example

subroutine foo (level)

integer level

if (cachesize(level) > threshold) then

   call big_bar()

else

   call small_bar()

end if

end subroutine