count_mpi_statistics Subroutine

public subroutine count_mpi_statistics(mpi_statistics, data_size, element_size_bytes, size_breakdown)

Arguments

TypeIntentOptionalAttributesName
real, intent(inout), DIMENSION(:):: mpi_statistics
integer, intent(in) :: data_size
integer, intent(in) :: element_size_bytes
integer(kind=int_8), intent(inout), optional DIMENSION(:, :):: size_breakdown

Contents

Source Code


Source Code

   SUBROUTINE count_mpi_statistics(mpi_statistics, data_size, &
                                   element_size_bytes, size_breakdown)
      REAL, DIMENSION(:), INTENT(INOUT)                  :: mpi_statistics
      INTEGER, INTENT(IN)                                :: data_size
      INTEGER, INTENT(IN)                                :: element_size_bytes
      INTEGER(KIND=int_8), DIMENSION(:, :), &
         INTENT(INOUT), OPTIONAL                         :: size_breakdown

      INTEGER                                            :: ilimit, nlimits
      INTEGER(KIND=int_8)                                :: data_size_bytes, llimit

      ! change in bytes
      data_size_bytes = INT(data_size, KIND=int_8)*INT(element_size_bytes, KIND=int_8)
      !
      mpi_statistics(1) = mpi_statistics(1) + REAL(data_size_bytes)
      mpi_statistics(2) = MIN(mpi_statistics(2), REAL(data_size_bytes))
      mpi_statistics(3) = MAX(mpi_statistics(3), REAL(data_size_bytes))
      IF (PRESENT(size_breakdown)) THEN
         nlimits = SIZE(dbcsr_mpi_size_limits)
         ! check for oversize messages
         IF (data_size_bytes .GT. dbcsr_mpi_size_limits(nlimits)) THEN
            size_breakdown(nlimits + 1, 1) = size_breakdown(nlimits + 1, 1) + 1
            size_breakdown(nlimits + 1, 2) = size_breakdown(nlimits + 1, 2) + data_size_bytes
            RETURN
         END IF
         llimit = 0
         DO ilimit = 1, nlimits
            IF (data_size_bytes .GE. llimit .AND. data_size_bytes .LE. dbcsr_mpi_size_limits(ilimit)) THEN
               size_breakdown(ilimit, 1) = size_breakdown(ilimit, 1) + 1
               size_breakdown(ilimit, 2) = size_breakdown(ilimit, 2) + data_size_bytes
               RETURN
            END IF
            llimit = dbcsr_mpi_size_limits(ilimit)
         END DO
      END IF
   END SUBROUTINE count_mpi_statistics