インテル® Fortran コンパイラー 19.0 デベロッパー・ガイドおよびリファレンス
Run-Time Function: Returns the requested allocation memory space for an array.
USE IFCORE
result = FOR_GET_MEMKIND (variable)
variable |
Must be an array with either the ALLOCATABLE or POINTER attribute. |
The result type is INTEGER(4). The return value will be one of the following:
FOR_K_MEMKIND_DDR if variable should be allocated in DDR memory (Double Data Rate Random Access Memory).
FOR_K_MEMKIND_HBW if variable should be allocated in HBW memory (High Band Width memory).
If variable does not have the ALLOCATABLE or the POINTER attribute, the result is undefined.
You can request that an array with the ALLOCATABLE or the POINTER attribute should be allocated to HBW or DDR memory by specifying one of the following preceding the ALLOCATE statement for the array:
ATTRIBUTES MEMKIND directive
MEMKIND directive
In the following example, the array R has been given the attribute HBW but later, R is allocated in DDR memory:
USE IFCORE
REAL, ALLOCATABLE :: R(:)
!DIR$ ATTRIBUTES MEMKIND:HBW :: R
PRINT *, FOR_K_MEMKIND_DDR, FOR_K_MEMKIND_HBW ! prints 0 1
PRINT *, FOR_GET_MEMKIND® ! prints 1 for HBW
!DIR$ MEMKIND:DDR
ALLOCATE(R(1000))
PRINT *, FOR_GET_MEMKIND® ! prints 0 for DDR
END
In the following example, we cannot set ATTRIBUTES MEMKIND on a pointer but we can use the MEMKIND directive on the ALLOCATE statement:
REAL, POINTER :: PR(:)
PRINT *, FOR_GET_MEMKIND(PR) ! prints 0 for DDR
!DIR$ MEMKIND:HBW ! legal on ALLOCATE of pointer PR
ALLOCATE(PR(1000))
PRINT *, FOR_GET_MEMKIND(PR) ! prints 1 for HBW
END