Intel® Fortran Compiler 18.0 Developer Guide and Reference

FOR_GET_HBW_SIZE

Run-Time Function: Returns the available free high bandwidth memory and the total high bandwidth memory that is available on a node of the High Bandwidth Memory partition. This function is only available on Intel® 64 architecture targeting the Intel® Xeon Phi™ product family x200 (formerly code name Knights Landing).

Module

USE IFCORE

Syntax

status = FOR_GET_HBW_SIZE(partition, total, free)

partition

(Input) Must be of type INTEGER(4). Set its value to 1 to receive information about the High Bandwidth Memory partition.

total

(Output) Must be of type INTEGER(8). It gets set to the number of bytes of memory on the system that can be allocated in the High Bandwidth Memory partition.

free

(Output) Must be of type INTEGER(8). It gets set to the number of available unallocated bytes of memory on the system that can be allocated in the High Bandwidth Memory partition.

Results

The result type is INTEGER(4). status has the value 0 if the call was successful. Upon failure, status is set to an error code as documented in the memkind(3) man page.

FOR_GET_HBW_SIZE is defined by the following Fortran interface block:

 interface 
    function for_get_hbw_size (partition, total, free) &
   &        result(istat)  bind(C,name='hbw_get_size') 
      use iso_c_binding 
      implicit none 
      integer(C_INT)        :: istat 
      integer(C_INT), value :: partition     ! partition == 1 for HBW 
      integer(C_SIZE_T)     :: total, free 
    end function hbw_get_size 
  end interface

FOR_GET_HBW_SIZE calls the libmemkind function hbw_get_size as follows:

#include <memkind.h> 
int hbw_get_size(int partition, size_t * total, size_t * free) {             // partition=1   for HBM 
  memkind_t kind; 
  int stat = memkind_get_kind_by_partition(partition, &kind); 
  if(stat==0) stat = memkind_get_size(kind, total, free); 
  return stat; 
}

See Also