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)


Calls

proc~~tem_global_vmhwm~~CallsGraph proc~tem_global_vmhwm tem_global_vmhwm mpi_comm_size mpi_comm_size proc~tem_global_vmhwm->mpi_comm_size mpi_reduce mpi_reduce proc~tem_global_vmhwm->mpi_reduce proc~my_status_int my_status_int proc~tem_global_vmhwm->proc~my_status_int proc~my_status_string my_status_string proc~my_status_int->proc~my_status_string proc~newunit newunit proc~my_status_string->proc~newunit proc~print_self_status print_self_status proc~my_status_string->proc~print_self_status proc~print_self_status->proc~newunit

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