|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
subroutine psi_dswaptranm(flag,n,beta,y,desc_a,work,info,data)
|
|
|
|
|
subroutine psi_iswaptranm(flag,n,beta,y,desc_a,work,info,data)
|
|
|
|
|
|
|
|
|
|
use psb_error_mod
|
|
|
|
|
use psb_descriptor_type
|
|
|
|
@ -7,8 +7,8 @@ subroutine psi_dswaptranm(flag,n,beta,y,desc_a,work,info,data)
|
|
|
|
|
|
|
|
|
|
integer, intent(in) :: flag, n
|
|
|
|
|
integer, intent(out) :: info
|
|
|
|
|
real(kind(1.d0)) :: y(:,:), beta
|
|
|
|
|
real(kind(1.d0)), target :: work(:)
|
|
|
|
|
integer :: y(:,:), beta
|
|
|
|
|
integer, target :: work(:)
|
|
|
|
|
type(psb_desc_type) :: desc_a
|
|
|
|
|
integer, optional :: data
|
|
|
|
|
|
|
|
|
@ -25,7 +25,7 @@ subroutine psi_dswaptranm(flag,n,beta,y,desc_a,work,info,data)
|
|
|
|
|
integer :: int_err(5)
|
|
|
|
|
integer :: blacs_pnum, krecvid, ksendid
|
|
|
|
|
logical :: swap_mpi, swap_sync, swap_send, swap_recv
|
|
|
|
|
real(kind(1.d0)), pointer, dimension(:) :: sndbuf, rcvbuf
|
|
|
|
|
integer, pointer, dimension(:) :: sndbuf, rcvbuf
|
|
|
|
|
character(len=20) :: name, ch_err
|
|
|
|
|
|
|
|
|
|
interface psi_gth
|
|
|
|
@ -171,8 +171,8 @@ subroutine psi_dswaptranm(flag,n,beta,y,desc_a,work,info,data)
|
|
|
|
|
|
|
|
|
|
! swap elements using mpi_alltoallv
|
|
|
|
|
call mpi_alltoallv(rcvbuf,rvsz,brvidx,&
|
|
|
|
|
& mpi_double_precision,sndbuf,sdsz,&
|
|
|
|
|
& bsdidx,mpi_double_precision,icomm,iret)
|
|
|
|
|
& mpi_integer,sndbuf,sdsz,&
|
|
|
|
|
& bsdidx,mpi_integer,icomm,iret)
|
|
|
|
|
if(iret.ne.mpi_success) then
|
|
|
|
|
int_err(1) = iret
|
|
|
|
|
info=400
|
|
|
|
@ -209,20 +209,20 @@ subroutine psi_dswaptranm(flag,n,beta,y,desc_a,work,info,data)
|
|
|
|
|
rcv_pt = brvidx(proc_to_comm)
|
|
|
|
|
call psi_gth(nerv,n,d_idx(idx_pt:idx_pt+nerv-1),&
|
|
|
|
|
& y,rcvbuf(rcv_pt:rcv_pt+nerv*n-1))
|
|
|
|
|
call dgesd2d(icontxt,nerv,n,rcvbuf(rcv_pt),nerv,proc_to_comm,0)
|
|
|
|
|
call igesd2d(icontxt,nerv,n,rcvbuf(rcv_pt),nerv,proc_to_comm,0)
|
|
|
|
|
! Then I receive
|
|
|
|
|
snd_pt = brvidx(proc_to_comm)
|
|
|
|
|
call dgerv2d(icontxt,nesd,n,sndbuf(snd_pt),nesd,proc_to_comm,0)
|
|
|
|
|
call igerv2d(icontxt,nesd,n,sndbuf(snd_pt),nesd,proc_to_comm,0)
|
|
|
|
|
else if (proc_to_comm .gt. myrow) then
|
|
|
|
|
! First I receive
|
|
|
|
|
snd_pt = bsdidx(proc_to_comm)
|
|
|
|
|
call dgerv2d(icontxt,nesd,n,sndbuf(snd_pt),nesd,proc_to_comm,0)
|
|
|
|
|
call igerv2d(icontxt,nesd,n,sndbuf(snd_pt),nesd,proc_to_comm,0)
|
|
|
|
|
! Then I send
|
|
|
|
|
idx_pt = point_to_proc+psb_elem_recv_
|
|
|
|
|
rcv_pt = brvidx(proc_to_comm)
|
|
|
|
|
call psi_gth(nerv,n,d_idx(idx_pt:idx_pt+nerv-1),&
|
|
|
|
|
& y,rcvbuf(rcv_pt:rcv_pt+nerv*n-1))
|
|
|
|
|
call dgesd2d(icontxt,nerv,n,rcvbuf(rcv_pt),nerv,proc_to_comm,0)
|
|
|
|
|
call igesd2d(icontxt,nerv,n,rcvbuf(rcv_pt),nerv,proc_to_comm,0)
|
|
|
|
|
else if (proc_to_comm .eq. myrow) then
|
|
|
|
|
! I send to myself
|
|
|
|
|
idx_pt = point_to_proc+psb_elem_recv_
|
|
|
|
@ -270,7 +270,7 @@ subroutine psi_dswaptranm(flag,n,beta,y,desc_a,work,info,data)
|
|
|
|
|
p2ptag = krecvid(icontxt,proc_to_comm,myrow)
|
|
|
|
|
snd_pt = brvidx(proc_to_comm)
|
|
|
|
|
call mpi_irecv(sndbuf(rcv_pt),sdsz(proc_to_comm),&
|
|
|
|
|
& mpi_double_precision,prcid(proc_to_comm),&
|
|
|
|
|
& mpi_integer,prcid(proc_to_comm),&
|
|
|
|
|
& p2ptag, icomm,rvhd(proc_to_comm),iret)
|
|
|
|
|
if(iret.ne.mpi_success) then
|
|
|
|
|
int_err(1) = iret
|
|
|
|
@ -299,7 +299,7 @@ subroutine psi_dswaptranm(flag,n,beta,y,desc_a,work,info,data)
|
|
|
|
|
if(proc_to_comm .ne. myrow) then
|
|
|
|
|
p2ptag=ksendid(icontxt,proc_to_comm,myrow)
|
|
|
|
|
call mpi_send(rcvbuf(rcv_pt),rvsz(proc_to_comm),&
|
|
|
|
|
& mpi_double_precision,prcid(proc_to_comm),&
|
|
|
|
|
& mpi_integer,prcid(proc_to_comm),&
|
|
|
|
|
& p2ptag,icomm,iret)
|
|
|
|
|
if(iret.ne.mpi_success) then
|
|
|
|
|
int_err(1) = iret
|
|
|
|
@ -404,7 +404,7 @@ subroutine psi_dswaptranm(flag,n,beta,y,desc_a,work,info,data)
|
|
|
|
|
rcv_pt = brvidx(proc_to_comm)
|
|
|
|
|
call psi_gth(nerv,n,d_idx(idx_pt:idx_pt+nerv-1),&
|
|
|
|
|
& y,rcvbuf(rcv_pt:rcv_pt+nerv*n-1))
|
|
|
|
|
call dgesd2d(icontxt,nerv,n,rcvbuf(rcv_pt),nerv,proc_to_comm,0)
|
|
|
|
|
call igesd2d(icontxt,nerv,n,rcvbuf(rcv_pt),nerv,proc_to_comm,0)
|
|
|
|
|
|
|
|
|
|
point_to_proc = point_to_proc+nerv+nesd+3
|
|
|
|
|
proc_to_comm = d_idx(point_to_proc+psb_proc_id_)
|
|
|
|
@ -420,7 +420,7 @@ subroutine psi_dswaptranm(flag,n,beta,y,desc_a,work,info,data)
|
|
|
|
|
|
|
|
|
|
if(proc_to_comm.ne.myrow) then
|
|
|
|
|
snd_pt = bsdidx(proc_to_comm)
|
|
|
|
|
call dgerv2d(icontxt,nesd,n,sndbuf(snd_pt),nesd,proc_to_comm,0)
|
|
|
|
|
call igerv2d(icontxt,nesd,n,sndbuf(snd_pt),nesd,proc_to_comm,0)
|
|
|
|
|
idx_pt = point_to_proc+nerv+psb_elem_send_
|
|
|
|
|
call psi_sct(nesd,n,d_idx(idx_pt:idx_pt+nesd-1),&
|
|
|
|
|
& sndbuf(snd_pt:snd_pt+n*nesd-1),beta,y)
|
|
|
|
@ -447,7 +447,7 @@ subroutine psi_dswaptranm(flag,n,beta,y,desc_a,work,info,data)
|
|
|
|
|
return
|
|
|
|
|
end if
|
|
|
|
|
return
|
|
|
|
|
end subroutine psi_dswaptranm
|
|
|
|
|
end subroutine psi_iswaptranm
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -455,7 +455,7 @@ end subroutine psi_dswaptranm
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
subroutine psi_dswaptranv(flag,beta,y,desc_a,work,info,data)
|
|
|
|
|
subroutine psi_iswaptranv(flag,beta,y,desc_a,work,info,data)
|
|
|
|
|
|
|
|
|
|
use psb_error_mod
|
|
|
|
|
use psb_descriptor_type
|
|
|
|
@ -464,8 +464,8 @@ subroutine psi_dswaptranv(flag,beta,y,desc_a,work,info,data)
|
|
|
|
|
|
|
|
|
|
integer, intent(in) :: flag
|
|
|
|
|
integer, intent(out) :: info
|
|
|
|
|
real(kind(1.d0)) :: y(:), beta
|
|
|
|
|
real(kind(1.d0)), target :: work(:)
|
|
|
|
|
integer :: y(:), beta
|
|
|
|
|
integer, target :: work(:)
|
|
|
|
|
type(psb_desc_type) :: desc_a
|
|
|
|
|
integer, optional :: data
|
|
|
|
|
|
|
|
|
@ -482,7 +482,7 @@ subroutine psi_dswaptranv(flag,beta,y,desc_a,work,info,data)
|
|
|
|
|
integer :: int_err(5)
|
|
|
|
|
integer :: blacs_pnum, krecvid, ksendid
|
|
|
|
|
logical :: swap_mpi, swap_sync, swap_send, swap_recv
|
|
|
|
|
real(kind(1.d0)), pointer, dimension(:) :: sndbuf, rcvbuf
|
|
|
|
|
integer, pointer, dimension(:) :: sndbuf, rcvbuf
|
|
|
|
|
character(len=20) :: name, ch_err
|
|
|
|
|
|
|
|
|
|
interface psi_gth
|
|
|
|
@ -628,8 +628,8 @@ subroutine psi_dswaptranv(flag,beta,y,desc_a,work,info,data)
|
|
|
|
|
|
|
|
|
|
! swap elements using mpi_alltoallv
|
|
|
|
|
call mpi_alltoallv(rcvbuf,rvsz,brvidx,&
|
|
|
|
|
& mpi_double_precision,sndbuf,sdsz,&
|
|
|
|
|
& bsdidx,mpi_double_precision,icomm,iret)
|
|
|
|
|
& mpi_integer,sndbuf,sdsz,&
|
|
|
|
|
& bsdidx,mpi_integer,icomm,iret)
|
|
|
|
|
if(iret.ne.mpi_success) then
|
|
|
|
|
int_err(1) = iret
|
|
|
|
|
info=400
|
|
|
|
@ -666,20 +666,20 @@ subroutine psi_dswaptranv(flag,beta,y,desc_a,work,info,data)
|
|
|
|
|
rcv_pt = brvidx(proc_to_comm)
|
|
|
|
|
call psi_gth(nerv,d_idx(idx_pt:idx_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 igesd2d(icontxt,nerv,1,rcvbuf(rcv_pt),nerv,proc_to_comm,0)
|
|
|
|
|
! Then I receive
|
|
|
|
|
snd_pt = brvidx(proc_to_comm)
|
|
|
|
|
call dgerv2d(icontxt,nesd,1,sndbuf(snd_pt),nesd,proc_to_comm,0)
|
|
|
|
|
call igerv2d(icontxt,nesd,1,sndbuf(snd_pt),nesd,proc_to_comm,0)
|
|
|
|
|
else if (proc_to_comm .gt. myrow) then
|
|
|
|
|
! First I receive
|
|
|
|
|
snd_pt = bsdidx(proc_to_comm)
|
|
|
|
|
call dgerv2d(icontxt,nesd,1,sndbuf(snd_pt),nesd,proc_to_comm,0)
|
|
|
|
|
call igerv2d(icontxt,nesd,1,sndbuf(snd_pt),nesd,proc_to_comm,0)
|
|
|
|
|
! Then I send
|
|
|
|
|
idx_pt = point_to_proc+psb_elem_recv_
|
|
|
|
|
rcv_pt = brvidx(proc_to_comm)
|
|
|
|
|
call psi_gth(nerv,d_idx(idx_pt:idx_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 igesd2d(icontxt,nerv,1,rcvbuf(rcv_pt),nerv,proc_to_comm,0)
|
|
|
|
|
else if (proc_to_comm .eq. myrow) then
|
|
|
|
|
! I send to myself
|
|
|
|
|
idx_pt = point_to_proc+psb_elem_recv_
|
|
|
|
@ -727,7 +727,7 @@ subroutine psi_dswaptranv(flag,beta,y,desc_a,work,info,data)
|
|
|
|
|
p2ptag = krecvid(icontxt,proc_to_comm,myrow)
|
|
|
|
|
snd_pt = brvidx(proc_to_comm)
|
|
|
|
|
call mpi_irecv(sndbuf(snd_pt),sdsz(proc_to_comm),&
|
|
|
|
|
& mpi_double_precision,prcid(proc_to_comm),&
|
|
|
|
|
& mpi_integer,prcid(proc_to_comm),&
|
|
|
|
|
& p2ptag, icomm,rvhd(proc_to_comm),iret)
|
|
|
|
|
if(iret.ne.mpi_success) then
|
|
|
|
|
int_err(1) = iret
|
|
|
|
@ -756,7 +756,7 @@ subroutine psi_dswaptranv(flag,beta,y,desc_a,work,info,data)
|
|
|
|
|
if(proc_to_comm .ne. myrow) then
|
|
|
|
|
p2ptag=ksendid(icontxt,proc_to_comm,myrow)
|
|
|
|
|
call mpi_send(rcvbuf(rcv_pt),rvsz(proc_to_comm),&
|
|
|
|
|
& mpi_double_precision,prcid(proc_to_comm),&
|
|
|
|
|
& mpi_integer,prcid(proc_to_comm),&
|
|
|
|
|
& p2ptag,icomm,iret)
|
|
|
|
|
if(iret.ne.mpi_success) then
|
|
|
|
|
int_err(1) = iret
|
|
|
|
@ -861,7 +861,7 @@ subroutine psi_dswaptranv(flag,beta,y,desc_a,work,info,data)
|
|
|
|
|
rcv_pt = brvidx(proc_to_comm)
|
|
|
|
|
call psi_gth(nerv,d_idx(idx_pt:idx_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 igesd2d(icontxt,nerv,1,rcvbuf(rcv_pt),nerv,proc_to_comm,0)
|
|
|
|
|
|
|
|
|
|
point_to_proc = point_to_proc+nerv+nesd+3
|
|
|
|
|
proc_to_comm = d_idx(point_to_proc+psb_proc_id_)
|
|
|
|
@ -877,7 +877,7 @@ subroutine psi_dswaptranv(flag,beta,y,desc_a,work,info,data)
|
|
|
|
|
|
|
|
|
|
if(proc_to_comm.ne.myrow) then
|
|
|
|
|
snd_pt = bsdidx(proc_to_comm)
|
|
|
|
|
call dgerv2d(icontxt,nesd,1,sndbuf(snd_pt),nesd,proc_to_comm,0)
|
|
|
|
|
call igerv2d(icontxt,nesd,1,sndbuf(snd_pt),nesd,proc_to_comm,0)
|
|
|
|
|
idx_pt = point_to_proc+psb_elem_recv_
|
|
|
|
|
rcv_pt = brvidx(proc_to_comm)
|
|
|
|
|
call psi_sct(nesd,d_idx(idx_pt:idx_pt+nesd-1),&
|
|
|
|
@ -905,4 +905,4 @@ subroutine psi_dswaptranv(flag,beta,y,desc_a,work,info,data)
|
|
|
|
|
return
|
|
|
|
|
end if
|
|
|
|
|
return
|
|
|
|
|
end subroutine psi_dswaptranv
|
|
|
|
|
end subroutine psi_iswaptranv
|
|
|
|
|