|
|
@ -37,7 +37,7 @@ module psb_mat_dist_mod
|
|
|
|
contains
|
|
|
|
contains
|
|
|
|
|
|
|
|
|
|
|
|
subroutine dmatdistf (a_glob, a, parts, ictxt, desc_a,&
|
|
|
|
subroutine dmatdistf (a_glob, a, parts, ictxt, desc_a,&
|
|
|
|
& b_glob, b, info, inroot,fmt)
|
|
|
|
& b_glob, b, info, inroot,fmt,nb)
|
|
|
|
!
|
|
|
|
!
|
|
|
|
! 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
|
|
|
@ -105,7 +105,7 @@ contains
|
|
|
|
real(kind(1.d0)), allocatable :: b(:)
|
|
|
|
real(kind(1.d0)), allocatable :: b(:)
|
|
|
|
type (psb_desc_type) :: desc_a
|
|
|
|
type (psb_desc_type) :: desc_a
|
|
|
|
integer, intent(out) :: info
|
|
|
|
integer, intent(out) :: info
|
|
|
|
integer, optional :: inroot
|
|
|
|
integer, optional :: inroot,nb
|
|
|
|
character(len=5), optional :: fmt
|
|
|
|
character(len=5), optional :: fmt
|
|
|
|
interface
|
|
|
|
interface
|
|
|
|
|
|
|
|
|
|
|
@ -122,12 +122,12 @@ contains
|
|
|
|
integer :: np, iam
|
|
|
|
integer :: np, iam
|
|
|
|
integer :: ircode, length_row, i_count, j_count,&
|
|
|
|
integer :: ircode, length_row, i_count, j_count,&
|
|
|
|
& k_count, blockdim, root, liwork, nrow, ncol, nnzero, nrhs,&
|
|
|
|
& k_count, blockdim, root, liwork, nrow, ncol, nnzero, nrhs,&
|
|
|
|
& i,j,k, ll, nz, isize, iproc, nnr, err, err_act, int_err(5)
|
|
|
|
& i,j,k, ll, nz, isize, iproc, nnr, err, err_act, int_err(5),nb_
|
|
|
|
integer, allocatable :: iwork(:)
|
|
|
|
integer, allocatable :: iwork(:)
|
|
|
|
character :: afmt*5, atyp*5
|
|
|
|
character :: afmt*5, atyp*5
|
|
|
|
integer, allocatable :: irow(:),icol(:)
|
|
|
|
integer, allocatable :: irow(:),icol(:)
|
|
|
|
real(kind(1.d0)), allocatable :: val(:)
|
|
|
|
real(kind(1.d0)), allocatable :: val(:)
|
|
|
|
integer, parameter :: nb=30
|
|
|
|
integer, parameter :: nbdef=30
|
|
|
|
real(kind(1.d0)) :: t0, t1, t2, t3, t4, t5
|
|
|
|
real(kind(1.d0)) :: t0, t1, t2, t3, t4, t5
|
|
|
|
character(len=20) :: name, ch_err
|
|
|
|
character(len=20) :: name, ch_err
|
|
|
|
|
|
|
|
|
|
|
@ -142,6 +142,11 @@ contains
|
|
|
|
else
|
|
|
|
else
|
|
|
|
root = 0
|
|
|
|
root = 0
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
|
|
|
|
if (present(nb)) then
|
|
|
|
|
|
|
|
nb_ = max(nb,1)
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
nb_ = nbdef
|
|
|
|
|
|
|
|
end if
|
|
|
|
call psb_info(ictxt, iam, np)
|
|
|
|
call psb_info(ictxt, iam, np)
|
|
|
|
|
|
|
|
|
|
|
|
if (iam == root) then
|
|
|
|
if (iam == root) then
|
|
|
@ -203,10 +208,11 @@ contains
|
|
|
|
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
|
|
|
|
isize = max(3*nb,ncol)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
allocate(val(nb*ncol),irow(nb*ncol),icol(nb*ncol),stat=info)
|
|
|
|
isize = ((nnzero+nrow)/nrow) * nb_
|
|
|
|
|
|
|
|
isize = max(isize,4*nb_)
|
|
|
|
|
|
|
|
allocate(val(isize),irow(isize),icol(isize),stat=info)
|
|
|
|
if(info/=0) then
|
|
|
|
if(info/=0) then
|
|
|
|
info=4010
|
|
|
|
info=4010
|
|
|
|
ch_err='Allocate'
|
|
|
|
ch_err='Allocate'
|
|
|
@ -225,7 +231,7 @@ contains
|
|
|
|
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, length_row)
|
|
|
|
if (length_row /= 1 ) exit
|
|
|
|
if (length_row /= 1 ) exit
|
|
|
@ -240,7 +246,7 @@ contains
|
|
|
|
ll = 0
|
|
|
|
ll = 0
|
|
|
|
do i= i_count, j_count-1
|
|
|
|
do i= i_count, j_count-1
|
|
|
|
call psb_sp_getrow(i,a_glob,nz,&
|
|
|
|
call psb_sp_getrow(i,a_glob,nz,&
|
|
|
|
& irow(ll+1:),icol(ll+1:),val(ll+1:), info)
|
|
|
|
& irow,icol,val,info,nzin=ll,append=.true.)
|
|
|
|
if (info /= 0) then
|
|
|
|
if (info /= 0) then
|
|
|
|
if (nz > min(size(irow(ll+1:)),size(icol(ll+1:)),size(val(ll+1:)))) then
|
|
|
|
if (nz > min(size(irow(ll+1:)),size(icol(ll+1:)),size(val(ll+1:)))) then
|
|
|
|
write(0,*) 'Allocation failure? This should not happen!'
|
|
|
|
write(0,*) 'Allocation failure? This should not happen!'
|
|
|
@ -271,8 +277,11 @@ contains
|
|
|
|
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_rcv(ictxt,ll,iproc)
|
|
|
|
call psb_snd(ictxt,icol(1:ll),iproc)
|
|
|
|
call psb_snd(ictxt,icol(1:ll),iproc)
|
|
|
|
|
|
|
|
call psb_rcv(ictxt,ll,iproc)
|
|
|
|
call psb_snd(ictxt,val(1:ll),iproc)
|
|
|
|
call psb_snd(ictxt,val(1:ll),iproc)
|
|
|
|
|
|
|
|
call psb_rcv(ictxt,ll,iproc)
|
|
|
|
call psb_snd(ictxt,b_glob(i_count:j_count-1),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
|
|
|
@ -294,10 +303,15 @@ contains
|
|
|
|
|
|
|
|
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
call psb_rcv(ictxt,irow(1:ll),root)
|
|
|
|
call psb_rcv(ictxt,irow(1:ll),root)
|
|
|
|
|
|
|
|
call psb_snd(ictxt,ll,root)
|
|
|
|
|
|
|
|
|
|
|
|
call psb_rcv(ictxt,icol(1:ll),root)
|
|
|
|
call psb_rcv(ictxt,icol(1:ll),root)
|
|
|
|
|
|
|
|
call psb_snd(ictxt,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_snd(ictxt,ll,root)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
call psb_rcv(ictxt,b_glob(i_count:i_count+nnr-1),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/=0) then
|
|
|
|
if(info/=0) then
|
|
|
|
info=4010
|
|
|
|
info=4010
|
|
|
@ -313,6 +327,8 @@ contains
|
|
|
|
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_snd(ictxt,ll,root)
|
|
|
|
|
|
|
|
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
@ -328,7 +344,7 @@ contains
|
|
|
|
ll = 0
|
|
|
|
ll = 0
|
|
|
|
do i= i_count, i_count
|
|
|
|
do i= i_count, i_count
|
|
|
|
call psb_sp_getrow(i,a_glob,nz,&
|
|
|
|
call psb_sp_getrow(i,a_glob,nz,&
|
|
|
|
& irow(ll+1:),icol(ll+1:),val(ll+1:), info)
|
|
|
|
& irow,icol,val,info,nzin=ll,append=.true.)
|
|
|
|
if (info /= 0) then
|
|
|
|
if (info /= 0) then
|
|
|
|
if (nz >min(size(irow(ll+1:)),size(icol(ll+1:)),size(val(ll+1:)))) then
|
|
|
|
if (nz >min(size(irow(ll+1:)),size(icol(ll+1:)),size(val(ll+1:)))) then
|
|
|
|
write(0,*) 'Allocation failure? This should not happen!'
|
|
|
|
write(0,*) 'Allocation failure? This should not happen!'
|
|
|
@ -359,8 +375,11 @@ contains
|
|
|
|
else
|
|
|
|
else
|
|
|
|
call psb_snd(ictxt,ll,k_count)
|
|
|
|
call psb_snd(ictxt,ll,k_count)
|
|
|
|
call psb_snd(ictxt,irow(1:ll),k_count)
|
|
|
|
call psb_snd(ictxt,irow(1:ll),k_count)
|
|
|
|
|
|
|
|
call psb_rcv(ictxt,ll,k_count)
|
|
|
|
call psb_snd(ictxt,icol(1:ll),k_count)
|
|
|
|
call psb_snd(ictxt,icol(1:ll),k_count)
|
|
|
|
|
|
|
|
call psb_rcv(ictxt,ll,k_count)
|
|
|
|
call psb_snd(ictxt,val(1:ll),k_count)
|
|
|
|
call psb_snd(ictxt,val(1:ll),k_count)
|
|
|
|
|
|
|
|
call psb_rcv(ictxt,ll,k_count)
|
|
|
|
call psb_snd(ictxt,b_glob(i_count),k_count)
|
|
|
|
call psb_snd(ictxt,b_glob(i_count),k_count)
|
|
|
|
call psb_rcv(ictxt,ll,k_count)
|
|
|
|
call psb_rcv(ictxt,ll,k_count)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
@ -369,10 +388,12 @@ contains
|
|
|
|
|
|
|
|
|
|
|
|
call psb_rcv(ictxt,ll,root)
|
|
|
|
call psb_rcv(ictxt,ll,root)
|
|
|
|
call psb_rcv(ictxt,irow(1:ll),root)
|
|
|
|
call psb_rcv(ictxt,irow(1:ll),root)
|
|
|
|
|
|
|
|
call psb_snd(ictxt,ll,root)
|
|
|
|
call psb_rcv(ictxt,icol(1:ll),root)
|
|
|
|
call psb_rcv(ictxt,icol(1:ll),root)
|
|
|
|
|
|
|
|
call psb_snd(ictxt,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),root)
|
|
|
|
|
|
|
|
call psb_snd(ictxt,ll,root)
|
|
|
|
call psb_snd(ictxt,ll,root)
|
|
|
|
|
|
|
|
call psb_rcv(ictxt,b_glob(i_count),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/=0) then
|
|
|
|
if(info/=0) then
|
|
|
|
info=4010
|
|
|
|
info=4010
|
|
|
@ -388,6 +409,7 @@ contains
|
|
|
|
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_snd(ictxt,ll,root)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
end do
|
|
|
|
end do
|
|
|
@ -463,7 +485,7 @@ contains
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
subroutine dmatdistv (a_glob, a, v, ictxt, desc_a,&
|
|
|
|
subroutine dmatdistv (a_glob, a, v, ictxt, desc_a,&
|
|
|
|
& b_glob, b, info, inroot,fmt)
|
|
|
|
& b_glob, b, info, inroot,fmt,nb)
|
|
|
|
!
|
|
|
|
!
|
|
|
|
! 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
|
|
|
@ -529,18 +551,18 @@ contains
|
|
|
|
real(kind(1.d0)), allocatable :: b(:)
|
|
|
|
real(kind(1.d0)), allocatable :: b(:)
|
|
|
|
type (psb_desc_type) :: desc_a
|
|
|
|
type (psb_desc_type) :: desc_a
|
|
|
|
integer, intent(out) :: info
|
|
|
|
integer, intent(out) :: info
|
|
|
|
integer, optional :: inroot
|
|
|
|
integer, optional :: inroot,nb
|
|
|
|
character(len=5), optional :: fmt
|
|
|
|
character(len=5), optional :: fmt
|
|
|
|
|
|
|
|
|
|
|
|
integer :: np, iam
|
|
|
|
integer :: np, iam
|
|
|
|
integer :: ircode, length_row, i_count, j_count,&
|
|
|
|
integer :: ircode, length_row, i_count, j_count,&
|
|
|
|
& k_count, blockdim, root, liwork, nrow, ncol, nnzero, nrhs,&
|
|
|
|
& k_count, blockdim, root, liwork, nrow, ncol, nnzero, nrhs,&
|
|
|
|
& i,j,k, ll, nz, isize, iproc, nnr, err, err_act, int_err(5)
|
|
|
|
& i,j,k, ll, nz, isize, iproc, nnr, err, err_act, int_err(5),nb_
|
|
|
|
integer, allocatable :: iwork(:)
|
|
|
|
integer, allocatable :: iwork(:)
|
|
|
|
character :: afmt*5, atyp*5
|
|
|
|
character :: afmt*5, atyp*5
|
|
|
|
integer, allocatable :: irow(:),icol(:)
|
|
|
|
integer, allocatable :: irow(:),icol(:)
|
|
|
|
real(kind(1.d0)), allocatable :: val(:)
|
|
|
|
real(kind(1.d0)), allocatable :: val(:)
|
|
|
|
integer, parameter :: nb=30
|
|
|
|
integer, parameter :: nbdef=30
|
|
|
|
real(kind(1.d0)) :: t0, t1, t2, t3, t4, t5
|
|
|
|
real(kind(1.d0)) :: t0, t1, t2, t3, t4, t5
|
|
|
|
character(len=20) :: name, ch_err
|
|
|
|
character(len=20) :: name, ch_err
|
|
|
|
|
|
|
|
|
|
|
@ -555,6 +577,11 @@ contains
|
|
|
|
else
|
|
|
|
else
|
|
|
|
root = 0
|
|
|
|
root = 0
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
|
|
|
|
if (present(nb)) then
|
|
|
|
|
|
|
|
nb_ = max(nb,1)
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
nb_ = nbdef
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
|
|
call psb_info(ictxt, iam, np)
|
|
|
|
call psb_info(ictxt, iam, np)
|
|
|
|
if (iam == root) then
|
|
|
|
if (iam == root) then
|
|
|
@ -577,6 +604,7 @@ contains
|
|
|
|
|
|
|
|
|
|
|
|
nnzero = size(a_glob%aspk)
|
|
|
|
nnzero = size(a_glob%aspk)
|
|
|
|
nrhs = 1
|
|
|
|
nrhs = 1
|
|
|
|
|
|
|
|
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
! broadcast informations to other processors
|
|
|
|
! broadcast informations to other processors
|
|
|
|
call psb_bcast(ictxt,nrow, root)
|
|
|
|
call psb_bcast(ictxt,nrow, root)
|
|
|
@ -593,6 +621,29 @@ contains
|
|
|
|
goto 9999
|
|
|
|
goto 9999
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (iam /= root) then
|
|
|
|
|
|
|
|
allocate(a_glob%ia1(nnzero),&
|
|
|
|
|
|
|
|
& a_glob%ia2(nrow+1),a_glob%aspk(nnzero),a_glob%pl(1),a_glob%pr(1),stat=info)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(info/=0) then
|
|
|
|
|
|
|
|
info=4010
|
|
|
|
|
|
|
|
ch_err='psb_cdall'
|
|
|
|
|
|
|
|
call psb_errpush(info,name,a_err=ch_err)
|
|
|
|
|
|
|
|
goto 9999
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
a_glob%pl=0
|
|
|
|
|
|
|
|
a_glob%pr=0
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
call psb_bcast(ictxt,a_glob%m,root)
|
|
|
|
|
|
|
|
call psb_bcast(ictxt,a_glob%k,root)
|
|
|
|
|
|
|
|
call psb_bcast(ictxt,a_glob%fida,root)
|
|
|
|
|
|
|
|
call psb_bcast(ictxt,a_glob%descra,root)
|
|
|
|
|
|
|
|
call psb_bcast(ictxt,a_glob%infoa(1:psb_ifasize_),root)
|
|
|
|
|
|
|
|
call psb_bcast(ictxt,a_glob%ia1(1:nnzero),root)
|
|
|
|
|
|
|
|
call psb_bcast(ictxt,a_glob%aspk(1:nnzero),root)
|
|
|
|
|
|
|
|
call psb_bcast(ictxt,a_glob%ia2(1:nrow+1),root)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
call psb_cdall(ictxt,desc_a,info,vg=v)
|
|
|
|
call psb_cdall(ictxt,desc_a,info,vg=v)
|
|
|
|
if(info/=0) then
|
|
|
|
if(info/=0) then
|
|
|
|
info=4010
|
|
|
|
info=4010
|
|
|
@ -615,10 +666,11 @@ contains
|
|
|
|
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
|
|
|
|
isize = max(3*nb,ncol)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
allocate(val(nb*ncol),irow(nb*ncol),icol(nb*ncol),stat=info)
|
|
|
|
isize = ((nnzero+nrow)/nrow) * nb_
|
|
|
|
|
|
|
|
isize = max(isize,4*nb_)
|
|
|
|
|
|
|
|
allocate(val(isize),irow(isize),icol(isize),stat=info)
|
|
|
|
if(info/=0) then
|
|
|
|
if(info/=0) then
|
|
|
|
info=4010
|
|
|
|
info=4010
|
|
|
|
ch_err='Allocate'
|
|
|
|
ch_err='Allocate'
|
|
|
@ -635,7 +687,7 @@ contains
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
if (v(j_count) /= iproc ) exit
|
|
|
|
if (v(j_count) /= iproc ) exit
|
|
|
|
end do
|
|
|
|
end do
|
|
|
@ -643,12 +695,13 @@ contains
|
|
|
|
! 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
|
|
|
|
|
|
|
|
|
|
|
|
if (iam == root) then
|
|
|
|
|
|
|
|
|
|
|
|
if (iproc == iam) then
|
|
|
|
|
|
|
|
|
|
|
|
ll = 0
|
|
|
|
ll = 0
|
|
|
|
do i= i_count, j_count-1
|
|
|
|
do i= i_count, j_count-1
|
|
|
|
call psb_sp_getrow(i,a_glob,nz,&
|
|
|
|
call psb_sp_getrow(i,a_glob,nz,&
|
|
|
|
& irow(ll+1:),icol(ll+1:),val(ll+1:), info)
|
|
|
|
& irow,icol,val,info,nzin=ll,append=.true.)
|
|
|
|
if (info /= 0) then
|
|
|
|
if (info /= 0) then
|
|
|
|
if (nz >min(size(irow(ll+1:)),size(icol(ll+1:)),size(val(ll+1:)))) then
|
|
|
|
if (nz >min(size(irow(ll+1:)),size(icol(ll+1:)),size(val(ll+1:)))) then
|
|
|
|
write(0,*) 'Allocation failure? This should not happen!'
|
|
|
|
write(0,*) 'Allocation failure? This should not happen!'
|
|
|
@ -659,7 +712,6 @@ contains
|
|
|
|
ll = ll + nz
|
|
|
|
ll = ll + nz
|
|
|
|
end do
|
|
|
|
end do
|
|
|
|
|
|
|
|
|
|
|
|
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/=0) then
|
|
|
|
if(info/=0) then
|
|
|
|
info=4010
|
|
|
|
info=4010
|
|
|
@ -676,53 +728,6 @@ contains
|
|
|
|
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
|
|
|
|
else
|
|
|
|
|
|
|
|
call psb_snd(ictxt,nnr,iproc)
|
|
|
|
|
|
|
|
call psb_snd(ictxt,ll,iproc)
|
|
|
|
|
|
|
|
call psb_snd(ictxt,irow(1:ll),iproc)
|
|
|
|
|
|
|
|
call psb_snd(ictxt,icol(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)
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
else if (iam /= root) then
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (iproc == iam) then
|
|
|
|
|
|
|
|
call psb_rcv(ictxt,nnr,root)
|
|
|
|
|
|
|
|
call psb_rcv(ictxt,ll,root)
|
|
|
|
|
|
|
|
if (ll > size(val)) then
|
|
|
|
|
|
|
|
write(0,*) iam,'need to reallocate ',ll
|
|
|
|
|
|
|
|
deallocate(val,irow,icol)
|
|
|
|
|
|
|
|
allocate(val(ll),irow(ll),icol(ll),stat=info)
|
|
|
|
|
|
|
|
if(info/=0) then
|
|
|
|
|
|
|
|
info=4010
|
|
|
|
|
|
|
|
ch_err='Allocate'
|
|
|
|
|
|
|
|
call psb_errpush(info,name,a_err=ch_err)
|
|
|
|
|
|
|
|
goto 9999
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
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:i_count+nnr-1),root)
|
|
|
|
|
|
|
|
call psb_snd(ictxt,ll,root)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
call psb_spins(ll,irow,icol,val,a,desc_a,info)
|
|
|
|
|
|
|
|
if(info/=0) then
|
|
|
|
|
|
|
|
info=4010
|
|
|
|
|
|
|
|
ch_err='spins'
|
|
|
|
|
|
|
|
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/=0) then
|
|
|
|
|
|
|
|
info=4010
|
|
|
|
|
|
|
|
ch_err='psdsins'
|
|
|
|
|
|
|
|
call psb_errpush(info,name,a_err=ch_err)
|
|
|
|
|
|
|
|
goto 9999
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
i_count = j_count
|
|
|
|
i_count = j_count
|
|
|
|
|
|
|
|
|
|
|
@ -989,7 +994,7 @@ contains
|
|
|
|
ll = 0
|
|
|
|
ll = 0
|
|
|
|
do i= i_count, j_count-1
|
|
|
|
do i= i_count, j_count-1
|
|
|
|
call psb_sp_getrow(i,a_glob,nz,&
|
|
|
|
call psb_sp_getrow(i,a_glob,nz,&
|
|
|
|
& irow(ll+1:),icol(ll+1:),val(ll+1:), info)
|
|
|
|
& irow,icol,val,info,nzin=ll,append=.true.)
|
|
|
|
if (info /= 0) then
|
|
|
|
if (info /= 0) then
|
|
|
|
if (nz >min(size(irow(ll+1:)),size(icol(ll+1:)),size(val(ll+1:)))) then
|
|
|
|
if (nz >min(size(irow(ll+1:)),size(icol(ll+1:)),size(val(ll+1:)))) then
|
|
|
|
write(0,*) 'Allocation failure? This should not happen!'
|
|
|
|
write(0,*) 'Allocation failure? This should not happen!'
|
|
|
@ -1077,7 +1082,7 @@ contains
|
|
|
|
ll = 0
|
|
|
|
ll = 0
|
|
|
|
do i= i_count, i_count
|
|
|
|
do i= i_count, i_count
|
|
|
|
call psb_sp_getrow(i,a_glob,nz,&
|
|
|
|
call psb_sp_getrow(i,a_glob,nz,&
|
|
|
|
& irow(ll+1:),icol(ll+1:),val(ll+1:), info)
|
|
|
|
& irow,icol,val,info,nzin=ll,append=.true.)
|
|
|
|
if (info /= 0) then
|
|
|
|
if (info /= 0) then
|
|
|
|
if (nz >min(size(irow(ll+1:)),size(icol(ll+1:)),size(val(ll+1:)))) then
|
|
|
|
if (nz >min(size(irow(ll+1:)),size(icol(ll+1:)),size(val(ll+1:)))) then
|
|
|
|
write(0,*) 'Allocation failure? This should not happen!'
|
|
|
|
write(0,*) 'Allocation failure? This should not happen!'
|
|
|
@ -1395,7 +1400,7 @@ contains
|
|
|
|
ll = 0
|
|
|
|
ll = 0
|
|
|
|
do i= i_count, j_count-1
|
|
|
|
do i= i_count, j_count-1
|
|
|
|
call psb_sp_getrow(i,a_glob,nz,&
|
|
|
|
call psb_sp_getrow(i,a_glob,nz,&
|
|
|
|
& irow(ll+1:),icol(ll+1:),val(ll+1:), info)
|
|
|
|
& irow,icol,val,info,nzin=ll,append=.true.)
|
|
|
|
if (info /= 0) then
|
|
|
|
if (info /= 0) then
|
|
|
|
if (nz >min(size(irow(ll+1:)),size(icol(ll+1:)),size(val(ll+1:)))) then
|
|
|
|
if (nz >min(size(irow(ll+1:)),size(icol(ll+1:)),size(val(ll+1:)))) then
|
|
|
|
write(0,*) 'Allocation failure? This should not happen!'
|
|
|
|
write(0,*) 'Allocation failure? This should not happen!'
|
|
|
|