flow_allgather_owned_matrix_inplace Subroutine

public subroutine flow_allgather_owned_matrix_inplace(flow, field)

Uses

  • proc~~flow_allgather_owned_matrix_inplace~~UsesGraph proc~flow_allgather_owned_matrix_inplace mod_mpi_flow::flow_allgather_owned_matrix_inplace module~mod_profiler mod_profiler proc~flow_allgather_owned_matrix_inplace->module~mod_profiler iso_fortran_env iso_fortran_env module~mod_profiler->iso_fortran_env module~mod_kinds mod_kinds module~mod_profiler->module~mod_kinds mpi_f08 mpi_f08 module~mod_profiler->mpi_f08 module~mod_kinds->iso_fortran_env

In-place variant for fields that already hold owned-cell updates.

Arguments

Type IntentOptional Attributes Name
type(flow_mpi_t), intent(inout) :: flow
real(kind=rk), intent(inout) :: field(:,:)

Calls

proc~~flow_allgather_owned_matrix_inplace~~CallsGraph proc~flow_allgather_owned_matrix_inplace mod_mpi_flow::flow_allgather_owned_matrix_inplace mpi_allgatherv mpi_allgatherv proc~flow_allgather_owned_matrix_inplace->mpi_allgatherv proc~check_mpi~2 mod_mpi_flow::check_mpi proc~flow_allgather_owned_matrix_inplace->proc~check_mpi~2 proc~prepare_matrix_gather mod_mpi_flow::prepare_matrix_gather proc~flow_allgather_owned_matrix_inplace->proc~prepare_matrix_gather proc~profiler_start mod_profiler::profiler_start proc~flow_allgather_owned_matrix_inplace->proc~profiler_start proc~profiler_stop mod_profiler::profiler_stop proc~flow_allgather_owned_matrix_inplace->proc~profiler_stop proc~fatal_error mod_kinds::fatal_error proc~check_mpi~2->proc~fatal_error proc~prepare_matrix_gather->proc~fatal_error mpi_wtime mpi_wtime proc~profiler_start->mpi_wtime proc~find_or_create_timer mod_profiler::find_or_create_timer proc~profiler_start->proc~find_or_create_timer proc~profiler_stop->mpi_wtime proc~profiler_stop->proc~find_or_create_timer proc~record_edge mod_profiler::record_edge proc~profiler_stop->proc~record_edge

Source Code

   subroutine flow_allgather_owned_matrix_inplace(flow, field)
      use mod_profiler, only : profiler_start, profiler_stop
      type(flow_mpi_t), intent(inout) :: flow
      real(rk), intent(inout) :: field(:,:)
      integer :: ierr, ncomp, ncells, nlocal_comp
      integer :: c, k, r, first, pos, recv_pos

      ncomp = size(field, 1)
      ncells = size(field, 2)

      call prepare_matrix_gather(flow, ncomp, ncells, nlocal_comp)

      pos = 0
      do c = flow%first_cell, flow%last_cell
         do k = 1, ncomp
            pos = pos + 1
            flow%gather_matrix_sendbuf(pos) = field(k, c)
         end do
      end do

      call profiler_start('MPI_Communication')
      call MPI_Allgatherv(flow%gather_matrix_sendbuf, nlocal_comp, MPI_DOUBLE_PRECISION, &
                          flow%gather_matrix_recvbuf, flow%gather_matrix_counts, &
                          flow%gather_matrix_displs, MPI_DOUBLE_PRECISION, flow%comm, ierr)
      call check_mpi(ierr, 'MPI_Allgatherv owned matrix inplace')
      call profiler_stop('MPI_Communication')

      field = zero

      do r = 1, flow%nprocs
         first = flow%gather_firsts(r)
         recv_pos = flow%gather_matrix_displs(r)

         do c = first, first + flow%gather_counts(r) - 1
            do k = 1, ncomp
               recv_pos = recv_pos + 1
               field(k, c) = flow%gather_matrix_recvbuf(recv_pos)
            end do
         end do
      end do
   end subroutine flow_allgather_owned_matrix_inplace