tem_global_vmhwm Function

public function tem_global_vmhwm() result(hwm)

Obtain the memory status from all processes (min, max, avg).

Find min, max and average high water mark of the virtual memory usage across all processes (MPI_COMM_WORLD) on rank 0. Results are in Megabytes, and the resulting array contains min, max, avg in this order.

Arguments

None

Return Value real(kind=rk), (3)


Source Code

  function tem_global_vmhwm() result(hwm)
    real(kind=rk) :: hwm(3)
    ! -------------------------------------------------------------------- !
    integer :: myhwm, minhwm, maxhwm
    integer :: nProcs
    integer :: iError
    real :: myMB
    real :: sumhwm
    ! -------------------------------------------------------------------- !

    call MPI_Comm_Size(MPI_COMM_WORLD, nProcs, iError)
    myhwm = my_status_int('VmHWM:')
    call MPI_Reduce( myhwm, minhwm, 1, MPI_INTEGER, MPI_MIN, 0, &
      &              MPI_COMM_WORLD, iError                     )
    call MPI_Reduce( myhwm, maxhwm, 1, MPI_INTEGER, MPI_MAX, 0, &
      &              MPI_COMM_WORLD, iError                     )
    myMB = real(myhwm)/1024.0
    call MPI_Reduce( myMB, sumhwm, 1, MPI_REAL, MPI_SUM, 0, MPI_COMM_WORLD, &
      &              iError                                                 )

    hwm(1) = real(minhwm, kind=rk)/1024.0_rk
    hwm(2) = real(maxhwm, kind=rk)/1024.0_rk
    hwm(3) = sumhwm / real(nProcs, kind=rk)

  end function tem_global_vmhwm