|
|
@ -29,25 +29,17 @@
|
|
|
|
!!$ POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
!!$ POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
!!$
|
|
|
|
!!$
|
|
|
|
!!$
|
|
|
|
!!$
|
|
|
|
subroutine dmatdist(a_glob, a, ictxt, desc_a,&
|
|
|
|
subroutine psb_dmatdist(a_glob, a, ictxt, desc_a,&
|
|
|
|
& b_glob, b, info, parts, v, inroot,fmt,mold)
|
|
|
|
& info, b_glob, b, x_glob, x, parts, v, inroot,fmt,mold)
|
|
|
|
!
|
|
|
|
!
|
|
|
|
! an utility subroutine to distribute a matrix among processors
|
|
|
|
! an utility subroutine to distribute a matrix among processors
|
|
|
|
! according to a user defined data distribution, using
|
|
|
|
! according to a user defined data distribution, using
|
|
|
|
! sparse matrix subroutines.
|
|
|
|
! sparse matrix subroutines.
|
|
|
|
!
|
|
|
|
!
|
|
|
|
! type(d_spmat) :: a_glob
|
|
|
|
! type(psb_dspmat) :: a_glob
|
|
|
|
! on entry: this contains the global sparse matrix as follows:
|
|
|
|
! on entry: this contains the global sparse matrix as follows:
|
|
|
|
! a%fida == 'csr'
|
|
|
|
|
|
|
|
! a%aspk for coefficient values
|
|
|
|
|
|
|
|
! a%ia1 for column indices
|
|
|
|
|
|
|
|
! a%ia2 for row pointers
|
|
|
|
|
|
|
|
! a%m for number of global matrix rows
|
|
|
|
|
|
|
|
! a%k for number of global matrix columns
|
|
|
|
|
|
|
|
! on exit : undefined, with unassociated pointers.
|
|
|
|
|
|
|
|
!
|
|
|
|
!
|
|
|
|
! type(d_spmat) :: a
|
|
|
|
! type(psb_dspmat_type) :: a
|
|
|
|
! on entry: fresh variable.
|
|
|
|
|
|
|
|
! on exit : this will contain the local sparse matrix.
|
|
|
|
! on exit : this will contain the local sparse matrix.
|
|
|
|
!
|
|
|
|
!
|
|
|
|
! interface parts
|
|
|
|
! interface parts
|
|
|
@ -68,19 +60,21 @@ subroutine dmatdist(a_glob, a, ictxt, desc_a,&
|
|
|
|
! distribution.
|
|
|
|
! distribution.
|
|
|
|
!
|
|
|
|
!
|
|
|
|
! integer(psb_ipk_) :: ictxt
|
|
|
|
! integer(psb_ipk_) :: ictxt
|
|
|
|
! on entry: blacs context.
|
|
|
|
! on entry: the PSBLAS parallel environment context.
|
|
|
|
! on exit : unchanged.
|
|
|
|
|
|
|
|
!
|
|
|
|
!
|
|
|
|
! type (desc_type) :: desc_a
|
|
|
|
! type (desc_type) :: desc_a
|
|
|
|
! on entry: fresh variable.
|
|
|
|
|
|
|
|
! on exit : the updated array descriptor
|
|
|
|
! on exit : the updated array descriptor
|
|
|
|
!
|
|
|
|
!
|
|
|
|
! real(psb_dpk_), optional :: b_glob(:)
|
|
|
|
! real(psb_dpk_), optional :: b_glob(:)
|
|
|
|
! on entry: this contains right hand side.
|
|
|
|
! on entry: RHS
|
|
|
|
! on exit :
|
|
|
|
!
|
|
|
|
|
|
|
|
! type(psb_d_vect_type), optional :: b
|
|
|
|
|
|
|
|
! on exit : this will contain the local right hand side.
|
|
|
|
|
|
|
|
!
|
|
|
|
|
|
|
|
! real(psb_dpk_), optional :: x_glob(:)
|
|
|
|
|
|
|
|
! on entry: initial guess
|
|
|
|
!
|
|
|
|
!
|
|
|
|
! real(psb_dpk_), allocatable, optional :: b(:)
|
|
|
|
! type(psb_d_vect_type), optional :: x
|
|
|
|
! on entry: fresh variable.
|
|
|
|
|
|
|
|
! on exit : this will contain the local right hand side.
|
|
|
|
! on exit : this will contain the local right hand side.
|
|
|
|
!
|
|
|
|
!
|
|
|
|
! integer(psb_ipk_), optional :: inroot
|
|
|
|
! integer(psb_ipk_), optional :: inroot
|
|
|
@ -93,21 +87,23 @@ subroutine dmatdist(a_glob, a, ictxt, desc_a,&
|
|
|
|
|
|
|
|
|
|
|
|
! parameters
|
|
|
|
! parameters
|
|
|
|
type(psb_dspmat_type) :: a_glob
|
|
|
|
type(psb_dspmat_type) :: a_glob
|
|
|
|
real(psb_dpk_) :: b_glob(:)
|
|
|
|
|
|
|
|
integer(psb_ipk_) :: ictxt
|
|
|
|
integer(psb_ipk_) :: ictxt
|
|
|
|
type(psb_dspmat_type) :: a
|
|
|
|
type(psb_dspmat_type) :: a
|
|
|
|
type(psb_d_vect_type) :: b
|
|
|
|
|
|
|
|
type(psb_desc_type) :: desc_a
|
|
|
|
type(psb_desc_type) :: desc_a
|
|
|
|
integer(psb_ipk_), intent(out) :: info
|
|
|
|
integer(psb_ipk_), intent(out) :: info
|
|
|
|
|
|
|
|
real(psb_dpk_), optional :: b_glob(:)
|
|
|
|
|
|
|
|
type(psb_d_vect_type), optional :: b
|
|
|
|
|
|
|
|
real(psb_dpk_), optional :: x_glob(:)
|
|
|
|
|
|
|
|
type(psb_d_vect_type), optional :: x
|
|
|
|
integer(psb_ipk_), optional :: inroot
|
|
|
|
integer(psb_ipk_), optional :: inroot
|
|
|
|
character(len=5), optional :: fmt
|
|
|
|
character(len=*), optional :: fmt
|
|
|
|
class(psb_d_base_sparse_mat), optional :: mold
|
|
|
|
class(psb_d_base_sparse_mat), optional :: mold
|
|
|
|
procedure(psb_parts), optional :: parts
|
|
|
|
procedure(psb_parts), optional :: parts
|
|
|
|
integer(psb_ipk_), optional :: v(:)
|
|
|
|
integer(psb_ipk_), optional :: v(:)
|
|
|
|
|
|
|
|
|
|
|
|
! local variables
|
|
|
|
! local variables
|
|
|
|
logical :: use_parts, use_v
|
|
|
|
logical :: use_parts, use_v
|
|
|
|
integer(psb_ipk_) :: np, iam, length_row
|
|
|
|
integer(psb_ipk_) :: np, iam, np_sharing
|
|
|
|
integer(psb_ipk_) :: i_count, j_count,&
|
|
|
|
integer(psb_ipk_) :: i_count, j_count,&
|
|
|
|
& k_count, root, liwork, nrow, ncol, nnzero, nrhs,&
|
|
|
|
& k_count, root, liwork, nrow, ncol, nnzero, nrhs,&
|
|
|
|
& i, ll, nz, isize, iproc, nnr, err, err_act, int_err(5)
|
|
|
|
& i, ll, nz, isize, iproc, nnr, err, err_act, int_err(5)
|
|
|
@ -120,7 +116,7 @@ subroutine dmatdist(a_glob, a, ictxt, desc_a,&
|
|
|
|
|
|
|
|
|
|
|
|
info = psb_success_
|
|
|
|
info = psb_success_
|
|
|
|
err = 0
|
|
|
|
err = 0
|
|
|
|
name = 'mat_distf'
|
|
|
|
name = 'psb_d_mat_dist'
|
|
|
|
call psb_erractionsave(err_act)
|
|
|
|
call psb_erractionsave(err_act)
|
|
|
|
|
|
|
|
|
|
|
|
! executable statements
|
|
|
|
! executable statements
|
|
|
@ -150,6 +146,18 @@ subroutine dmatdist(a_glob, a, ictxt, desc_a,&
|
|
|
|
call psb_errpush(info,name,a_err=" v, parts")
|
|
|
|
call psb_errpush(info,name,a_err=" v, parts")
|
|
|
|
goto 9999
|
|
|
|
goto 9999
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
if ( count((/present(b_glob),present(b)/)) == 1 ) then
|
|
|
|
|
|
|
|
info=psb_err_optional_arg_pair_
|
|
|
|
|
|
|
|
call psb_errpush(info,name,a_err=" b_glob, b")
|
|
|
|
|
|
|
|
goto 9999
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
if ( count((/present(x_glob),present(x)/)) == 1 ) then
|
|
|
|
|
|
|
|
info=psb_err_optional_arg_pair_
|
|
|
|
|
|
|
|
call psb_errpush(info,name,a_err=" x_glob, x")
|
|
|
|
|
|
|
|
goto 9999
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
! broadcast informations to other processors
|
|
|
|
! broadcast informations to other processors
|
|
|
|
call psb_bcast(ictxt,nrow, root)
|
|
|
|
call psb_bcast(ictxt,nrow, root)
|
|
|
@ -166,7 +174,7 @@ subroutine dmatdist(a_glob, a, ictxt, desc_a,&
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
if (iam == root) then
|
|
|
|
if (iam == root) then
|
|
|
|
write (*, fmt = *) 'start matdist',root, size(iwork),&
|
|
|
|
write (*, fmt = *) 'start matdist',root, size(iwork),&
|
|
|
|
&nrow, ncol, nnzero,nrhs, use_parts, use_v
|
|
|
|
&nrow, ncol, nnzero,nrhs
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
if (use_parts) then
|
|
|
|
if (use_parts) then
|
|
|
|
call psb_cdall(ictxt,desc_a,info,mg=nrow,parts=parts)
|
|
|
|
call psb_cdall(ictxt,desc_a,info,mg=nrow,parts=parts)
|
|
|
@ -175,7 +183,6 @@ subroutine dmatdist(a_glob, a, ictxt, desc_a,&
|
|
|
|
else
|
|
|
|
else
|
|
|
|
info = -1
|
|
|
|
info = -1
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
|
|
if(info /= psb_success_) then
|
|
|
|
if(info /= psb_success_) then
|
|
|
|
info=psb_err_from_subroutine_
|
|
|
|
info=psb_err_from_subroutine_
|
|
|
|
ch_err='psb_cdall'
|
|
|
|
ch_err='psb_cdall'
|
|
|
@ -185,19 +192,10 @@ subroutine dmatdist(a_glob, a, ictxt, desc_a,&
|
|
|
|
call psb_spall(a,desc_a,info,nnz=((nnzero+np-1)/np))
|
|
|
|
call psb_spall(a,desc_a,info,nnz=((nnzero+np-1)/np))
|
|
|
|
if(info /= psb_success_) then
|
|
|
|
if(info /= psb_success_) then
|
|
|
|
info=psb_err_from_subroutine_
|
|
|
|
info=psb_err_from_subroutine_
|
|
|
|
ch_err='psb_psspall'
|
|
|
|
ch_err='psb_spall'
|
|
|
|
call psb_errpush(info,name,a_err=ch_err)
|
|
|
|
call psb_errpush(info,name,a_err=ch_err)
|
|
|
|
goto 9999
|
|
|
|
goto 9999
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
call psb_geall(b,desc_a,info)
|
|
|
|
|
|
|
|
if(info /= psb_success_) then
|
|
|
|
|
|
|
|
info=psb_err_from_subroutine_
|
|
|
|
|
|
|
|
ch_err='psb_psdsall'
|
|
|
|
|
|
|
|
call psb_errpush(info,name,a_err=ch_err)
|
|
|
|
|
|
|
|
goto 9999
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
isize = 3*nb*max(((nnzero+nrow)/nrow),nb)
|
|
|
|
isize = 3*nb*max(((nnzero+nrow)/nrow),nb)
|
|
|
|
allocate(val(isize),irow(isize),icol(isize),stat=info)
|
|
|
|
allocate(val(isize),irow(isize),icol(isize),stat=info)
|
|
|
@ -213,24 +211,31 @@ subroutine dmatdist(a_glob, a, ictxt, desc_a,&
|
|
|
|
do while (i_count <= nrow)
|
|
|
|
do while (i_count <= nrow)
|
|
|
|
|
|
|
|
|
|
|
|
if (use_parts) then
|
|
|
|
if (use_parts) then
|
|
|
|
call parts(i_count,nrow,np,iwork, length_row)
|
|
|
|
call parts(i_count,nrow,np,iwork, np_sharing)
|
|
|
|
if (length_row == 1) then
|
|
|
|
!
|
|
|
|
|
|
|
|
! np_sharing allows for overlap in the data distribution.
|
|
|
|
|
|
|
|
! If an index is overlapped, then we have to send its row
|
|
|
|
|
|
|
|
! to multiple processes. NOTE: we are assuming the output
|
|
|
|
|
|
|
|
! from PARTS is coherent, otherwise a deadlock is the most
|
|
|
|
|
|
|
|
! likely outcome.
|
|
|
|
|
|
|
|
!
|
|
|
|
j_count = i_count
|
|
|
|
j_count = i_count
|
|
|
|
|
|
|
|
if (np_sharing == 1) then
|
|
|
|
iproc = iwork(1)
|
|
|
|
iproc = iwork(1)
|
|
|
|
do
|
|
|
|
do
|
|
|
|
j_count = j_count + 1
|
|
|
|
j_count = j_count + 1
|
|
|
|
if (j_count-i_count >= nb) exit
|
|
|
|
if (j_count-i_count >= nb) exit
|
|
|
|
if (j_count > nrow) exit
|
|
|
|
if (j_count > nrow) exit
|
|
|
|
call parts(j_count,nrow,np,iwork, length_row)
|
|
|
|
call parts(j_count,nrow,np,iwork, np_sharing)
|
|
|
|
if (length_row /= 1 ) exit
|
|
|
|
if (np_sharing /= 1 ) exit
|
|
|
|
if (iwork(1) /= iproc ) exit
|
|
|
|
if (iwork(1) /= iproc ) exit
|
|
|
|
end do
|
|
|
|
end do
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
else
|
|
|
|
else
|
|
|
|
length_row = 1
|
|
|
|
np_sharing = 1
|
|
|
|
j_count = i_count
|
|
|
|
j_count = i_count
|
|
|
|
iproc = v(i_count)
|
|
|
|
iproc = v(i_count)
|
|
|
|
|
|
|
|
iwork(1:np_sharing) = iproc
|
|
|
|
do
|
|
|
|
do
|
|
|
|
j_count = j_count + 1
|
|
|
|
j_count = j_count + 1
|
|
|
|
if (j_count-i_count >= nb) exit
|
|
|
|
if (j_count-i_count >= nb) exit
|
|
|
@ -239,7 +244,6 @@ subroutine dmatdist(a_glob, a, ictxt, desc_a,&
|
|
|
|
end do
|
|
|
|
end do
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
|
|
if (length_row == 1) then
|
|
|
|
|
|
|
|
! now we should insert rows i_count..j_count-1
|
|
|
|
! now we should insert rows i_count..j_count-1
|
|
|
|
nnr = j_count - i_count
|
|
|
|
nnr = j_count - i_count
|
|
|
|
|
|
|
|
|
|
|
@ -258,7 +262,10 @@ subroutine dmatdist(a_glob, a, ictxt, desc_a,&
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
ll = ll + nz
|
|
|
|
ll = ll + nz
|
|
|
|
end do
|
|
|
|
end do
|
|
|
|
!!$ write(0,*) 'mat_dist: sending rows ',i_count,j_count-1,' to proc',iproc, ll
|
|
|
|
|
|
|
|
|
|
|
|
do k_count = 1, np_sharing
|
|
|
|
|
|
|
|
iproc = iwork(k_count)
|
|
|
|
|
|
|
|
|
|
|
|
if (iproc == iam) then
|
|
|
|
if (iproc == iam) then
|
|
|
|
call psb_spins(ll,irow,icol,val,a,desc_a,info)
|
|
|
|
call psb_spins(ll,irow,icol,val,a,desc_a,info)
|
|
|
|
if(info /= psb_success_) then
|
|
|
|
if(info /= psb_success_) then
|
|
|
@ -267,25 +274,19 @@ subroutine dmatdist(a_glob, a, ictxt, desc_a,&
|
|
|
|
call psb_errpush(info,name,a_err=ch_err)
|
|
|
|
call psb_errpush(info,name,a_err=ch_err)
|
|
|
|
goto 9999
|
|
|
|
goto 9999
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
call psb_geins(nnr,(/(i,i=i_count,j_count-1)/),b_glob(i_count:j_count-1),&
|
|
|
|
|
|
|
|
& b,desc_a,info)
|
|
|
|
|
|
|
|
if(info /= psb_success_) then
|
|
|
|
|
|
|
|
info=psb_err_from_subroutine_
|
|
|
|
|
|
|
|
ch_err='psb_ins'
|
|
|
|
|
|
|
|
call psb_errpush(info,name,a_err=ch_err)
|
|
|
|
|
|
|
|
goto 9999
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
else
|
|
|
|
else
|
|
|
|
call psb_snd(ictxt,nnr,iproc)
|
|
|
|
call psb_snd(ictxt,nnr,iproc)
|
|
|
|
call psb_snd(ictxt,ll,iproc)
|
|
|
|
call psb_snd(ictxt,ll,iproc)
|
|
|
|
call psb_snd(ictxt,irow(1:ll),iproc)
|
|
|
|
call psb_snd(ictxt,irow(1:ll),iproc)
|
|
|
|
call psb_snd(ictxt,icol(1:ll),iproc)
|
|
|
|
call psb_snd(ictxt,icol(1:ll),iproc)
|
|
|
|
call psb_snd(ictxt,val(1:ll),iproc)
|
|
|
|
call psb_snd(ictxt,val(1:ll),iproc)
|
|
|
|
call psb_snd(ictxt,b_glob(i_count:j_count-1),iproc)
|
|
|
|
|
|
|
|
call psb_rcv(ictxt,ll,iproc)
|
|
|
|
call psb_rcv(ictxt,ll,iproc)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
end do
|
|
|
|
else if (iam /= root) then
|
|
|
|
else if (iam /= root) then
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
do k_count = 1, np_sharing
|
|
|
|
|
|
|
|
iproc = iwork(k_count)
|
|
|
|
if (iproc == iam) then
|
|
|
|
if (iproc == iam) then
|
|
|
|
call psb_rcv(ictxt,nnr,root)
|
|
|
|
call psb_rcv(ictxt,nnr,root)
|
|
|
|
call psb_rcv(ictxt,ll,root)
|
|
|
|
call psb_rcv(ictxt,ll,root)
|
|
|
@ -304,81 +305,6 @@ subroutine dmatdist(a_glob, a, ictxt, desc_a,&
|
|
|
|
call psb_rcv(ictxt,irow(1:ll),root)
|
|
|
|
call psb_rcv(ictxt,irow(1:ll),root)
|
|
|
|
call psb_rcv(ictxt,icol(1:ll),root)
|
|
|
|
call psb_rcv(ictxt,icol(1:ll),root)
|
|
|
|
call psb_rcv(ictxt,val(1:ll),root)
|
|
|
|
call psb_rcv(ictxt,val(1:ll),root)
|
|
|
|
call psb_rcv(ictxt,b_glob(i_count:i_count+nnr-1),root)
|
|
|
|
|
|
|
|
call psb_snd(ictxt,ll,root)
|
|
|
|
|
|
|
|
call psb_spins(ll,irow,icol,val,a,desc_a,info)
|
|
|
|
|
|
|
|
if(info /= psb_success_) then
|
|
|
|
|
|
|
|
info=psb_err_from_subroutine_
|
|
|
|
|
|
|
|
ch_err='psspins'
|
|
|
|
|
|
|
|
call psb_errpush(info,name,a_err=ch_err)
|
|
|
|
|
|
|
|
goto 9999
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
call psb_geins(nnr,(/(i,i=i_count,i_count+nnr-1)/),&
|
|
|
|
|
|
|
|
& b_glob(i_count:i_count+nnr-1),b,desc_a,info)
|
|
|
|
|
|
|
|
if(info /= psb_success_) then
|
|
|
|
|
|
|
|
info=psb_err_from_subroutine_
|
|
|
|
|
|
|
|
ch_err='psdsins'
|
|
|
|
|
|
|
|
call psb_errpush(info,name,a_err=ch_err)
|
|
|
|
|
|
|
|
goto 9999
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
i_count = j_count
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
! here processors are counted 1..np
|
|
|
|
|
|
|
|
do j_count = 1, length_row
|
|
|
|
|
|
|
|
k_count = iwork(j_count)
|
|
|
|
|
|
|
|
if (iam == root) then
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ll = 0
|
|
|
|
|
|
|
|
do i= i_count, i_count
|
|
|
|
|
|
|
|
call a_glob%csget(i,i,nz,&
|
|
|
|
|
|
|
|
& irow,icol,val,info,nzin=ll,append=.true.)
|
|
|
|
|
|
|
|
if (info /= psb_success_) then
|
|
|
|
|
|
|
|
if (nz >min(size(irow(ll+1:)),size(icol(ll+1:)),size(val(ll+1:)))) then
|
|
|
|
|
|
|
|
write(psb_err_unit,*) 'Allocation failure? This should not happen!'
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
call psb_errpush(info,name,a_err=ch_err)
|
|
|
|
|
|
|
|
goto 9999
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
ll = ll + nz
|
|
|
|
|
|
|
|
end do
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (k_count == iam) then
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
call psb_spins(ll,irow,icol,val,a,desc_a,info)
|
|
|
|
|
|
|
|
if(info /= psb_success_) then
|
|
|
|
|
|
|
|
info=psb_err_from_subroutine_
|
|
|
|
|
|
|
|
ch_err='psspins'
|
|
|
|
|
|
|
|
call psb_errpush(info,name,a_err=ch_err)
|
|
|
|
|
|
|
|
goto 9999
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
call psb_geins(ione,(/i_count/),b_glob(i_count:i_count),&
|
|
|
|
|
|
|
|
& b,desc_a,info)
|
|
|
|
|
|
|
|
if(info /= psb_success_) then
|
|
|
|
|
|
|
|
info=psb_err_from_subroutine_
|
|
|
|
|
|
|
|
ch_err='psdsins'
|
|
|
|
|
|
|
|
call psb_errpush(info,name,a_err=ch_err)
|
|
|
|
|
|
|
|
goto 9999
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
call psb_snd(ictxt,ll,k_count)
|
|
|
|
|
|
|
|
call psb_snd(ictxt,irow(1:ll),k_count)
|
|
|
|
|
|
|
|
call psb_snd(ictxt,icol(1:ll),k_count)
|
|
|
|
|
|
|
|
call psb_snd(ictxt,val(1:ll),k_count)
|
|
|
|
|
|
|
|
call psb_snd(ictxt,b_glob(i_count),k_count)
|
|
|
|
|
|
|
|
call psb_rcv(ictxt,ll,k_count)
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
else if (iam /= root) then
|
|
|
|
|
|
|
|
if (k_count == iam) then
|
|
|
|
|
|
|
|
call psb_rcv(ictxt,ll,root)
|
|
|
|
|
|
|
|
call psb_rcv(ictxt,irow(1:ll),root)
|
|
|
|
|
|
|
|
call psb_rcv(ictxt,icol(1:ll),root)
|
|
|
|
|
|
|
|
call psb_rcv(ictxt,val(1:ll),root)
|
|
|
|
|
|
|
|
call psb_rcv(ictxt,b_glob(i_count),root)
|
|
|
|
|
|
|
|
call psb_snd(ictxt,ll,root)
|
|
|
|
call psb_snd(ictxt,ll,root)
|
|
|
|
call psb_spins(ll,irow,icol,val,a,desc_a,info)
|
|
|
|
call psb_spins(ll,irow,icol,val,a,desc_a,info)
|
|
|
|
if(info /= psb_success_) then
|
|
|
|
if(info /= psb_success_) then
|
|
|
@ -387,22 +313,12 @@ subroutine dmatdist(a_glob, a, ictxt, desc_a,&
|
|
|
|
call psb_errpush(info,name,a_err=ch_err)
|
|
|
|
call psb_errpush(info,name,a_err=ch_err)
|
|
|
|
goto 9999
|
|
|
|
goto 9999
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
call psb_geins(ione,(/i_count/),b_glob(i_count:i_count),&
|
|
|
|
|
|
|
|
& b,desc_a,info)
|
|
|
|
|
|
|
|
if(info /= psb_success_) then
|
|
|
|
|
|
|
|
info=psb_err_from_subroutine_
|
|
|
|
|
|
|
|
ch_err='psdsins'
|
|
|
|
|
|
|
|
call psb_errpush(info,name,a_err=ch_err)
|
|
|
|
|
|
|
|
goto 9999
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
end do
|
|
|
|
end do
|
|
|
|
i_count = i_count + 1
|
|
|
|
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
i_count = j_count
|
|
|
|
end do
|
|
|
|
end do
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
call psb_barrier(ictxt)
|
|
|
|
call psb_barrier(ictxt)
|
|
|
|
t0 = psb_wtime()
|
|
|
|
t0 = psb_wtime()
|
|
|
|
call psb_cdasb(desc_a,info)
|
|
|
|
call psb_cdasb(desc_a,info)
|
|
|
@ -431,20 +347,36 @@ subroutine dmatdist(a_glob, a, ictxt, desc_a,&
|
|
|
|
write(psb_out_unit,*) 'sparse matrix assembly: ',t3-t2
|
|
|
|
write(psb_out_unit,*) 'sparse matrix assembly: ',t3-t2
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
|
|
call psb_geasb(b,desc_a,info)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deallocate(val,irow,icol,stat=info)
|
|
|
|
if(info /= psb_success_)then
|
|
|
|
if(info /= psb_success_)then
|
|
|
|
info=psb_err_from_subroutine_
|
|
|
|
info=psb_err_from_subroutine_
|
|
|
|
ch_err='psdsasb'
|
|
|
|
ch_err='deallocate'
|
|
|
|
call psb_errpush(info,name,a_err=ch_err)
|
|
|
|
call psb_errpush(info,name,a_err=ch_err)
|
|
|
|
goto 9999
|
|
|
|
goto 9999
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
deallocate(val,irow,icol,stat=info)
|
|
|
|
|
|
|
|
if(info /= psb_success_)then
|
|
|
|
if (present(b_glob).and.present(b)) then
|
|
|
|
|
|
|
|
call psb_scatter(b_glob,b,desc_a,info,root=root)
|
|
|
|
|
|
|
|
if (info /= 0) then
|
|
|
|
info=psb_err_from_subroutine_
|
|
|
|
info=psb_err_from_subroutine_
|
|
|
|
ch_err='deallocate'
|
|
|
|
ch_err='psb_scatter'
|
|
|
|
call psb_errpush(info,name,a_err=ch_err)
|
|
|
|
call psb_errpush(info,name,a_err=ch_err)
|
|
|
|
goto 9999
|
|
|
|
goto 9999
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (present(x_glob).and.present(x)) then
|
|
|
|
|
|
|
|
call psb_scatter(x_glob,x,desc_a,info,root=root)
|
|
|
|
|
|
|
|
if (info /= 0) then
|
|
|
|
|
|
|
|
info=psb_err_from_subroutine_
|
|
|
|
|
|
|
|
ch_err='psb_scatter'
|
|
|
|
|
|
|
|
call psb_errpush(info,name,a_err=ch_err)
|
|
|
|
|
|
|
|
goto 9999
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
|
|
deallocate(iwork)
|
|
|
|
deallocate(iwork)
|
|
|
|
if (iam == root) write (*, fmt = *) 'end matdist'
|
|
|
|
if (iam == root) write (*, fmt = *) 'end matdist'
|
|
|
@ -456,4 +388,4 @@ subroutine dmatdist(a_glob, a, ictxt, desc_a,&
|
|
|
|
|
|
|
|
|
|
|
|
return
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
end subroutine dmatdist
|
|
|
|
end subroutine psb_dmatdist
|
|
|
|