Finish persistent communications associated with redistribute. Unpacks receive buffer.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(redist_type), | intent(inout) | :: | r | |||
complex, | intent(inout), | dimension ( r%from_low(1):, r%from_low(2):, r%from_low(3): ) | :: | to_here |
subroutine c_redist_33_inv_mpi_copy_persist_end(r, to_here)
use mp, only: waitall
implicit none
type (redist_type), intent (in out) :: r
complex, dimension ( &
r%from_low(1):, &
r%from_low(2):, &
r%from_low(3): &
), intent (in out) :: to_here
integer :: i, ip, nn, nrecv, nsend, j
!For inverse transform SEND actually refers to received data and
!RECV refers to data to be sent
!Wait for receives to complete and unpack data
nrecv = r%nsend
if (nrecv > 0) then
call waitall(nrecv, r%recv_inv_hand)
!Now unpack data
!$OMP PARALLEL DEFAULT(none) &
!$OMP PRIVATE(i, ip, nn, j) &
!$OMP SHARED(nrecv, r, to_here)
do i = 1, nrecv
!Which processor is this data from
ip = r%recv_inv_ip(i)
nn = r%from(ip)%nn
!$OMP DO &
!$OMP SCHEDULE(static)
do j = 1, nn
to_here( &
r%from(ip)%k(j), &
r%from(ip)%l(j), &
r%from(ip)%m(j) &
) = r%buff_send(i)%complex_buffer(j)
end do
!$OMP END DO NOWAIT
end do
!$OMP END PARALLEL
end if
!Wait for sends to complete
nsend = r%nrecv
if (nsend > 0) then
call waitall(nsend, r%send_inv_hand)
end if
end subroutine c_redist_33_inv_mpi_copy_persist_end