Launch persistent communications associated with redistribute. Packs send buffer.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(redist_type), | intent(inout) | :: | r | |||
complex, | intent(in), | dimension ( r%to_low(1):, r%to_low(2): ) | :: | from_here |
subroutine c_redist_22_inv_mpi_copy_persist_start(r, from_here)
use mp, only: start_comm
implicit none
type (redist_type), intent (in out) :: r
complex, dimension ( &
r%to_low(1):, &
r%to_low(2): &
), intent (in) :: from_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
!Post receives
nrecv = r%nsend
if (nrecv > 0) then
call start_comm(r%recv_inv_hand)
endif
!Pack send buffer and start sends
nsend = r%nrecv
if (nsend > 0) then
!$OMP PARALLEL DEFAULT(none) &
!$OMP PRIVATE(i, ip, nn, j) &
!$OMP SHARED(nsend, r, from_here)
do i = 1, nsend
ip = r%recv_ip(i)
nn = r%to(ip)%nn
!Any benefit in making this a pointer assignment instead?
!Avoids copying data here but could lead to questionable
!memory access during the actual send?
!$OMP DO &
!$OMP SCHEDULE(static)
do j = 1, nn
r%buff_recv(i)%complex_buffer(j) = from_here( &
r%to(ip)%k(j), &
r%to(ip)%l(j) &
)
end do
!$OMP END DO
!$OMP MASTER
call start_comm(r%send_inv_hand(i))
!$OMP END MASTER
end do
!$OMP END PARALLEL
end if
end subroutine c_redist_22_inv_mpi_copy_persist_start