インテル® Fortran コンパイラー 19.0 デベロッパー・ガイドおよびリファレンス
The ATTRIBUTES directive option MEMKIND enables High Band Width (HBW) memory or non-HBW memory (DDR) allocation for an allocated object. This directive option only applies to Intel® 64 architecture targeting the Intel® Xeon Phi™ product family x200 (formerly code name Knights Landing) and it is only available for Linux* systems.
!DIR$ ATTRIBUTES MEMKIND : memory :: object [, object]...
memory |
Specifies the requested memory kind. It must be one of the following:
|
object |
Is an array with the ALLOCATABLE attribute. It can be of any data type, kind, or rank > 0. It can be an array component of a variable of derived type. It cannot be a local variable, a common block, an array that will be allocated on the stack, or have the POINTER attribute. It can be a dummy argument. |
!DIR ATTRIBUTES FASTMEM has the same meaning as !DIR ATTRIBUTES MEMKIND:HBW, but the preferred directive is !DIR ATTRIBUTES MEMKIND:HBW.
When the specified object is allocated using the ALLOCATE statement at runtime, the Fortran Run-Time Library (RTL) allocates the memory in the specified memory (HBW or DDR). When the specified object is deallocated using the DEALLOCATE statement at runtime, the Fortran RTL deallocates the memory in the specified 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 ATTRIBUTES MEMKIND:HBW 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 MEMKIND:HBW :: X
…
ALLOCATE (X(100,100))
You can use ATTRIBUTES MEMKIND on a field of a derived type; for example:
TYPE EXAMPLE
!DIR$ ATTRIBUTES MEMKIND:HBW :: R_ALLOC
REAL, ALLOCATABLE :: R_ALLOC ( : )
END TYPE EXAMPLE
TYPE (EXAMPLE) :: MYVAR
ALLOCATE (MYVAR%R_ALLOC(1000))
You can use ATTRIBUTES option ALIGN with MEMKIND; for example:
!DIR$ ATTRIBUTES MEMKIND:HBW, ALIGN:64 :: A
ALLOCATE ( A(1000), STAT= integer-variable )
...
DEALLOCATE ( A )
ATTRIBUTES MEMKIND on an object interacts with a MEMKIND directive on the ALLOCATE for that object. For more information, see the MEMKIND directive.
ATTRIBUTES MEMKIND cannot be used with an array with the POINTER attribute but the MEMKIND directive can be used to request a specific memory allocation space before the ALLOCATE statement for an array with the POINTER attribute.