Intel® Fortran Compiler 18.0 Developer Guide and Reference

FOR_GET_MEMKIND

Run-Time Function: Returns the requested allocation memory space for an array.

Module

USE IFCORE

result = FOR_GET_MEMKIND (variable)

variable

Must be an array with either the ALLOCATABLE or POINTER attribute.

Results

The result type is INTEGER(4). The return value will be one of the following:

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:

Example

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

See Also