Intel® Fortran Compiler 16.0 User and Reference Guide

ATTRIBUTES FASTMEM

The ATTRIBUTES directive option FASTMEM enables High Band Width (HBW) memory allocation for an allocated object. This directive option only applies to Intel® 64 architecture targeting the Intel® Xeon Phi™ coprocessor (code name Knights Landing) and it is only available for Linux* systems.

!DIR$ ATTRIBUTES FASTMEM :: object

object

Is an allocatable array. It cannot be a local variable, a common block, or an array that will be allocated on the stack.

FASTMEM enables High Band Width (HBW) memory allocation for an allocated object at runtime.

When the specified object is allocated using the ALLOCATE statement at runtime, the Fortran Run-Time Library (RTL) allocates the memory in HBW memory. When the specified object is deallocated using the DEALLOCATE statement at runtime, the Fortran RTL deallocates the memory in HBW memory.

If the hardware is not available to allocate the object to High Band Width (HBW) memory, or if the libraries required for HBW memory support are not linked into the executable then either a 183 or 184 error will be issued by the ALLOCATE statement.

If enough HBW memory is not available to satisfy the allocation, then allocation is performed using non-HBW memory.

You can determine if the HBW memory hardware is available and if the libraries required for HBW memory support are linked into the executable by calling the FOR_GET_HBW_AVAILABILITY() function. You can change the behavior of the ALLOCATE statement when HBW memory hardware is not available or if the required libraries are not linked into the executable by calling the FOR_SET_FASTMEM_POLICY() function. Alternatively, you can set environment variables FOR_FASTMEM_RETRY or FOR_FASTMEM_RETRY_WARN.

When you use this directive in a program, you must specify the following on the compiler or linker command line:

-lmemkind

The following example shows a way to use this directive option to allocate High Band Width (HBW) memory:

real, allocatable :: X (:,:)
!dir$ attributes fastmem :: X
…
allocate (X(100,100))

You can use ATTRIBUTES FASTMEM on a field of a derived type; for example:

TYPE EXAMPLE 
!DIR$ ATTRIBUTES FASTMEM :: R_alloc 
REAL, ALLOCATABLE :: R_alloc ( : ) 
END TYPE EXAMPLE  

TYPE (EXAMPLE) :: MyVar  

ALLOCATE (MyVar%R_alloc(1000))

You can use ATTRIBUTES option ALIGN with FASTMEM; for example:

!DIR$ ATTRIBUTES FASTMEM, ALIGN:64 :: A       

ALLOCATE ( A(1000), STAT= integer-variable )  
...
DEALLOCATE ( A )  

See Also