run Subroutine

subroutine run(spec, rc)

Arguments

Type IntentOptional Attributes Name
type(ComboSpec), intent(in) :: spec
integer, intent(out), optional :: rc

Calls

proc~~run~21~~CallsGraph proc~run~21 run mpi_comm_rank mpi_comm_rank proc~run~21->mpi_comm_rank mpi_comm_size mpi_comm_size proc~run~21->mpi_comm_size mpi_comm_split mpi_comm_split proc~run~21->mpi_comm_split proc~make_bw_benchmark make_BW_Benchmark proc~run~21->proc~make_bw_benchmark proc~make_gathervkernel make_GathervKernel proc~run~21->proc~make_gathervkernel proc~mapl_return MAPL_Return proc~run~21->proc~mapl_return proc~mapl_verify MAPL_Verify proc~run~21->proc~mapl_verify proc~report~3 report proc~run~21->proc~report~3 proc~write_header~3 write_header proc~run~21->proc~write_header~3 proc~make_bw_benchmark->mpi_comm_rank proc~make_bw_benchmark->proc~mapl_return proc~make_bw_benchmark->proc~mapl_verify proc~make_gathervkernel->mpi_comm_size proc~make_gathervkernel->proc~mapl_return proc~make_gathervkernel->proc~mapl_verify none~init~4 GathervKernel%init proc~make_gathervkernel->none~init~4 at at proc~mapl_return->at insert insert proc~mapl_return->insert proc~mapl_throw_exception MAPL_throw_exception proc~mapl_return->proc~mapl_throw_exception proc~mapl_verify->proc~mapl_throw_exception proc~report~3->mpi_comm_rank proc~report~3->mpi_comm_size proc~report~3->proc~mapl_return proc~report~3->proc~mapl_verify proc~write_header~3->mpi_comm_rank proc~write_header~3->proc~mapl_return proc~write_header~3->proc~mapl_verify none~init~4->mpi_comm_rank none~init~4->mpi_comm_size none~init~4->proc~mapl_return none~init~4->proc~mapl_verify interface~mapl_assert MAPL_Assert none~init~4->interface~mapl_assert

Called by

proc~~run~21~~CalledByGraph proc~run~21 run program~main~19 main program~main~19->proc~run~21

Source Code

   subroutine run(spec, rc)
      type(ComboSpec), intent(in) :: spec
      integer, optional, intent(out) :: rc

      integer :: status

      real :: tot_time
      real :: tot_time_write
      real :: tot_time_gather
      real :: avg_time
      real :: avg_time_write
      real :: avg_time_gather
      type(GathervKernel) :: kernel
      type(BW_Benchmark) :: benchmark
      integer :: writer_comm
      integer :: gather_comm
      integer :: i
      real :: ta, tb

      integer :: color, rank, npes
      call MPI_Comm_rank(MPI_COMM_WORLD, rank, status)
      _VERIFY(status)
      call MPI_Comm_size(MPI_COMM_WORLD, npes, status)
      _VERIFY(status)

      color = (rank*spec%n_writers) / npes
      call MPI_Comm_split(MPI_COMM_WORLD, color, 0, gather_comm, status)
      _VERIFY(status)
      
      call MPI_Comm_rank(gather_comm, rank, status)
      _VERIFY(status)
      call MPI_Comm_split(MPI_COMM_WORLD, rank, 0, writer_comm, status)
      _VERIFY(status)
      if (rank /= 0) then
         writer_comm = MPI_COMM_NULL
      end if

      kernel = make_GathervKernel(spec, gather_comm, _RC)
      if (rank == 0) then
         benchmark = make_BW_Benchmark(spec, writer_comm, _RC)
      end if

      call write_header(MPI_COMM_WORLD, _RC)

      tot_time = 0
      tot_time_gather = 0
      tot_time_write = 0
      associate (n => spec%n_tries)
        do i = 1, n
           ta = time(kernel, gather_comm, _RC)
           if (writer_comm /= MPI_COMM_NULL) then
              tb = time(benchmark, writer_comm, _RC)
           end if
           tot_time_gather = tot_time_gather + ta
           tot_time_write = tot_time_write + tb
           tot_time = tot_time + ta + tb
        end do
        avg_time = tot_time / n
        avg_time_gather = tot_time_gather / n
        avg_time_write = tot_time_write / n

      end associate

      call report(spec, avg_time, avg_time_gather, avg_time_write, MPI_COMM_WORLD, _RC)

      _RETURN(_SUCCESS)
   end subroutine run