Using Intrinsics for Itanium®-based Systems

Intel® Fortran supports all standard Fortran intrinsic procedures and in addition, provides  Intel-specific intrinsic procedures to extend the functionality of the language. Intel Fortran intrinsic procedures are provided in the library libintrins.a. See the Intel® Fortran Language Reference.

This topic provides examples of the Intel-extended intrinsics that are helpful in developing efficient applications.

Cache Size Intrinsic (Itanium® Compiler)

Intrinsic cachesize(n) is used only with Intel® Itanium® Compiler. cachesize(n) returns the size in kilobytes of the cache at level n; 1 represents the first level cache. Zero is returned for a nonexistent cache level.

This intrinsic can be used in many scenarios where application programmer would like to tailor their algorithms for target processor's cache hierarchy. For example, an application may query the cache size and use it to select block sizes in algorithms that operate on matrices.

subroutine foo (level)
integer level
if (cachesize(level) > threshold)
call big_bar()
else
call small_bar()
end if
end subroutine