Report the actually existing elements, which were requested as halos from remote
first report the number of actual halos
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_communication_type), | intent(in) | :: | sendbuffer |
send buffer |
||
type(tem_communication_type), | intent(inout) | :: | recvbuffer |
recv buffer |
||
integer, | intent(in) | :: | comm |
MPI communicator |
subroutine return_haloCounts( sendbuffer, recvbuffer, comm ) ! --------------------------------------------------------------------------- !> send buffer type(tem_communication_type), intent(in) :: sendbuffer !> recv buffer type(tem_communication_type), intent(inout) :: recvbuffer !> MPI communicator integer, intent(in) :: comm ! --------------------------------------------------------------------------- integer :: iProc ! process iterator integer :: iErr ! error flag integer, parameter :: message_tag = 23 ! arbitrary message flag integer, allocatable :: rq_handle(:) integer, allocatable :: status(:,:) integer :: nCommunications ! amount of communciations ! --------------------------------------------------------------------------- nCommunications = sendbuffer%nProcs + recvbuffer%nProcs allocate( rq_handle( nCommunications ) ) allocate( status( mpi_status_size, nCommunications ) ) ! --------------------------------------------------------------------- !! first report the number of actual halos rq_handle(:) = MPI_REQUEST_NULL do iProc = 1, recvbuffer%nProcs ! Receive the number of actual elements call mpi_irecv( recvbuffer%nElemsProc( iProc ), & & 1, & & mpi_integer, & & recvbuffer%proc(iProc), & & message_tag, & & comm, & & rq_handle(iProc), & & iErr ) end do ! iProc ! I send the number of actual existing halo elements to the requester. do iProc = 1, sendbuffer%nProcs call mpi_isend( sendbuffer%nElemsProc( iProc ), & & 1, & & mpi_integer, & & sendbuffer%proc( iProc ), & & message_tag, & & comm, & & rq_handle(iProc + recvbuffer%nProcs), & & iErr ) end do ! iProc call mpi_waitall( nCommunications, rq_handle, status, iErr) ! Now we know the number of how actually existent cells, to receive ! allocate the recv buffers and communicate ! --------------------------------------------------------------------- end subroutine return_haloCounts