run Subroutine

subroutine run(spec, rc)

Arguments

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

Calls

proc~~run~25~~CallsGraph proc~run~25 run mpi_comm_rank mpi_comm_rank proc~run~25->mpi_comm_rank mpi_comm_size mpi_comm_size proc~run~25->mpi_comm_size mpi_comm_split mpi_comm_split proc~run~25->mpi_comm_split proc~make_gathervkernel make_GathervKernel proc~run~25->proc~make_gathervkernel proc~mapl_return MAPL_Return proc~run~25->proc~mapl_return proc~mapl_verify MAPL_Verify proc~run~25->proc~mapl_verify proc~report~2 report proc~run~25->proc~report~2 proc~write_header~2 write_header proc~run~25->proc~write_header~2 proc~make_gathervkernel->mpi_comm_size proc~make_gathervkernel->proc~mapl_return proc~make_gathervkernel->proc~mapl_verify none~init~6 GathervKernel%init proc~make_gathervkernel->none~init~6 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~2->mpi_comm_rank proc~report~2->mpi_comm_size proc~report~2->proc~mapl_return proc~report~2->proc~mapl_verify proc~write_header~2->mpi_comm_rank proc~write_header~2->proc~mapl_return proc~write_header~2->proc~mapl_verify none~init~6->mpi_comm_rank none~init~6->mpi_comm_size none~init~6->proc~mapl_return none~init~6->proc~mapl_verify interface~mapl_assert MAPL_Assert none~init~6->interface~mapl_assert

Called by

proc~~run~25~~CalledByGraph proc~run~25 run program~main~13 main program~main~13->proc~run~25

Source Code

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

      integer :: status

      real :: tot_time
      real :: tot_time_sq
      real :: avg_time
      real :: rel_std_time
      type(GathervKernel) :: kernel
      integer :: writer_comm
      integer :: gather_comm
      integer :: i
      real :: t

      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)

      kernel = make_GathervKernel(spec, gather_comm, _RC)

      call write_header(MPI_COMM_WORLD, _RC)

      tot_time = 0
      tot_time_sq = 0
      associate (n => spec%n_tries)
        do i = 1, n
           t = time(kernel, writer_comm, _RC)
           tot_time = tot_time + t
           tot_time_sq = tot_time_sq + t**2
        end do
        avg_time = tot_time / n

        rel_std_time = -1 ! unless
        if (n > 1) then
           rel_std_time = sqrt((tot_time_sq - spec%n_tries*avg_time**2)/(n-1))/avg_time
        end if
      end associate

      call report(spec, avg_time, rel_std_time, MPI_COMM_WORLD, _RC)

      _RETURN(_SUCCESS)
   end subroutine run