test_get_total Subroutine

public subroutine test_get_total(this)

Arguments

Type IntentOptional Attributes Name
class(MpiTestMethod), intent(inout) :: this

Calls

proc~~test_get_total~~CallsGraph proc~test_get_total test_get_total assertequal assertequal proc~test_get_total->assertequal getmpicommunicator getmpicommunicator proc~test_get_total->getmpicommunicator getprocessrank getprocessrank proc~test_get_total->getprocessrank none~add_cycle~2 AdvancedMeter%add_cycle proc~test_get_total->none~add_cycle~2 none~get_stats_total DistributedMeter%get_stats_total proc~test_get_total->none~get_stats_total none~reduce DistributedMeter%reduce proc~test_get_total->none~reduce none~get_mean_cycle AdvancedMeter%get_mean_cycle none~add_cycle~2->none~get_mean_cycle none~reduce_mpi DistributedMeter%reduce_mpi none~reduce->none~reduce_mpi none~get_num_cycles AdvancedMeter%get_num_cycles none~get_mean_cycle->none~get_num_cycles mpi_comm_rank mpi_comm_rank none~reduce_mpi->mpi_comm_rank mpi_reduce mpi_reduce none~reduce_mpi->mpi_reduce none~get_max_cycle AdvancedMeter%get_max_cycle none~reduce_mpi->none~get_max_cycle none~get_min_cycle AdvancedMeter%get_min_cycle none~reduce_mpi->none~get_min_cycle none~reduce_mpi->none~get_num_cycles none~get_sum_square_deviation AdvancedMeter%get_sum_square_deviation none~reduce_mpi->none~get_sum_square_deviation none~get_total~2 AdvancedMeter%get_total none~reduce_mpi->none~get_total~2 proc~mapl_verify MAPL_Verify none~reduce_mpi->proc~mapl_verify proc~mapl_throw_exception MAPL_throw_exception proc~mapl_verify->proc~mapl_throw_exception

Source Code

   subroutine test_get_total(this)
      class (MpiTestMethod), intent(inout) :: this
 
      type (DistributedMeter) :: distributed
      type (DistributedReal64) :: distributed_total

      distributed = DistributedMeter(MpiTimerGauge())
      select case (this%getProcessRank())
      case (0)
         call distributed%add_cycle(1.0_REAL64)
         call distributed%add_cycle(3.0_REAL64)
      case (1)
         call distributed%add_cycle(2.0_REAL64)
      end select
      call distributed%reduce(this%getMpiCommunicator(), 0._REAL64)

      distributed_total = distributed%get_stats_total()

      if (this%getProcessRank() == 0) then
         @assertEqual(6.0, distributed_total%total)
         @assertEqual(2.0, distributed_total%min)
         @assertEqual(4.0, distributed_total%max)

         @assertEqual(1, distributed_total%min_pe)
         @assertEqual(0, distributed_total%max_pe)
         @assertEqual(2, distributed_total%num_pes)
      end if

   end subroutine test_get_total