|
|
@ -1,26 +1,27 @@
|
|
|
|
subroutine psi_dswaptranm(flag,n,beta,y,desc_a,work,info)
|
|
|
|
subroutine psi_dswaptranm(flag,n,beta,y,desc_a,work,info,data)
|
|
|
|
|
|
|
|
|
|
|
|
use psb_error_mod
|
|
|
|
use psb_error_mod
|
|
|
|
use psb_descriptor_type
|
|
|
|
use psb_descriptor_type
|
|
|
|
|
|
|
|
use mpi
|
|
|
|
implicit none
|
|
|
|
implicit none
|
|
|
|
include 'mpif.h'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
integer, intent(in) :: flag, n
|
|
|
|
integer, intent(in) :: flag, n
|
|
|
|
integer, intent(out) :: info
|
|
|
|
integer, intent(out) :: info
|
|
|
|
real(kind(1.d0)) :: y(:,:), beta
|
|
|
|
real(kind(1.d0)) :: y(:,:), beta
|
|
|
|
real(kind(1.d0)), target :: work(:)
|
|
|
|
real(kind(1.d0)), target :: work(:)
|
|
|
|
type(psb_desc_type) :: desc_a
|
|
|
|
type(psb_desc_type) :: desc_a
|
|
|
|
|
|
|
|
integer, optional :: data
|
|
|
|
|
|
|
|
|
|
|
|
! locals
|
|
|
|
! locals
|
|
|
|
integer :: icontxt, nprow, npcol, myrow,&
|
|
|
|
integer :: icontxt, nprow, npcol, myrow,&
|
|
|
|
& mycol, point_to_proc, nesd, nerv,&
|
|
|
|
& mycol, point_to_proc, nesd, nerv,&
|
|
|
|
& proc_to_comm, p2ptag, icomm, p2pstat,&
|
|
|
|
& proc_to_comm, p2ptag, icomm, p2pstat(mpi_status_size),&
|
|
|
|
& idxs, idxr, iret, errlen, ifcomm, rank,&
|
|
|
|
& idxs, idxr, iret, errlen, ifcomm, rank,&
|
|
|
|
& err_act, totxch, ixrec, i, lw, idx_pt,&
|
|
|
|
& err_act, totxch, ixrec, i, lw, idx_pt,&
|
|
|
|
& snd_pt, rcv_pt
|
|
|
|
& snd_pt, rcv_pt
|
|
|
|
|
|
|
|
|
|
|
|
integer, pointer, dimension(:) :: bsdidx, brvidx,&
|
|
|
|
integer, pointer, dimension(:) :: bsdidx, brvidx,&
|
|
|
|
& sdsz, rvsz, prcid, ptp, rvhd, h_idx
|
|
|
|
& sdsz, rvsz, prcid, ptp, rvhd, d_idx
|
|
|
|
integer :: int_err(5)
|
|
|
|
integer :: int_err(5)
|
|
|
|
integer :: blacs_pnum, krecvid, ksendid
|
|
|
|
integer :: blacs_pnum, krecvid, ksendid
|
|
|
|
logical :: swap_mpi, swap_sync, swap_send, swap_recv
|
|
|
|
logical :: swap_mpi, swap_sync, swap_send, swap_recv
|
|
|
@ -96,7 +97,19 @@ subroutine psi_dswaptranm(flag,n,beta,y,desc_a,work,info)
|
|
|
|
swap_sync = iand(flag,psb_swap_sync_).ne.0
|
|
|
|
swap_sync = iand(flag,psb_swap_sync_).ne.0
|
|
|
|
swap_send = iand(flag,psb_swap_send_).ne.0
|
|
|
|
swap_send = iand(flag,psb_swap_send_).ne.0
|
|
|
|
swap_recv = iand(flag,psb_swap_recv_).ne.0
|
|
|
|
swap_recv = iand(flag,psb_swap_recv_).ne.0
|
|
|
|
h_idx => desc_a%halo_index
|
|
|
|
|
|
|
|
|
|
|
|
if(present(data)) then
|
|
|
|
|
|
|
|
if(data.eq.psb_comm_halo_) then
|
|
|
|
|
|
|
|
d_idx => desc_a%halo_index
|
|
|
|
|
|
|
|
else if(data.eq.psb_comm_ovr_) then
|
|
|
|
|
|
|
|
d_idx => desc_a%ovrlap_index
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
d_idx => desc_a%halo_index
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
d_idx => desc_a%halo_index
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
|
|
idxs = 0
|
|
|
|
idxs = 0
|
|
|
|
idxr = 0
|
|
|
|
idxr = 0
|
|
|
|
totxch = 0
|
|
|
|
totxch = 0
|
|
|
@ -104,11 +117,11 @@ subroutine psi_dswaptranm(flag,n,beta,y,desc_a,work,info)
|
|
|
|
rvhd(:) = mpi_request_null
|
|
|
|
rvhd(:) = mpi_request_null
|
|
|
|
|
|
|
|
|
|
|
|
! prepare info for communications
|
|
|
|
! prepare info for communications
|
|
|
|
proc_to_comm = h_idx(point_to_proc+psb_proc_id_)
|
|
|
|
proc_to_comm = d_idx(point_to_proc+psb_proc_id_)
|
|
|
|
do while (proc_to_comm.ne.-1)
|
|
|
|
do while (proc_to_comm.ne.-1)
|
|
|
|
if(proc_to_comm .ne. myrow) totxch = totxch+1
|
|
|
|
if(proc_to_comm .ne. myrow) totxch = totxch+1
|
|
|
|
nerv = h_idx(point_to_proc+psb_n_elem_recv_)
|
|
|
|
nerv = d_idx(point_to_proc+psb_n_elem_recv_)
|
|
|
|
nesd = h_idx(point_to_proc+nerv+psb_n_elem_send_)
|
|
|
|
nesd = d_idx(point_to_proc+nerv+psb_n_elem_send_)
|
|
|
|
|
|
|
|
|
|
|
|
prcid(proc_to_comm) = blacs_pnum(icontxt,proc_to_comm,mycol)
|
|
|
|
prcid(proc_to_comm) = blacs_pnum(icontxt,proc_to_comm,mycol)
|
|
|
|
ptp(proc_to_comm) = point_to_proc
|
|
|
|
ptp(proc_to_comm) = point_to_proc
|
|
|
@ -122,7 +135,7 @@ subroutine psi_dswaptranm(flag,n,beta,y,desc_a,work,info)
|
|
|
|
idxs = idxs+sdsz(proc_to_comm)
|
|
|
|
idxs = idxs+sdsz(proc_to_comm)
|
|
|
|
|
|
|
|
|
|
|
|
point_to_proc = point_to_proc+nerv+nesd+3
|
|
|
|
point_to_proc = point_to_proc+nerv+nesd+3
|
|
|
|
proc_to_comm = h_idx(point_to_proc+psb_proc_id_)
|
|
|
|
proc_to_comm = d_idx(point_to_proc+psb_proc_id_)
|
|
|
|
end do
|
|
|
|
end do
|
|
|
|
|
|
|
|
|
|
|
|
if((idxr+idxs).lt.size(work)) then
|
|
|
|
if((idxr+idxs).lt.size(work)) then
|
|
|
@ -141,18 +154,19 @@ subroutine psi_dswaptranm(flag,n,beta,y,desc_a,work,info)
|
|
|
|
|
|
|
|
|
|
|
|
! gather elements into sendbuffer for swapping
|
|
|
|
! gather elements into sendbuffer for swapping
|
|
|
|
point_to_proc = 1
|
|
|
|
point_to_proc = 1
|
|
|
|
proc_to_comm = h_idx(point_to_proc+psb_proc_id_)
|
|
|
|
proc_to_comm = d_idx(point_to_proc+psb_proc_id_)
|
|
|
|
do while (proc_to_comm .ne. -1)
|
|
|
|
do while (proc_to_comm .ne. -1)
|
|
|
|
nerv = h_idx(point_to_proc+psb_n_elem_recv_)
|
|
|
|
nerv = d_idx(point_to_proc+psb_n_elem_recv_)
|
|
|
|
nesd = h_idx(point_to_proc+nerv+psb_n_elem_send_)
|
|
|
|
nesd = d_idx(point_to_proc+nerv+psb_n_elem_send_)
|
|
|
|
|
|
|
|
|
|
|
|
idx_pt = point_to_proc+psb_elem_recv_
|
|
|
|
idx_pt = point_to_proc+psb_elem_recv_
|
|
|
|
rcv_pt = brvidx(proc_to_comm)
|
|
|
|
rcv_pt = brvidx(proc_to_comm)
|
|
|
|
call psi_gth(nerv,n,h_idx(idx_pt:idx_pt+nerv-1),&
|
|
|
|
|
|
|
|
|
|
|
|
call psi_gth(nerv,n,d_idx(idx_pt:idx_pt+nerv-1),&
|
|
|
|
& y,rcvbuf(rcv_pt:rcv_pt+nerv*n-1))
|
|
|
|
& y,rcvbuf(rcv_pt:rcv_pt+nerv*n-1))
|
|
|
|
|
|
|
|
|
|
|
|
point_to_proc = point_to_proc+nerv+nesd+3
|
|
|
|
point_to_proc = point_to_proc+nerv+nesd+3
|
|
|
|
proc_to_comm = h_idx(point_to_proc+psb_proc_id_)
|
|
|
|
proc_to_comm = d_idx(point_to_proc+psb_proc_id_)
|
|
|
|
end do
|
|
|
|
end do
|
|
|
|
|
|
|
|
|
|
|
|
! swap elements using mpi_alltoallv
|
|
|
|
! swap elements using mpi_alltoallv
|
|
|
@ -168,32 +182,32 @@ subroutine psi_dswaptranm(flag,n,beta,y,desc_a,work,info)
|
|
|
|
|
|
|
|
|
|
|
|
! scatter elements from receivebuffer after swapping
|
|
|
|
! scatter elements from receivebuffer after swapping
|
|
|
|
point_to_proc = 1
|
|
|
|
point_to_proc = 1
|
|
|
|
proc_to_comm = h_idx(point_to_proc+psb_proc_id_)
|
|
|
|
proc_to_comm = d_idx(point_to_proc+psb_proc_id_)
|
|
|
|
do while (proc_to_comm .ne. -1)
|
|
|
|
do while (proc_to_comm .ne. -1)
|
|
|
|
nerv = h_idx(point_to_proc+psb_n_elem_recv_)
|
|
|
|
nerv = d_idx(point_to_proc+psb_n_elem_recv_)
|
|
|
|
nesd = h_idx(point_to_proc+nerv+psb_n_elem_send_)
|
|
|
|
nesd = d_idx(point_to_proc+nerv+psb_n_elem_send_)
|
|
|
|
|
|
|
|
|
|
|
|
idx_pt = point_to_proc+nerv+psb_elem_send_
|
|
|
|
idx_pt = point_to_proc+nerv+psb_elem_send_
|
|
|
|
snd_pt = bsdidx(proc_to_comm)
|
|
|
|
snd_pt = bsdidx(proc_to_comm)
|
|
|
|
call psi_sct(nesd,n,h_idx(idx_pt:idx_pt+nesd-1),&
|
|
|
|
call psi_sct(nesd,n,d_idx(idx_pt:idx_pt+nesd-1),&
|
|
|
|
& sndbuf(snd_pt:snd_pt+n*nesd-1),beta,y)
|
|
|
|
& sndbuf(snd_pt:snd_pt+n*nesd-1),beta,y)
|
|
|
|
|
|
|
|
|
|
|
|
point_to_proc = point_to_proc+nerv+nesd+3
|
|
|
|
point_to_proc = point_to_proc+nerv+nesd+3
|
|
|
|
proc_to_comm = h_idx(point_to_proc+psb_proc_id_)
|
|
|
|
proc_to_comm = d_idx(point_to_proc+psb_proc_id_)
|
|
|
|
end do
|
|
|
|
end do
|
|
|
|
|
|
|
|
|
|
|
|
else if (swap_sync) then
|
|
|
|
else if (swap_sync) then
|
|
|
|
|
|
|
|
|
|
|
|
point_to_proc = 1
|
|
|
|
point_to_proc = 1
|
|
|
|
proc_to_comm = h_idx(point_to_proc+psb_proc_id_)
|
|
|
|
proc_to_comm = d_idx(point_to_proc+psb_proc_id_)
|
|
|
|
do while (proc_to_comm .ne. -1)
|
|
|
|
do while (proc_to_comm .ne. -1)
|
|
|
|
nerv = h_idx(point_to_proc+psb_n_elem_recv_)
|
|
|
|
nerv = d_idx(point_to_proc+psb_n_elem_recv_)
|
|
|
|
nesd = h_idx(point_to_proc+nerv+psb_n_elem_send_)
|
|
|
|
nesd = d_idx(point_to_proc+nerv+psb_n_elem_send_)
|
|
|
|
if (proc_to_comm .lt. myrow) then
|
|
|
|
if (proc_to_comm .lt. myrow) then
|
|
|
|
! First I send
|
|
|
|
! First I send
|
|
|
|
idx_pt = point_to_proc+psb_elem_recv_
|
|
|
|
idx_pt = point_to_proc+psb_elem_recv_
|
|
|
|
rcv_pt = brvidx(proc_to_comm)
|
|
|
|
rcv_pt = brvidx(proc_to_comm)
|
|
|
|
call psi_gth(nerv,n,h_idx(idx_pt:idx_pt+nerv-1),&
|
|
|
|
call psi_gth(nerv,n,d_idx(idx_pt:idx_pt+nerv-1),&
|
|
|
|
& y,rcvbuf(rcv_pt:rcv_pt+nerv*n-1))
|
|
|
|
& y,rcvbuf(rcv_pt:rcv_pt+nerv*n-1))
|
|
|
|
call dgesd2d(icontxt,nerv,n,rcvbuf(rcv_pt),nerv,proc_to_comm,0)
|
|
|
|
call dgesd2d(icontxt,nerv,n,rcvbuf(rcv_pt),nerv,proc_to_comm,0)
|
|
|
|
! Then I receive
|
|
|
|
! Then I receive
|
|
|
@ -206,51 +220,51 @@ subroutine psi_dswaptranm(flag,n,beta,y,desc_a,work,info)
|
|
|
|
! Then I send
|
|
|
|
! Then I send
|
|
|
|
idx_pt = point_to_proc+psb_elem_recv_
|
|
|
|
idx_pt = point_to_proc+psb_elem_recv_
|
|
|
|
rcv_pt = brvidx(proc_to_comm)
|
|
|
|
rcv_pt = brvidx(proc_to_comm)
|
|
|
|
call psi_gth(nerv,n,h_idx(idx_pt:idx_pt+nerv-1),&
|
|
|
|
call psi_gth(nerv,n,d_idx(idx_pt:idx_pt+nerv-1),&
|
|
|
|
& y,rcvbuf(rcv_pt:rcv_pt+nerv*n-1))
|
|
|
|
& y,rcvbuf(rcv_pt:rcv_pt+nerv*n-1))
|
|
|
|
call dgesd2d(icontxt,nerv,n,rcvbuf(rcv_pt),nerv,proc_to_comm,0)
|
|
|
|
call dgesd2d(icontxt,nerv,n,rcvbuf(rcv_pt),nerv,proc_to_comm,0)
|
|
|
|
else if (proc_to_comm .eq. myrow) then
|
|
|
|
else if (proc_to_comm .eq. myrow) then
|
|
|
|
! I send to myself
|
|
|
|
! I send to myself
|
|
|
|
idx_pt = point_to_proc+psb_elem_recv_
|
|
|
|
idx_pt = point_to_proc+psb_elem_recv_
|
|
|
|
rcv_pt = bsdidx(proc_to_comm)
|
|
|
|
rcv_pt = bsdidx(proc_to_comm)
|
|
|
|
call psi_gth(nerv,n,h_idx(idx_pt:idx_pt+nerv-1),&
|
|
|
|
call psi_gth(nerv,n,d_idx(idx_pt:idx_pt+nerv-1),&
|
|
|
|
& y,rcvbuf(rcv_pt:rcv_pt+nerv*n-1))
|
|
|
|
& y,rcvbuf(rcv_pt:rcv_pt+nerv*n-1))
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
|
|
point_to_proc = point_to_proc+nerv+nesd+3
|
|
|
|
point_to_proc = point_to_proc+nerv+nesd+3
|
|
|
|
proc_to_comm = h_idx(point_to_proc+psb_proc_id_)
|
|
|
|
proc_to_comm = d_idx(point_to_proc+psb_proc_id_)
|
|
|
|
end do
|
|
|
|
end do
|
|
|
|
|
|
|
|
|
|
|
|
point_to_proc = 1
|
|
|
|
point_to_proc = 1
|
|
|
|
proc_to_comm = h_idx(point_to_proc+psb_proc_id_)
|
|
|
|
proc_to_comm = d_idx(point_to_proc+psb_proc_id_)
|
|
|
|
do while (proc_to_comm .ne. -1)
|
|
|
|
do while (proc_to_comm .ne. -1)
|
|
|
|
nerv = h_idx(point_to_proc+psb_n_elem_recv_)
|
|
|
|
nerv = d_idx(point_to_proc+psb_n_elem_recv_)
|
|
|
|
nesd = h_idx(point_to_proc+nerv+psb_n_elem_send_)
|
|
|
|
nesd = d_idx(point_to_proc+nerv+psb_n_elem_send_)
|
|
|
|
|
|
|
|
|
|
|
|
if(proc_to_comm.ne.myrow) then
|
|
|
|
if(proc_to_comm.ne.myrow) then
|
|
|
|
idx_pt = point_to_proc+nerv+psb_elem_send_
|
|
|
|
idx_pt = point_to_proc+nerv+psb_elem_send_
|
|
|
|
snd_pt = bsdidx(proc_to_comm)
|
|
|
|
snd_pt = bsdidx(proc_to_comm)
|
|
|
|
call psi_sct(nesd,n,h_idx(idx_pt:idx_pt+nesd-1),&
|
|
|
|
call psi_sct(nesd,n,d_idx(idx_pt:idx_pt+nesd-1),&
|
|
|
|
& sndbuf(snd_pt:snd_pt+n*nesd-1),beta,y)
|
|
|
|
& sndbuf(snd_pt:snd_pt+n*nesd-1),beta,y)
|
|
|
|
else
|
|
|
|
else
|
|
|
|
idx_pt = point_to_proc+nerv+psb_elem_send_
|
|
|
|
idx_pt = point_to_proc+nerv+psb_elem_send_
|
|
|
|
rcv_pt = brvidx(proc_to_comm)
|
|
|
|
rcv_pt = brvidx(proc_to_comm)
|
|
|
|
call psi_sct(nesd,n,h_idx(idx_pt:idx_pt+nesd-1),&
|
|
|
|
call psi_sct(nesd,n,d_idx(idx_pt:idx_pt+nesd-1),&
|
|
|
|
& rcvbuf(rcv_pt:rcv_pt+n*nerv-1),beta,y)
|
|
|
|
& rcvbuf(rcv_pt:rcv_pt+n*nerv-1),beta,y)
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
|
|
point_to_proc = point_to_proc+nerv+nesd+3
|
|
|
|
point_to_proc = point_to_proc+nerv+nesd+3
|
|
|
|
proc_to_comm = h_idx(point_to_proc+psb_proc_id_)
|
|
|
|
proc_to_comm = d_idx(point_to_proc+psb_proc_id_)
|
|
|
|
end do
|
|
|
|
end do
|
|
|
|
|
|
|
|
|
|
|
|
else if (swap_send .and. swap_recv) then
|
|
|
|
else if (swap_send .and. swap_recv) then
|
|
|
|
|
|
|
|
|
|
|
|
! First I post all the non blocking receives
|
|
|
|
! First I post all the non blocking receives
|
|
|
|
point_to_proc = 1
|
|
|
|
point_to_proc = 1
|
|
|
|
proc_to_comm = h_idx(point_to_proc+psb_proc_id_)
|
|
|
|
proc_to_comm = d_idx(point_to_proc+psb_proc_id_)
|
|
|
|
do while (proc_to_comm .ne. -1)
|
|
|
|
do while (proc_to_comm .ne. -1)
|
|
|
|
nerv = h_idx(point_to_proc+psb_n_elem_recv_)
|
|
|
|
nerv = d_idx(point_to_proc+psb_n_elem_recv_)
|
|
|
|
nesd = h_idx(point_to_proc+nerv+psb_n_elem_send_)
|
|
|
|
nesd = d_idx(point_to_proc+nerv+psb_n_elem_send_)
|
|
|
|
|
|
|
|
|
|
|
|
if(proc_to_comm.ne.myrow) then
|
|
|
|
if(proc_to_comm.ne.myrow) then
|
|
|
|
p2ptag = krecvid(icontxt,proc_to_comm,myrow)
|
|
|
|
p2ptag = krecvid(icontxt,proc_to_comm,myrow)
|
|
|
@ -267,19 +281,19 @@ subroutine psi_dswaptranm(flag,n,beta,y,desc_a,work,info)
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
|
|
point_to_proc = point_to_proc+nerv+nesd+3
|
|
|
|
point_to_proc = point_to_proc+nerv+nesd+3
|
|
|
|
proc_to_comm = h_idx(point_to_proc+psb_proc_id_)
|
|
|
|
proc_to_comm = d_idx(point_to_proc+psb_proc_id_)
|
|
|
|
end do
|
|
|
|
end do
|
|
|
|
|
|
|
|
|
|
|
|
! Then I post all the blocking sends
|
|
|
|
! Then I post all the blocking sends
|
|
|
|
point_to_proc = 1
|
|
|
|
point_to_proc = 1
|
|
|
|
proc_to_comm = h_idx(point_to_proc+psb_proc_id_)
|
|
|
|
proc_to_comm = d_idx(point_to_proc+psb_proc_id_)
|
|
|
|
do while (proc_to_comm .ne. -1)
|
|
|
|
do while (proc_to_comm .ne. -1)
|
|
|
|
nerv = h_idx(point_to_proc+psb_n_elem_recv_)
|
|
|
|
nerv = d_idx(point_to_proc+psb_n_elem_recv_)
|
|
|
|
nesd = h_idx(point_to_proc+nerv+psb_n_elem_send_)
|
|
|
|
nesd = d_idx(point_to_proc+nerv+psb_n_elem_send_)
|
|
|
|
|
|
|
|
|
|
|
|
idx_pt = point_to_proc+psb_elem_recv_
|
|
|
|
idx_pt = point_to_proc+psb_elem_recv_
|
|
|
|
rcv_pt = brvidx(proc_to_comm)
|
|
|
|
rcv_pt = brvidx(proc_to_comm)
|
|
|
|
call psi_gth(nerv,n,h_idx(idx_pt:idx_pt+nerv-1),&
|
|
|
|
call psi_gth(nerv,n,d_idx(idx_pt:idx_pt+nerv-1),&
|
|
|
|
& y,rcvbuf(rcv_pt:rcv_pt+nerv*n-1))
|
|
|
|
& y,rcvbuf(rcv_pt:rcv_pt+nerv*n-1))
|
|
|
|
|
|
|
|
|
|
|
|
if(proc_to_comm .ne. myrow) then
|
|
|
|
if(proc_to_comm .ne. myrow) then
|
|
|
@ -295,7 +309,7 @@ subroutine psi_dswaptranm(flag,n,beta,y,desc_a,work,info)
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
point_to_proc = point_to_proc+nerv+nesd+3
|
|
|
|
point_to_proc = point_to_proc+nerv+nesd+3
|
|
|
|
proc_to_comm = h_idx(point_to_proc+psb_proc_id_)
|
|
|
|
proc_to_comm = d_idx(point_to_proc+psb_proc_id_)
|
|
|
|
end do
|
|
|
|
end do
|
|
|
|
|
|
|
|
|
|
|
|
do i=1, totxch
|
|
|
|
do i=1, totxch
|
|
|
@ -310,13 +324,13 @@ subroutine psi_dswaptranm(flag,n,beta,y,desc_a,work,info)
|
|
|
|
if (ixrec .ne. mpi_undefined) then
|
|
|
|
if (ixrec .ne. mpi_undefined) then
|
|
|
|
ixrec=ixrec-1 ! mpi_waitany returns an 1 to nprow index
|
|
|
|
ixrec=ixrec-1 ! mpi_waitany returns an 1 to nprow index
|
|
|
|
point_to_proc = ptp(ixrec)
|
|
|
|
point_to_proc = ptp(ixrec)
|
|
|
|
proc_to_comm = h_idx(point_to_proc+psb_proc_id_)
|
|
|
|
proc_to_comm = d_idx(point_to_proc+psb_proc_id_)
|
|
|
|
nerv = h_idx(point_to_proc+psb_n_elem_recv_)
|
|
|
|
nerv = d_idx(point_to_proc+psb_n_elem_recv_)
|
|
|
|
nesd = h_idx(point_to_proc+nerv+psb_n_elem_send_)
|
|
|
|
nesd = d_idx(point_to_proc+nerv+psb_n_elem_send_)
|
|
|
|
|
|
|
|
|
|
|
|
idx_pt = point_to_proc+nerv+psb_elem_send_
|
|
|
|
idx_pt = point_to_proc+nerv+psb_elem_send_
|
|
|
|
snd_pt = bsdidx(proc_to_comm)
|
|
|
|
snd_pt = bsdidx(proc_to_comm)
|
|
|
|
call psi_sct(nesd,n,h_idx(idx_pt:idx_pt+nesd-1),&
|
|
|
|
call psi_sct(nesd,n,d_idx(idx_pt:idx_pt+nesd-1),&
|
|
|
|
& sndbuf(snd_pt:snd_pt+n*nesd-1),beta,y)
|
|
|
|
& sndbuf(snd_pt:snd_pt+n*nesd-1),beta,y)
|
|
|
|
else
|
|
|
|
else
|
|
|
|
int_err(1) = ixrec
|
|
|
|
int_err(1) = ixrec
|
|
|
@ -327,63 +341,63 @@ subroutine psi_dswaptranm(flag,n,beta,y,desc_a,work,info)
|
|
|
|
end do
|
|
|
|
end do
|
|
|
|
|
|
|
|
|
|
|
|
point_to_proc = 1
|
|
|
|
point_to_proc = 1
|
|
|
|
proc_to_comm = h_idx(point_to_proc+psb_proc_id_)
|
|
|
|
proc_to_comm = d_idx(point_to_proc+psb_proc_id_)
|
|
|
|
do while (proc_to_comm .ne. -1)
|
|
|
|
do while (proc_to_comm .ne. -1)
|
|
|
|
nerv = h_idx(point_to_proc+psb_n_elem_recv_)
|
|
|
|
nerv = d_idx(point_to_proc+psb_n_elem_recv_)
|
|
|
|
nesd = h_idx(point_to_proc+nerv+psb_n_elem_send_)
|
|
|
|
nesd = d_idx(point_to_proc+nerv+psb_n_elem_send_)
|
|
|
|
|
|
|
|
|
|
|
|
if(proc_to_comm .eq. myrow) then
|
|
|
|
if(proc_to_comm .eq. myrow) then
|
|
|
|
idx_pt = point_to_proc+nerv+psb_elem_send_
|
|
|
|
idx_pt = point_to_proc+nerv+psb_elem_send_
|
|
|
|
rcv_pt = brvidx(proc_to_comm)
|
|
|
|
rcv_pt = brvidx(proc_to_comm)
|
|
|
|
call psi_sct(nesd,n,h_idx(idx_pt:idx_pt+nesd-1),&
|
|
|
|
call psi_sct(nesd,n,d_idx(idx_pt:idx_pt+nesd-1),&
|
|
|
|
& rcvbuf(rcv_pt:rcv_pt+n*nerv-1),beta,y)
|
|
|
|
& rcvbuf(rcv_pt:rcv_pt+n*nerv-1),beta,y)
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
|
|
point_to_proc = point_to_proc+nerv+nesd+3
|
|
|
|
point_to_proc = point_to_proc+nerv+nesd+3
|
|
|
|
proc_to_comm = h_idx(point_to_proc+psb_proc_id_)
|
|
|
|
proc_to_comm = d_idx(point_to_proc+psb_proc_id_)
|
|
|
|
end do
|
|
|
|
end do
|
|
|
|
|
|
|
|
|
|
|
|
else if (swap_send) then
|
|
|
|
else if (swap_send) then
|
|
|
|
|
|
|
|
|
|
|
|
point_to_proc = 1
|
|
|
|
point_to_proc = 1
|
|
|
|
proc_to_comm = h_idx(point_to_proc+psb_proc_id_)
|
|
|
|
proc_to_comm = d_idx(point_to_proc+psb_proc_id_)
|
|
|
|
do while (proc_to_comm .ne. -1)
|
|
|
|
do while (proc_to_comm .ne. -1)
|
|
|
|
nerv = h_idx(point_to_proc+psb_n_elem_recv_)
|
|
|
|
nerv = d_idx(point_to_proc+psb_n_elem_recv_)
|
|
|
|
nesd = h_idx(point_to_proc+nerv+psb_n_elem_send_)
|
|
|
|
nesd = d_idx(point_to_proc+nerv+psb_n_elem_send_)
|
|
|
|
|
|
|
|
|
|
|
|
idx_pt = point_to_proc+psb_elem_recv_
|
|
|
|
idx_pt = point_to_proc+psb_elem_recv_
|
|
|
|
rcv_pt = brvidx(proc_to_comm)
|
|
|
|
rcv_pt = brvidx(proc_to_comm)
|
|
|
|
call psi_gth(nerv,n,h_idx(idx_pt:idx_pt+nerv-1),&
|
|
|
|
call psi_gth(nerv,n,d_idx(idx_pt:idx_pt+nerv-1),&
|
|
|
|
& y,rcvbuf(rcv_pt:rcv_pt+nerv*n-1))
|
|
|
|
& y,rcvbuf(rcv_pt:rcv_pt+nerv*n-1))
|
|
|
|
call dgesd2d(icontxt,nerv,n,rcvbuf(rcv_pt),nerv,proc_to_comm,0)
|
|
|
|
call dgesd2d(icontxt,nerv,n,rcvbuf(rcv_pt),nerv,proc_to_comm,0)
|
|
|
|
|
|
|
|
|
|
|
|
point_to_proc = point_to_proc+nerv+nesd+3
|
|
|
|
point_to_proc = point_to_proc+nerv+nesd+3
|
|
|
|
proc_to_comm = h_idx(point_to_proc+psb_proc_id_)
|
|
|
|
proc_to_comm = d_idx(point_to_proc+psb_proc_id_)
|
|
|
|
end do
|
|
|
|
end do
|
|
|
|
|
|
|
|
|
|
|
|
else if (swap_recv) then
|
|
|
|
else if (swap_recv) then
|
|
|
|
|
|
|
|
|
|
|
|
point_to_proc = 1
|
|
|
|
point_to_proc = 1
|
|
|
|
proc_to_comm = h_idx(point_to_proc+psb_proc_id_)
|
|
|
|
proc_to_comm = d_idx(point_to_proc+psb_proc_id_)
|
|
|
|
do while (proc_to_comm .ne. -1)
|
|
|
|
do while (proc_to_comm .ne. -1)
|
|
|
|
nerv = h_idx(point_to_proc+psb_n_elem_recv_)
|
|
|
|
nerv = d_idx(point_to_proc+psb_n_elem_recv_)
|
|
|
|
nesd = h_idx(point_to_proc+nerv+psb_n_elem_send_)
|
|
|
|
nesd = d_idx(point_to_proc+nerv+psb_n_elem_send_)
|
|
|
|
|
|
|
|
|
|
|
|
if(proc_to_comm.ne.myrow) then
|
|
|
|
if(proc_to_comm.ne.myrow) then
|
|
|
|
snd_pt = bsdidx(proc_to_comm)
|
|
|
|
snd_pt = bsdidx(proc_to_comm)
|
|
|
|
call dgerv2d(icontxt,nesd,n,sndbuf(snd_pt),nesd,proc_to_comm,0)
|
|
|
|
call dgerv2d(icontxt,nesd,n,sndbuf(snd_pt),nesd,proc_to_comm,0)
|
|
|
|
idx_pt = point_to_proc+nerv+psb_elem_send_
|
|
|
|
idx_pt = point_to_proc+nerv+psb_elem_send_
|
|
|
|
call psi_sct(nesd,n,h_idx(idx_pt:idx_pt+nesd-1),&
|
|
|
|
call psi_sct(nesd,n,d_idx(idx_pt:idx_pt+nesd-1),&
|
|
|
|
& sndbuf(snd_pt:snd_pt+n*nesd-1),beta,y)
|
|
|
|
& sndbuf(snd_pt:snd_pt+n*nesd-1),beta,y)
|
|
|
|
else
|
|
|
|
else
|
|
|
|
idx_pt = point_to_proc+nerv+psb_elem_send_
|
|
|
|
idx_pt = point_to_proc+nerv+psb_elem_send_
|
|
|
|
rcv_pt = brvidx(proc_to_comm)
|
|
|
|
rcv_pt = brvidx(proc_to_comm)
|
|
|
|
call psi_sct(nesd,n,h_idx(idx_pt:idx_pt+nesd-1),&
|
|
|
|
call psi_sct(nesd,n,d_idx(idx_pt:idx_pt+nesd-1),&
|
|
|
|
& rcvbuf(rcv_pt:rcv_pt+n*nerv-1),beta,y)
|
|
|
|
& rcvbuf(rcv_pt:rcv_pt+n*nerv-1),beta,y)
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
|
|
point_to_proc = point_to_proc+nerv+nesd+3
|
|
|
|
point_to_proc = point_to_proc+nerv+nesd+3
|
|
|
|
proc_to_comm = h_idx(point_to_proc+psb_proc_id_)
|
|
|
|
proc_to_comm = d_idx(point_to_proc+psb_proc_id_)
|
|
|
|
end do
|
|
|
|
end do
|
|
|
|
|
|
|
|
|
|
|
|
end if
|
|
|
|
end if
|
|
|
@ -406,29 +420,30 @@ end subroutine psi_dswaptranm
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
subroutine psi_dswaptranv(flag,beta,y,desc_a,work,info)
|
|
|
|
subroutine psi_dswaptranv(flag,beta,y,desc_a,work,info,data)
|
|
|
|
|
|
|
|
|
|
|
|
use psb_error_mod
|
|
|
|
use psb_error_mod
|
|
|
|
use psb_descriptor_type
|
|
|
|
use psb_descriptor_type
|
|
|
|
|
|
|
|
use mpi
|
|
|
|
implicit none
|
|
|
|
implicit none
|
|
|
|
include 'mpif.h'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
integer, intent(in) :: flag
|
|
|
|
integer, intent(in) :: flag
|
|
|
|
integer, intent(out) :: info
|
|
|
|
integer, intent(out) :: info
|
|
|
|
real(kind(1.d0)) :: y(:), beta
|
|
|
|
real(kind(1.d0)) :: y(:), beta
|
|
|
|
real(kind(1.d0)), target :: work(:)
|
|
|
|
real(kind(1.d0)), target :: work(:)
|
|
|
|
type(psb_desc_type) :: desc_a
|
|
|
|
type(psb_desc_type) :: desc_a
|
|
|
|
|
|
|
|
integer, optional :: data
|
|
|
|
|
|
|
|
|
|
|
|
! locals
|
|
|
|
! locals
|
|
|
|
integer :: icontxt, nprow, npcol, myrow,&
|
|
|
|
integer :: icontxt, nprow, npcol, myrow,&
|
|
|
|
& mycol, point_to_proc, nesd, nerv,&
|
|
|
|
& mycol, point_to_proc, nesd, nerv,&
|
|
|
|
& proc_to_comm, p2ptag, icomm, p2pstat,&
|
|
|
|
& proc_to_comm, p2ptag, icomm, p2pstat(mpi_status_size),&
|
|
|
|
& idxs, idxr, iret, errlen, ifcomm, rank,&
|
|
|
|
& idxs, idxr, iret, errlen, ifcomm, rank,&
|
|
|
|
& err_act, totxch, ixrec, i, lw, idx_pt,&
|
|
|
|
& err_act, totxch, ixrec, i, lw, idx_pt,&
|
|
|
|
& snd_pt, rcv_pt, n
|
|
|
|
& snd_pt, rcv_pt, n
|
|
|
|
|
|
|
|
|
|
|
|
integer, pointer, dimension(:) :: bsdidx, brvidx,&
|
|
|
|
integer, pointer, dimension(:) :: bsdidx, brvidx,&
|
|
|
|
& sdsz, rvsz, prcid, ptp, rvhd, h_idx
|
|
|
|
& sdsz, rvsz, prcid, ptp, rvhd, d_idx
|
|
|
|
integer :: int_err(5)
|
|
|
|
integer :: int_err(5)
|
|
|
|
integer :: blacs_pnum, krecvid, ksendid
|
|
|
|
integer :: blacs_pnum, krecvid, ksendid
|
|
|
|
logical :: swap_mpi, swap_sync, swap_send, swap_recv
|
|
|
|
logical :: swap_mpi, swap_sync, swap_send, swap_recv
|
|
|
@ -504,7 +519,19 @@ subroutine psi_dswaptranv(flag,beta,y,desc_a,work,info)
|
|
|
|
swap_sync = iand(flag,psb_swap_sync_).ne.0
|
|
|
|
swap_sync = iand(flag,psb_swap_sync_).ne.0
|
|
|
|
swap_send = iand(flag,psb_swap_send_).ne.0
|
|
|
|
swap_send = iand(flag,psb_swap_send_).ne.0
|
|
|
|
swap_recv = iand(flag,psb_swap_recv_).ne.0
|
|
|
|
swap_recv = iand(flag,psb_swap_recv_).ne.0
|
|
|
|
h_idx => desc_a%halo_index
|
|
|
|
|
|
|
|
|
|
|
|
if(present(data)) then
|
|
|
|
|
|
|
|
if(data.eq.psb_comm_halo_) then
|
|
|
|
|
|
|
|
d_idx => desc_a%halo_index
|
|
|
|
|
|
|
|
else if(data.eq.psb_comm_ovr_) then
|
|
|
|
|
|
|
|
d_idx => desc_a%ovrlap_index
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
d_idx => desc_a%halo_index
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
d_idx => desc_a%halo_index
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
|
|
idxs = 0
|
|
|
|
idxs = 0
|
|
|
|
idxr = 0
|
|
|
|
idxr = 0
|
|
|
|
totxch = 0
|
|
|
|
totxch = 0
|
|
|
@ -513,11 +540,11 @@ subroutine psi_dswaptranv(flag,beta,y,desc_a,work,info)
|
|
|
|
n=1
|
|
|
|
n=1
|
|
|
|
|
|
|
|
|
|
|
|
! prepare info for communications
|
|
|
|
! prepare info for communications
|
|
|
|
proc_to_comm = h_idx(point_to_proc+psb_proc_id_)
|
|
|
|
proc_to_comm = d_idx(point_to_proc+psb_proc_id_)
|
|
|
|
do while (proc_to_comm.ne.-1)
|
|
|
|
do while (proc_to_comm.ne.-1)
|
|
|
|
if(proc_to_comm .ne. myrow) totxch = totxch+1
|
|
|
|
if(proc_to_comm .ne. myrow) totxch = totxch+1
|
|
|
|
nerv = h_idx(point_to_proc+psb_n_elem_recv_)
|
|
|
|
nerv = d_idx(point_to_proc+psb_n_elem_recv_)
|
|
|
|
nesd = h_idx(point_to_proc+nerv+psb_n_elem_send_)
|
|
|
|
nesd = d_idx(point_to_proc+nerv+psb_n_elem_send_)
|
|
|
|
|
|
|
|
|
|
|
|
prcid(proc_to_comm) = blacs_pnum(icontxt,proc_to_comm,mycol)
|
|
|
|
prcid(proc_to_comm) = blacs_pnum(icontxt,proc_to_comm,mycol)
|
|
|
|
ptp(proc_to_comm) = point_to_proc
|
|
|
|
ptp(proc_to_comm) = point_to_proc
|
|
|
@ -531,7 +558,7 @@ subroutine psi_dswaptranv(flag,beta,y,desc_a,work,info)
|
|
|
|
idxs = idxs+sdsz(proc_to_comm)
|
|
|
|
idxs = idxs+sdsz(proc_to_comm)
|
|
|
|
|
|
|
|
|
|
|
|
point_to_proc = point_to_proc+nerv+nesd+3
|
|
|
|
point_to_proc = point_to_proc+nerv+nesd+3
|
|
|
|
proc_to_comm = h_idx(point_to_proc+psb_proc_id_)
|
|
|
|
proc_to_comm = d_idx(point_to_proc+psb_proc_id_)
|
|
|
|
end do
|
|
|
|
end do
|
|
|
|
|
|
|
|
|
|
|
|
if((idxr+idxs).lt.size(work)) then
|
|
|
|
if((idxr+idxs).lt.size(work)) then
|
|
|
@ -550,18 +577,18 @@ subroutine psi_dswaptranv(flag,beta,y,desc_a,work,info)
|
|
|
|
|
|
|
|
|
|
|
|
! gather elements into sendbuffer for swapping
|
|
|
|
! gather elements into sendbuffer for swapping
|
|
|
|
point_to_proc = 1
|
|
|
|
point_to_proc = 1
|
|
|
|
proc_to_comm = h_idx(point_to_proc+psb_proc_id_)
|
|
|
|
proc_to_comm = d_idx(point_to_proc+psb_proc_id_)
|
|
|
|
do while (proc_to_comm .ne. -1)
|
|
|
|
do while (proc_to_comm .ne. -1)
|
|
|
|
nerv = h_idx(point_to_proc+psb_n_elem_recv_)
|
|
|
|
nerv = d_idx(point_to_proc+psb_n_elem_recv_)
|
|
|
|
nesd = h_idx(point_to_proc+nerv+psb_n_elem_send_)
|
|
|
|
nesd = d_idx(point_to_proc+nerv+psb_n_elem_send_)
|
|
|
|
|
|
|
|
|
|
|
|
idx_pt = point_to_proc+psb_elem_recv_
|
|
|
|
idx_pt = point_to_proc+psb_elem_recv_
|
|
|
|
rcv_pt = brvidx(proc_to_comm)
|
|
|
|
rcv_pt = brvidx(proc_to_comm)
|
|
|
|
call psi_gth(nerv,h_idx(idx_pt:idx_pt+nerv-1),&
|
|
|
|
call psi_gth(nerv,d_idx(idx_pt:idx_pt+nerv-1),&
|
|
|
|
& y,rcvbuf(rcv_pt:rcv_pt+nerv-1))
|
|
|
|
& y,rcvbuf(rcv_pt:rcv_pt+nerv-1))
|
|
|
|
|
|
|
|
|
|
|
|
point_to_proc = point_to_proc+nerv+nesd+3
|
|
|
|
point_to_proc = point_to_proc+nerv+nesd+3
|
|
|
|
proc_to_comm = h_idx(point_to_proc+psb_proc_id_)
|
|
|
|
proc_to_comm = d_idx(point_to_proc+psb_proc_id_)
|
|
|
|
end do
|
|
|
|
end do
|
|
|
|
|
|
|
|
|
|
|
|
! swap elements using mpi_alltoallv
|
|
|
|
! swap elements using mpi_alltoallv
|
|
|
@ -577,32 +604,32 @@ subroutine psi_dswaptranv(flag,beta,y,desc_a,work,info)
|
|
|
|
|
|
|
|
|
|
|
|
! scatter elements from receivebuffer after swapping
|
|
|
|
! scatter elements from receivebuffer after swapping
|
|
|
|
point_to_proc = 1
|
|
|
|
point_to_proc = 1
|
|
|
|
proc_to_comm = h_idx(point_to_proc+psb_proc_id_)
|
|
|
|
proc_to_comm = d_idx(point_to_proc+psb_proc_id_)
|
|
|
|
do while (proc_to_comm .ne. -1)
|
|
|
|
do while (proc_to_comm .ne. -1)
|
|
|
|
nerv = h_idx(point_to_proc+psb_n_elem_recv_)
|
|
|
|
nerv = d_idx(point_to_proc+psb_n_elem_recv_)
|
|
|
|
nesd = h_idx(point_to_proc+nerv+psb_n_elem_send_)
|
|
|
|
nesd = d_idx(point_to_proc+nerv+psb_n_elem_send_)
|
|
|
|
|
|
|
|
|
|
|
|
idx_pt = point_to_proc+nerv+psb_elem_send_
|
|
|
|
idx_pt = point_to_proc+nerv+psb_elem_send_
|
|
|
|
snd_pt = bsdidx(proc_to_comm)
|
|
|
|
snd_pt = bsdidx(proc_to_comm)
|
|
|
|
call psi_sct(nesd,h_idx(idx_pt:idx_pt+nesd-1),&
|
|
|
|
call psi_sct(nesd,d_idx(idx_pt:idx_pt+nesd-1),&
|
|
|
|
& sndbuf(snd_pt:snd_pt+nesd-1),beta,y)
|
|
|
|
& sndbuf(snd_pt:snd_pt+nesd-1),beta,y)
|
|
|
|
|
|
|
|
|
|
|
|
point_to_proc = point_to_proc+nerv+nesd+3
|
|
|
|
point_to_proc = point_to_proc+nerv+nesd+3
|
|
|
|
proc_to_comm = h_idx(point_to_proc+psb_proc_id_)
|
|
|
|
proc_to_comm = d_idx(point_to_proc+psb_proc_id_)
|
|
|
|
end do
|
|
|
|
end do
|
|
|
|
|
|
|
|
|
|
|
|
else if (swap_sync) then
|
|
|
|
else if (swap_sync) then
|
|
|
|
|
|
|
|
|
|
|
|
point_to_proc = 1
|
|
|
|
point_to_proc = 1
|
|
|
|
proc_to_comm = h_idx(point_to_proc+psb_proc_id_)
|
|
|
|
proc_to_comm = d_idx(point_to_proc+psb_proc_id_)
|
|
|
|
do while (proc_to_comm .ne. -1)
|
|
|
|
do while (proc_to_comm .ne. -1)
|
|
|
|
nerv = h_idx(point_to_proc+psb_n_elem_recv_)
|
|
|
|
nerv = d_idx(point_to_proc+psb_n_elem_recv_)
|
|
|
|
nesd = h_idx(point_to_proc+nerv+psb_n_elem_send_)
|
|
|
|
nesd = d_idx(point_to_proc+nerv+psb_n_elem_send_)
|
|
|
|
if (proc_to_comm .lt. myrow) then
|
|
|
|
if (proc_to_comm .lt. myrow) then
|
|
|
|
! First I send
|
|
|
|
! First I send
|
|
|
|
idx_pt = point_to_proc+psb_elem_recv_
|
|
|
|
idx_pt = point_to_proc+psb_elem_recv_
|
|
|
|
rcv_pt = brvidx(proc_to_comm)
|
|
|
|
rcv_pt = brvidx(proc_to_comm)
|
|
|
|
call psi_gth(nerv,h_idx(idx_pt:idx_pt+nerv-1),&
|
|
|
|
call psi_gth(nerv,d_idx(idx_pt:idx_pt+nerv-1),&
|
|
|
|
& y,rcvbuf(rcv_pt:rcv_pt+nerv-1))
|
|
|
|
& y,rcvbuf(rcv_pt:rcv_pt+nerv-1))
|
|
|
|
call dgesd2d(icontxt,nerv,1,rcvbuf(rcv_pt),nerv,proc_to_comm,0)
|
|
|
|
call dgesd2d(icontxt,nerv,1,rcvbuf(rcv_pt),nerv,proc_to_comm,0)
|
|
|
|
! Then I receive
|
|
|
|
! Then I receive
|
|
|
@ -615,51 +642,51 @@ subroutine psi_dswaptranv(flag,beta,y,desc_a,work,info)
|
|
|
|
! Then I send
|
|
|
|
! Then I send
|
|
|
|
idx_pt = point_to_proc+psb_elem_recv_
|
|
|
|
idx_pt = point_to_proc+psb_elem_recv_
|
|
|
|
rcv_pt = brvidx(proc_to_comm)
|
|
|
|
rcv_pt = brvidx(proc_to_comm)
|
|
|
|
call psi_gth(nerv,h_idx(idx_pt:idx_pt+nerv-1),&
|
|
|
|
call psi_gth(nerv,d_idx(idx_pt:idx_pt+nerv-1),&
|
|
|
|
& y,rcvbuf(rcv_pt:rcv_pt+nerv-1))
|
|
|
|
& y,rcvbuf(rcv_pt:rcv_pt+nerv-1))
|
|
|
|
call dgesd2d(icontxt,nerv,1,rcvbuf(rcv_pt),nerv,proc_to_comm,0)
|
|
|
|
call dgesd2d(icontxt,nerv,1,rcvbuf(rcv_pt),nerv,proc_to_comm,0)
|
|
|
|
else if (proc_to_comm .eq. myrow) then
|
|
|
|
else if (proc_to_comm .eq. myrow) then
|
|
|
|
! I send to myself
|
|
|
|
! I send to myself
|
|
|
|
idx_pt = point_to_proc+psb_elem_recv_
|
|
|
|
idx_pt = point_to_proc+psb_elem_recv_
|
|
|
|
rcv_pt = bsdidx(proc_to_comm)
|
|
|
|
rcv_pt = bsdidx(proc_to_comm)
|
|
|
|
call psi_gth(nerv,h_idx(idx_pt:idx_pt+nerv-1),&
|
|
|
|
call psi_gth(nerv,d_idx(idx_pt:idx_pt+nerv-1),&
|
|
|
|
& y,rcvbuf(rcv_pt:rcv_pt+nerv-1))
|
|
|
|
& y,rcvbuf(rcv_pt:rcv_pt+nerv-1))
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
|
|
point_to_proc = point_to_proc+nerv+nesd+3
|
|
|
|
point_to_proc = point_to_proc+nerv+nesd+3
|
|
|
|
proc_to_comm = h_idx(point_to_proc+psb_proc_id_)
|
|
|
|
proc_to_comm = d_idx(point_to_proc+psb_proc_id_)
|
|
|
|
end do
|
|
|
|
end do
|
|
|
|
|
|
|
|
|
|
|
|
point_to_proc = 1
|
|
|
|
point_to_proc = 1
|
|
|
|
proc_to_comm = h_idx(point_to_proc+psb_proc_id_)
|
|
|
|
proc_to_comm = d_idx(point_to_proc+psb_proc_id_)
|
|
|
|
do while (proc_to_comm .ne. -1)
|
|
|
|
do while (proc_to_comm .ne. -1)
|
|
|
|
nerv = h_idx(point_to_proc+psb_n_elem_recv_)
|
|
|
|
nerv = d_idx(point_to_proc+psb_n_elem_recv_)
|
|
|
|
nesd = h_idx(point_to_proc+nerv+psb_n_elem_send_)
|
|
|
|
nesd = d_idx(point_to_proc+nerv+psb_n_elem_send_)
|
|
|
|
|
|
|
|
|
|
|
|
if(proc_to_comm.ne.myrow) then
|
|
|
|
if(proc_to_comm.ne.myrow) then
|
|
|
|
idx_pt = point_to_proc+nerv+psb_elem_send_
|
|
|
|
idx_pt = point_to_proc+nerv+psb_elem_send_
|
|
|
|
snd_pt = bsdidx(proc_to_comm)
|
|
|
|
snd_pt = bsdidx(proc_to_comm)
|
|
|
|
call psi_sct(nesd,h_idx(idx_pt:idx_pt+nesd-1),&
|
|
|
|
call psi_sct(nesd,d_idx(idx_pt:idx_pt+nesd-1),&
|
|
|
|
& sndbuf(snd_pt:snd_pt+nesd-1),beta,y)
|
|
|
|
& sndbuf(snd_pt:snd_pt+nesd-1),beta,y)
|
|
|
|
else
|
|
|
|
else
|
|
|
|
idx_pt = point_to_proc+nerv+psb_elem_send_
|
|
|
|
idx_pt = point_to_proc+nerv+psb_elem_send_
|
|
|
|
rcv_pt = brvidx(proc_to_comm)
|
|
|
|
rcv_pt = brvidx(proc_to_comm)
|
|
|
|
call psi_sct(nesd,h_idx(idx_pt:idx_pt+nesd-1),&
|
|
|
|
call psi_sct(nesd,d_idx(idx_pt:idx_pt+nesd-1),&
|
|
|
|
& rcvbuf(rcv_pt:rcv_pt+nerv-1),beta,y)
|
|
|
|
& rcvbuf(rcv_pt:rcv_pt+nerv-1),beta,y)
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
|
|
point_to_proc = point_to_proc+nerv+nesd+3
|
|
|
|
point_to_proc = point_to_proc+nerv+nesd+3
|
|
|
|
proc_to_comm = h_idx(point_to_proc+psb_proc_id_)
|
|
|
|
proc_to_comm = d_idx(point_to_proc+psb_proc_id_)
|
|
|
|
end do
|
|
|
|
end do
|
|
|
|
|
|
|
|
|
|
|
|
else if (swap_send .and. swap_recv) then
|
|
|
|
else if (swap_send .and. swap_recv) then
|
|
|
|
|
|
|
|
|
|
|
|
! First I post all the non blocking receives
|
|
|
|
! First I post all the non blocking receives
|
|
|
|
point_to_proc = 1
|
|
|
|
point_to_proc = 1
|
|
|
|
proc_to_comm = h_idx(point_to_proc+psb_proc_id_)
|
|
|
|
proc_to_comm = d_idx(point_to_proc+psb_proc_id_)
|
|
|
|
do while (proc_to_comm .ne. -1)
|
|
|
|
do while (proc_to_comm .ne. -1)
|
|
|
|
nerv = h_idx(point_to_proc+psb_n_elem_recv_)
|
|
|
|
nerv = d_idx(point_to_proc+psb_n_elem_recv_)
|
|
|
|
nesd = h_idx(point_to_proc+nerv+psb_n_elem_send_)
|
|
|
|
nesd = d_idx(point_to_proc+nerv+psb_n_elem_send_)
|
|
|
|
|
|
|
|
|
|
|
|
if(proc_to_comm.ne.myrow) then
|
|
|
|
if(proc_to_comm.ne.myrow) then
|
|
|
|
p2ptag = krecvid(icontxt,proc_to_comm,myrow)
|
|
|
|
p2ptag = krecvid(icontxt,proc_to_comm,myrow)
|
|
|
@ -676,19 +703,19 @@ subroutine psi_dswaptranv(flag,beta,y,desc_a,work,info)
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
|
|
point_to_proc = point_to_proc+nerv+nesd+3
|
|
|
|
point_to_proc = point_to_proc+nerv+nesd+3
|
|
|
|
proc_to_comm = h_idx(point_to_proc+psb_proc_id_)
|
|
|
|
proc_to_comm = d_idx(point_to_proc+psb_proc_id_)
|
|
|
|
end do
|
|
|
|
end do
|
|
|
|
|
|
|
|
|
|
|
|
! Then I post all the blocking sends
|
|
|
|
! Then I post all the blocking sends
|
|
|
|
point_to_proc = 1
|
|
|
|
point_to_proc = 1
|
|
|
|
proc_to_comm = h_idx(point_to_proc+psb_proc_id_)
|
|
|
|
proc_to_comm = d_idx(point_to_proc+psb_proc_id_)
|
|
|
|
do while (proc_to_comm .ne. -1)
|
|
|
|
do while (proc_to_comm .ne. -1)
|
|
|
|
nerv = h_idx(point_to_proc+psb_n_elem_recv_)
|
|
|
|
nerv = d_idx(point_to_proc+psb_n_elem_recv_)
|
|
|
|
nesd = h_idx(point_to_proc+nerv+psb_n_elem_send_)
|
|
|
|
nesd = d_idx(point_to_proc+nerv+psb_n_elem_send_)
|
|
|
|
|
|
|
|
|
|
|
|
idx_pt = point_to_proc+psb_elem_recv_
|
|
|
|
idx_pt = point_to_proc+psb_elem_recv_
|
|
|
|
rcv_pt = brvidx(proc_to_comm)
|
|
|
|
rcv_pt = brvidx(proc_to_comm)
|
|
|
|
call psi_gth(nerv,h_idx(idx_pt:idx_pt+nerv-1),&
|
|
|
|
call psi_gth(nerv,d_idx(idx_pt:idx_pt+nerv-1),&
|
|
|
|
& y,rcvbuf(rcv_pt:rcv_pt+nerv-1))
|
|
|
|
& y,rcvbuf(rcv_pt:rcv_pt+nerv-1))
|
|
|
|
|
|
|
|
|
|
|
|
if(proc_to_comm .ne. myrow) then
|
|
|
|
if(proc_to_comm .ne. myrow) then
|
|
|
@ -704,7 +731,7 @@ subroutine psi_dswaptranv(flag,beta,y,desc_a,work,info)
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
point_to_proc = point_to_proc+nerv+nesd+3
|
|
|
|
point_to_proc = point_to_proc+nerv+nesd+3
|
|
|
|
proc_to_comm = h_idx(point_to_proc+psb_proc_id_)
|
|
|
|
proc_to_comm = d_idx(point_to_proc+psb_proc_id_)
|
|
|
|
end do
|
|
|
|
end do
|
|
|
|
|
|
|
|
|
|
|
|
do i=1, totxch
|
|
|
|
do i=1, totxch
|
|
|
@ -719,13 +746,13 @@ subroutine psi_dswaptranv(flag,beta,y,desc_a,work,info)
|
|
|
|
if (ixrec .ne. mpi_undefined) then
|
|
|
|
if (ixrec .ne. mpi_undefined) then
|
|
|
|
ixrec=ixrec-1 ! mpi_waitany returns an 1 to nprow index
|
|
|
|
ixrec=ixrec-1 ! mpi_waitany returns an 1 to nprow index
|
|
|
|
point_to_proc = ptp(ixrec)
|
|
|
|
point_to_proc = ptp(ixrec)
|
|
|
|
proc_to_comm = h_idx(point_to_proc+psb_proc_id_)
|
|
|
|
proc_to_comm = d_idx(point_to_proc+psb_proc_id_)
|
|
|
|
nerv = h_idx(point_to_proc+psb_n_elem_recv_)
|
|
|
|
nerv = d_idx(point_to_proc+psb_n_elem_recv_)
|
|
|
|
nesd = h_idx(point_to_proc+nerv+psb_n_elem_send_)
|
|
|
|
nesd = d_idx(point_to_proc+nerv+psb_n_elem_send_)
|
|
|
|
|
|
|
|
|
|
|
|
idx_pt = point_to_proc+nerv+psb_elem_send_
|
|
|
|
idx_pt = point_to_proc+nerv+psb_elem_send_
|
|
|
|
rcv_pt = bsdidx(proc_to_comm)
|
|
|
|
rcv_pt = bsdidx(proc_to_comm)
|
|
|
|
call psi_sct(nesd,h_idx(idx_pt:idx_pt+nesd-1),&
|
|
|
|
call psi_sct(nesd,d_idx(idx_pt:idx_pt+nesd-1),&
|
|
|
|
& rcvbuf(rcv_pt:rcv_pt+nerv-1),beta,y)
|
|
|
|
& rcvbuf(rcv_pt:rcv_pt+nerv-1),beta,y)
|
|
|
|
else
|
|
|
|
else
|
|
|
|
int_err(1) = ixrec
|
|
|
|
int_err(1) = ixrec
|
|
|
@ -736,64 +763,64 @@ subroutine psi_dswaptranv(flag,beta,y,desc_a,work,info)
|
|
|
|
end do
|
|
|
|
end do
|
|
|
|
|
|
|
|
|
|
|
|
point_to_proc = 1
|
|
|
|
point_to_proc = 1
|
|
|
|
proc_to_comm = h_idx(point_to_proc+psb_proc_id_)
|
|
|
|
proc_to_comm = d_idx(point_to_proc+psb_proc_id_)
|
|
|
|
do while (proc_to_comm .ne. -1)
|
|
|
|
do while (proc_to_comm .ne. -1)
|
|
|
|
nerv = h_idx(point_to_proc+psb_n_elem_recv_)
|
|
|
|
nerv = d_idx(point_to_proc+psb_n_elem_recv_)
|
|
|
|
nesd = h_idx(point_to_proc+nerv+psb_n_elem_send_)
|
|
|
|
nesd = d_idx(point_to_proc+nerv+psb_n_elem_send_)
|
|
|
|
|
|
|
|
|
|
|
|
if(proc_to_comm .eq. myrow) then
|
|
|
|
if(proc_to_comm .eq. myrow) then
|
|
|
|
idx_pt = point_to_proc+nerv+psb_elem_send_
|
|
|
|
idx_pt = point_to_proc+nerv+psb_elem_send_
|
|
|
|
rcv_pt = brvidx(proc_to_comm)
|
|
|
|
rcv_pt = brvidx(proc_to_comm)
|
|
|
|
call psi_sct(nesd,h_idx(idx_pt:idx_pt+nesd-1),&
|
|
|
|
call psi_sct(nesd,d_idx(idx_pt:idx_pt+nesd-1),&
|
|
|
|
& rcvbuf(rcv_pt:rcv_pt+nerv-1),beta,y)
|
|
|
|
& rcvbuf(rcv_pt:rcv_pt+nerv-1),beta,y)
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
|
|
point_to_proc = point_to_proc+nerv+nesd+3
|
|
|
|
point_to_proc = point_to_proc+nerv+nesd+3
|
|
|
|
proc_to_comm = h_idx(point_to_proc+psb_proc_id_)
|
|
|
|
proc_to_comm = d_idx(point_to_proc+psb_proc_id_)
|
|
|
|
end do
|
|
|
|
end do
|
|
|
|
|
|
|
|
|
|
|
|
else if (swap_send) then
|
|
|
|
else if (swap_send) then
|
|
|
|
|
|
|
|
|
|
|
|
point_to_proc = 1
|
|
|
|
point_to_proc = 1
|
|
|
|
proc_to_comm = h_idx(point_to_proc+psb_proc_id_)
|
|
|
|
proc_to_comm = d_idx(point_to_proc+psb_proc_id_)
|
|
|
|
do while (proc_to_comm .ne. -1)
|
|
|
|
do while (proc_to_comm .ne. -1)
|
|
|
|
nerv = h_idx(point_to_proc+psb_n_elem_recv_)
|
|
|
|
nerv = d_idx(point_to_proc+psb_n_elem_recv_)
|
|
|
|
nesd = h_idx(point_to_proc+nerv+psb_n_elem_send_)
|
|
|
|
nesd = d_idx(point_to_proc+nerv+psb_n_elem_send_)
|
|
|
|
|
|
|
|
|
|
|
|
idx_pt = point_to_proc+psb_elem_recv_
|
|
|
|
idx_pt = point_to_proc+psb_elem_recv_
|
|
|
|
rcv_pt = brvidx(proc_to_comm)
|
|
|
|
rcv_pt = brvidx(proc_to_comm)
|
|
|
|
call psi_gth(nerv,h_idx(idx_pt:idx_pt+nerv-1),&
|
|
|
|
call psi_gth(nerv,d_idx(idx_pt:idx_pt+nerv-1),&
|
|
|
|
& y,rcvbuf(rcv_pt:rcv_pt+nerv-1))
|
|
|
|
& y,rcvbuf(rcv_pt:rcv_pt+nerv-1))
|
|
|
|
call dgesd2d(icontxt,nerv,1,rcvbuf(rcv_pt),nerv,proc_to_comm,0)
|
|
|
|
call dgesd2d(icontxt,nerv,1,rcvbuf(rcv_pt),nerv,proc_to_comm,0)
|
|
|
|
|
|
|
|
|
|
|
|
point_to_proc = point_to_proc+nerv+nesd+3
|
|
|
|
point_to_proc = point_to_proc+nerv+nesd+3
|
|
|
|
proc_to_comm = h_idx(point_to_proc+psb_proc_id_)
|
|
|
|
proc_to_comm = d_idx(point_to_proc+psb_proc_id_)
|
|
|
|
end do
|
|
|
|
end do
|
|
|
|
|
|
|
|
|
|
|
|
else if (swap_recv) then
|
|
|
|
else if (swap_recv) then
|
|
|
|
|
|
|
|
|
|
|
|
point_to_proc = 1
|
|
|
|
point_to_proc = 1
|
|
|
|
proc_to_comm = h_idx(point_to_proc+psb_proc_id_)
|
|
|
|
proc_to_comm = d_idx(point_to_proc+psb_proc_id_)
|
|
|
|
do while (proc_to_comm .ne. -1)
|
|
|
|
do while (proc_to_comm .ne. -1)
|
|
|
|
nerv = h_idx(point_to_proc+psb_n_elem_recv_)
|
|
|
|
nerv = d_idx(point_to_proc+psb_n_elem_recv_)
|
|
|
|
nesd = h_idx(point_to_proc+nerv+psb_n_elem_send_)
|
|
|
|
nesd = d_idx(point_to_proc+nerv+psb_n_elem_send_)
|
|
|
|
|
|
|
|
|
|
|
|
if(proc_to_comm.ne.myrow) then
|
|
|
|
if(proc_to_comm.ne.myrow) then
|
|
|
|
snd_pt = bsdidx(proc_to_comm)
|
|
|
|
snd_pt = bsdidx(proc_to_comm)
|
|
|
|
call dgerv2d(icontxt,nesd,1,sndbuf(snd_pt),nesd,proc_to_comm,0)
|
|
|
|
call dgerv2d(icontxt,nesd,1,sndbuf(snd_pt),nesd,proc_to_comm,0)
|
|
|
|
idx_pt = point_to_proc+psb_elem_recv_
|
|
|
|
idx_pt = point_to_proc+psb_elem_recv_
|
|
|
|
rcv_pt = brvidx(proc_to_comm)
|
|
|
|
rcv_pt = brvidx(proc_to_comm)
|
|
|
|
call psi_sct(nesd,h_idx(idx_pt:idx_pt+nesd-1),&
|
|
|
|
call psi_sct(nesd,d_idx(idx_pt:idx_pt+nesd-1),&
|
|
|
|
& sndbuf(snd_pt:snd_pt+nesd-1),beta,y)
|
|
|
|
& sndbuf(snd_pt:snd_pt+nesd-1),beta,y)
|
|
|
|
else
|
|
|
|
else
|
|
|
|
idx_pt = point_to_proc+nerv+psb_elem_send_
|
|
|
|
idx_pt = point_to_proc+nerv+psb_elem_send_
|
|
|
|
rcv_pt = brvidx(proc_to_comm)
|
|
|
|
rcv_pt = brvidx(proc_to_comm)
|
|
|
|
call psi_sct(nesd,h_idx(idx_pt:idx_pt+nesd-1),&
|
|
|
|
call psi_sct(nesd,d_idx(idx_pt:idx_pt+nesd-1),&
|
|
|
|
& rcvbuf(rcv_pt:rcv_pt+nerv-1),beta,y)
|
|
|
|
& rcvbuf(rcv_pt:rcv_pt+nerv-1),beta,y)
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
|
|
point_to_proc = point_to_proc+nerv+nesd+3
|
|
|
|
point_to_proc = point_to_proc+nerv+nesd+3
|
|
|
|
proc_to_comm = h_idx(point_to_proc+psb_proc_id_)
|
|
|
|
proc_to_comm = d_idx(point_to_proc+psb_proc_id_)
|
|
|
|
end do
|
|
|
|
end do
|
|
|
|
|
|
|
|
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|