test_get_max Subroutine

public subroutine test_get_max(this)

Arguments

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

Calls

proc~~test_get_max~~CallsGraph proc~test_get_max test_get_max assertequal assertequal proc~test_get_max->assertequal getmpicommunicator getmpicommunicator proc~test_get_max->getmpicommunicator getprocessrank getprocessrank proc~test_get_max->getprocessrank none~add_cycle AdvancedMeter%add_cycle proc~test_get_max->none~add_cycle none~get_stats_max_cycle DistributedMeter%get_stats_max_cycle proc~test_get_max->none~get_stats_max_cycle none~reduce~2 DistributedMeter%reduce proc~test_get_max->none~reduce~2 none~get_mean_cycle AdvancedMeter%get_mean_cycle none~add_cycle->none~get_mean_cycle none~reduce_mpi DistributedMeter%reduce_mpi none~reduce~2->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 AdvancedMeter%get_total none~reduce_mpi->none~get_total 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_max(this)
      class (MpiTestMethod), intent(inout) :: this
 
      type (DistributedMeter) :: distributed
      type (DistributedReal64) :: distributed_max_cycle

      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_max_cycle = distributed%get_stats_max_cycle()

      if (this%getProcessRank() == 0) then
         ! Some of these are meaningless/pointless
         @assertEqual(5.0, distributed_max_cycle%total)
         @assertEqual(2.0, distributed_max_cycle%min)
         @assertEqual(3.0, distributed_max_cycle%max)

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

   end subroutine test_get_max