@ -1525,7 +1525,8 @@ subroutine psi_ztran_vidx_multivect(iictxt,iicomm,flag,beta,y,idx,&
go to 9999
go to 9999
endif
endif
n = 1
n = y % get_ncols ( )
swap_mpi = iand ( flag , psb_swap_mpi_ ) / = 0
swap_mpi = iand ( flag , psb_swap_mpi_ ) / = 0
swap_sync = iand ( flag , psb_swap_sync_ ) / = 0
swap_sync = iand ( flag , psb_swap_sync_ ) / = 0
swap_send = iand ( flag , psb_swap_send_ ) / = 0
swap_send = iand ( flag , psb_swap_send_ ) / = 0
@ -1555,21 +1556,22 @@ subroutine psi_ztran_vidx_multivect(iictxt,iicomm,flag,beta,y,idx,&
call psb_realloc ( totxch , prcid , info )
call psb_realloc ( totxch , prcid , info )
! First I post all the non blocking receives
! First I post all the non blocking receives
pnti = 1
pnti = 1
snd_pt = totrcv_ + 1
rcv_pt = 1
p2ptag = psb_dcomplex_swap_tag
p2ptag = psb_dcomplex_swap_tag
do i = 1 , totxch
do i = 1 , totxch
proc_to_comm = idx % v ( pnti + psb_proc_id_ )
proc_to_comm = idx % v ( pnti + psb_proc_id_ )
nerv = idx % v ( pnti + psb_n_elem_recv_ )
nerv = idx % v ( pnti + psb_n_elem_recv_ )
nesd = idx % v ( pnti + nerv + psb_n_elem_send_ )
nesd = idx % v ( pnti + nerv + psb_n_elem_send_ )
snd_pt = 1 + pnti + nerv + psb_n_elem_send_
rcv_pt = 1 + pnti + psb_n_elem_recv_
call psb_get_rank ( prcid ( i ) , ictxt , proc_to_comm )
call psb_get_rank ( prcid ( i ) , ictxt , proc_to_comm )
if ( ( nesd > 0 ) . and . ( proc_to_comm / = me ) ) then
if ( ( nesd > 0 ) . and . ( proc_to_comm / = me ) ) then
if ( debug ) write ( * , * ) me , 'Posting receive from' , prcid ( i ) , rcv _pt
if ( debug ) write ( * , * ) me , 'Posting receive from' , prcid ( i ) , snd_pt
call mpi_irecv ( y % combuf ( snd_pt ) , n esd, &
call mpi_irecv ( y % combuf ( snd_pt ) , n * n esd, &
& psb_mpi_c_dpk_ , prcid ( i ) , &
& psb_mpi_c_dpk_ , prcid ( i ) , &
& p2ptag , icomm , y % comid ( i , 2 ) , iret )
& p2ptag , icomm , y % comid ( i , 2 ) , iret )
end if
end if
rcv_pt = rcv_pt + n * nerv
snd_pt = snd_pt + n * nesd
pnti = pnti + nerv + nesd + 3
pnti = pnti + nerv + nesd + 3
end do
end do
@ -1578,16 +1580,15 @@ subroutine psi_ztran_vidx_multivect(iictxt,iicomm,flag,beta,y,idx,&
! Then gather for sending .
! Then gather for sending .
!
!
pnti = 1
pnti = 1
snd_pt = 1
snd_pt = totrcv_ + 1
rcv_pt = 1
do i = 1 , totxch
do i = 1 , totxch
nerv = idx % v ( pnti + psb_n_elem_recv_ )
nerv = idx % v ( pnti + psb_n_elem_recv_ )
nesd = idx % v ( pnti + nerv + psb_n_elem_send_ )
nesd = idx % v ( pnti + nerv + psb_n_elem_send_ )
snd_pt = 1 + pnti + nerv + psb_n_elem_send_
idx_pt = 1 + pnti + psb_n_elem_recv_
rcv_pt = 1 + pnti + psb_n_elem_recv_
call y % gth ( idx_pt , rcv_pt , nerv , idx )
rcv_pt = rcv_pt + n * nerv
idx_pt = rcv_pt
snd_pt = snd_pt + n * nesd
call y % gth ( idx_pt , nerv , idx )
pnti = pnti + nerv + nesd + 3
pnti = pnti + nerv + nesd + 3
end do
end do
@ -1603,18 +1604,17 @@ subroutine psi_ztran_vidx_multivect(iictxt,iicomm,flag,beta,y,idx,&
!
!
pnti = 1
pnti = 1
snd_pt = 1
snd_pt = totrcv_ + 1
rcv_pt = 1
rcv_pt = 1
p2ptag = psb_dcomplex_swap_tag
p2ptag = psb_dcomplex_swap_tag
do i = 1 , totxch
do i = 1 , totxch
proc_to_comm = idx % v ( pnti + psb_proc_id_ )
proc_to_comm = idx % v ( pnti + psb_proc_id_ )
nerv = idx % v ( pnti + psb_n_elem_recv_ )
nerv = idx % v ( pnti + psb_n_elem_recv_ )
nesd = idx % v ( pnti + nerv + psb_n_elem_send_ )
nesd = idx % v ( pnti + nerv + psb_n_elem_send_ )
snd_pt = 1 + pnti + nerv + psb_n_elem_send_
idx_pt = 1 + pnti + psb_n_elem_recv_
rcv_pt = 1 + pnti + psb_n_elem_recv_
if ( ( nerv > 0 ) . and . ( proc_to_comm / = me ) ) then
if ( ( nerv > 0 ) . and . ( proc_to_comm / = me ) ) then
call mpi_isend ( y % combuf ( rcv_pt ) , n erv, &
call mpi_isend ( y % combuf ( rcv_pt ) , n * n erv, &
& psb_mpi_c_dpk_ , prcid ( i ) , &
& psb_mpi_c_dpk_ , prcid ( i ) , &
& p2ptag , icomm , y % comid ( i , 1 ) , iret )
& p2ptag , icomm , y % comid ( i , 1 ) , iret )
end if
end if
@ -1625,7 +1625,8 @@ subroutine psi_ztran_vidx_multivect(iictxt,iicomm,flag,beta,y,idx,&
call psb_errpush ( info , name , i_err = ierr )
call psb_errpush ( info , name , i_err = ierr )
go to 9999
go to 9999
end if
end if
rcv_pt = rcv_pt + n * nerv
snd_pt = snd_pt + n * nesd
pnti = pnti + nerv + nesd + 3
pnti = pnti + nerv + nesd + 3
end do
end do
end if
end if
@ -1645,14 +1646,13 @@ subroutine psi_ztran_vidx_multivect(iictxt,iicomm,flag,beta,y,idx,&
if ( debug ) write ( * , * ) me , ' wait'
if ( debug ) write ( * , * ) me , ' wait'
pnti = 1
pnti = 1
snd_pt = totrcv_ + 1
rcv_pt = 1
p2ptag = psb_dcomplex_swap_tag
p2ptag = psb_dcomplex_swap_tag
do i = 1 , totxch
do i = 1 , totxch
proc_to_comm = idx % v ( pnti + psb_proc_id_ )
proc_to_comm = idx % v ( pnti + psb_proc_id_ )
nerv = idx % v ( pnti + psb_n_elem_recv_ )
nerv = idx % v ( pnti + psb_n_elem_recv_ )
nesd = idx % v ( pnti + nerv + psb_n_elem_send_ )
nesd = idx % v ( pnti + nerv + psb_n_elem_send_ )
snd_pt = 1 + pnti + nerv + psb_n_elem_send_
rcv_pt = 1 + pnti + psb_n_elem_recv_
if ( proc_to_comm / = me ) then
if ( proc_to_comm / = me ) then
if ( nerv > 0 ) then
if ( nerv > 0 ) then
call mpi_wait ( y % comid ( i , 1 ) , p2pstat , iret )
call mpi_wait ( y % comid ( i , 1 ) , p2pstat , iret )
@ -1678,26 +1678,30 @@ subroutine psi_ztran_vidx_multivect(iictxt,iicomm,flag,beta,y,idx,&
& 'Fatal error in swapdata: mismatch on self send' , &
& 'Fatal error in swapdata: mismatch on self send' , &
& nerv , nesd
& nerv , nesd
end if
end if
y % combuf ( snd_pt : snd_pt + n esd- 1 ) = y % combuf ( rcv_pt : rcv_pt + nerv - 1 )
y % combuf ( snd_pt : snd_pt + n * n esd- 1 ) = y % combuf ( rcv_pt : rcv_pt + n * nerv - 1 )
end if
end if
rcv_pt = rcv_pt + n * nerv
snd_pt = snd_pt + n * nesd
pnti = pnti + nerv + nesd + 3
pnti = pnti + nerv + nesd + 3
end do
end do
if ( debug ) write ( * , * ) me , ' scatter'
if ( debug ) write ( * , * ) me , ' scatter'
pnti = 1
pnti = 1
snd_pt = 1
snd_pt = totrcv_ + 1
rcv_pt = 1
rcv_pt = 1
do i = 1 , totxch
do i = 1 , totxch
proc_to_comm = idx % v ( pnti + psb_proc_id_ )
proc_to_comm = idx % v ( pnti + psb_proc_id_ )
nerv = idx % v ( pnti + psb_n_elem_recv_ )
nerv = idx % v ( pnti + psb_n_elem_recv_ )
nesd = idx % v ( pnti + nerv + psb_n_elem_send_ )
nesd = idx % v ( pnti + nerv + psb_n_elem_send_ )
idx_pt = 1 + pnti + psb_n_elem_recv_
idx_pt = 1 + pnti + nerv + psb_n_elem_send_
snd_pt = 1 + pnti + nerv + psb_n_elem_send_
rcv_pt = 1 + pnti + psb_n_elem_recv_
if ( debug ) write ( 0 , * ) me , ' Received from: ' , prcid ( i ) , &
if ( debug ) write ( 0 , * ) me , ' Received from: ' , prcid ( i ) , &
& y % combuf ( snd_pt : snd_pt + nesd - 1 )
& y % combuf ( snd_pt : snd_pt + n * nesd - 1 )
call y % sct ( snd_pt , nesd , idx , beta )
call y % sct ( idx_pt , snd_pt , nesd , idx , beta )
rcv_pt = rcv_pt + n * nerv
snd_pt = snd_pt + n * nesd
pnti = pnti + nerv + nesd + 3
pnti = pnti + nerv + nesd + 3
end do
end do