How to use the function "GlobalMemoryStatus" in PG

Dear all,

Could anyone give me an example code to call the function “GlobalMemoryStatus” in PGI fortran. The code can be compiled by Intel Fortran compiler but errors happened when compiled by PGI fortran compiler.


The code is as follows:

integer function GetMemStatus1(maxphys)result(out)
use kernel32
use dfwinty
implicit none
integer::maxphys
type(T_MEMORYSTATUS) lpMstMemStat
call GlobalMemoryStatus ( lpMstMemStat )
!c Specifies a number between 0 and 100 that gives a general idea of current memory utilization, in which 0 indicates no memory use and 100 indicates full memory use.
write(*,*) 'Percent of memory use -> ', lpMstMemStat%dwMemoryLoad
!c Indicates the total number of bytes of physical memory.
write(*,*) 'Bytes of physical memory -> ',lpMstMemStat%dwTotalPhys
!c Indicates the number of bytes of physical memory available.
write(*,*) 'Bytes of physical memory available -> ', lpMstMemStat%dwAvailPhys
!c Indicates the total number of bytes that can be stored in the paging file. Note that this number does not represent the actual physical size of the paging file on disk.
write(*,*) 'Bytes that can be stored in the paging file-> ', lpMstMemStat%dwTotalPageFile
!c Indicates the number of bytes available in the paging file.
write(*,*) 'Bytes available in the paging file -> ', lpMstMemStat%dwAvailPageFile
!c Indicates the total number of bytes that can be described in the user mode portion of the virtual address space of the calling process.
write(*,*) 'Bytes that can be described in the user mode portion of the virtual address space -> ', lpMstMemStat%dwTotalVirtual
!c Indicates the number of bytes of unreserved and uncommitted memory in the user mode portion of the virtual address space of the calling process.
write(*,*) 'Bytes of unreserved and uncommitted memory in the user mode portion of the virtual address space -> ', &
            lpMstMemStat%dwAvailVirtual 
end function

Thanks,
Zhanghong Tang

Hi,

This is a bug in our module file. Please contact trs@pgroup.com for a workaround. I have filed tpr#17258 for reference.

Thanks,
Hongyon

Hi Hongyon,

Thank you very much for your kindly reply. I think there are more than one subroutines have this kindly of problem.

Thanks,
Zhanghong Tang

Zhanghong,

Thanks for reporting to us. We will get them fixed in our next release. In the mean time, we can either provide you a workaround if you let us know what module do you use or you can update the interfaces in the module source file, recompile them, and put them in include directory. All module source file are in $PGI/win32/*/src directory. We apologize for the inconvenience.

Hongyon

Hi Hongyon,

The function is from the module “kernel32.f90”.

Thanks,
Zhanghong Tang

Hi Tang,

We have fixed it internally, please contact trs@pgroup.comso that we can provide you a workaround. 2 of the routines we fixed are GlobalMemoryStatus and GlobalMemoryStatusEx.

Hongyon

Dear Hongyon,

have you fixed the bugs? I have contacted trs@pgroup.com but didn’t have any response.

Thanks,
Zhanghong Tang

Please be patient. trs should sent email to you soon.

Thank you,
Hongyon