|
|
|
@ -29,7 +29,6 @@
|
|
|
|
|
!!$ POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
!!$
|
|
|
|
|
!!$
|
|
|
|
|
|
|
|
|
|
! File: psb_ihalo.f90
|
|
|
|
|
!
|
|
|
|
|
! Subroutine: psb_ihalom
|
|
|
|
@ -37,13 +36,13 @@
|
|
|
|
|
! distributed dense matrix between all the processes.
|
|
|
|
|
!
|
|
|
|
|
! Arguments:
|
|
|
|
|
! x - integer(psb_ipk_),dimension(:,:). The local part of the dense matrix.
|
|
|
|
|
! x - integer,dimension(:,:). The local part of the dense matrix.
|
|
|
|
|
! desc_a - type(psb_desc_type). The communication descriptor.
|
|
|
|
|
! info - integer. Return code
|
|
|
|
|
! alpha - real(optional). Scale factor.
|
|
|
|
|
! alpha - integer(optional). Scale factor.
|
|
|
|
|
! jx - integer(optional). The starting column of the global matrix.
|
|
|
|
|
! ik - integer(optional). The number of columns to gather.
|
|
|
|
|
! work - real(optional). Work area.
|
|
|
|
|
! work - integer(optional). Work area.
|
|
|
|
|
! tran - character(optional). Transpose exchange.
|
|
|
|
|
! mode - integer(optional). Communication mode (see Swapdata)
|
|
|
|
|
! data - integer Which index list in desc_a should be used
|
|
|
|
@ -59,19 +58,19 @@ subroutine psb_ihalom(x,desc_a,info,alpha,jx,ik,work,tran,mode,data)
|
|
|
|
|
use psi_mod
|
|
|
|
|
implicit none
|
|
|
|
|
|
|
|
|
|
integer(psb_ipk_), intent(inout), target :: x(:,:)
|
|
|
|
|
type(psb_desc_type), intent(in) :: desc_a
|
|
|
|
|
integer(psb_ipk_), intent(out) :: info
|
|
|
|
|
integer(psb_ipk_), intent(in), optional :: alpha
|
|
|
|
|
integer(psb_ipk_), intent(inout), optional, target :: work(:)
|
|
|
|
|
integer(psb_ipk_), intent(in), optional :: mode,jx,ik,data
|
|
|
|
|
character, intent(in), optional :: tran
|
|
|
|
|
integer(psb_ipk_), intent(inout), target :: x(:,:)
|
|
|
|
|
type(psb_desc_type), intent(in) :: desc_a
|
|
|
|
|
integer(psb_ipk_), intent(out) :: info
|
|
|
|
|
integer(psb_ipk_), intent(in), optional :: alpha
|
|
|
|
|
integer(psb_ipk_), optional, target, intent(inout) :: work(:)
|
|
|
|
|
integer(psb_ipk_), intent(in), optional :: mode,jx,ik,data
|
|
|
|
|
character, intent(in), optional :: tran
|
|
|
|
|
|
|
|
|
|
! locals
|
|
|
|
|
integer(psb_ipk_) :: ictxt, np, me, &
|
|
|
|
|
& err_act, m, n, iix, jjx, ix, ijx, nrow, k, maxk, liwork,&
|
|
|
|
|
& imode, err,data_, ldx
|
|
|
|
|
integer(psb_ipk_), pointer :: xp(:,:), iwork(:)
|
|
|
|
|
integer(psb_mpik_) :: ictxt, np, me
|
|
|
|
|
integer(psb_ipk_) :: err_act, m, n, iix, jjx, ix, ijx, k, maxk, nrow, imode, i,&
|
|
|
|
|
& err, liwork,data_, ldx
|
|
|
|
|
integer(psb_ipk_),pointer :: iwork(:), xp(:,:)
|
|
|
|
|
character :: tran_
|
|
|
|
|
character(len=20) :: name, ch_err
|
|
|
|
|
logical :: aliw
|
|
|
|
@ -119,20 +118,17 @@ subroutine psb_ihalom(x,desc_a,info,alpha,jx,ik,work,tran,mode,data)
|
|
|
|
|
else
|
|
|
|
|
tran_ = 'N'
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
if (present(data)) then
|
|
|
|
|
data_ = data
|
|
|
|
|
else
|
|
|
|
|
data_ = psb_comm_halo_
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (present(mode)) then
|
|
|
|
|
imode = mode
|
|
|
|
|
else
|
|
|
|
|
imode = IOR(psb_swap_send_,psb_swap_recv_)
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
if (present(data)) then
|
|
|
|
|
data_ = data
|
|
|
|
|
else
|
|
|
|
|
data_ = psb_comm_halo_
|
|
|
|
|
endif
|
|
|
|
|
ldx = size(x,1)
|
|
|
|
|
! check vector correctness
|
|
|
|
|
call psb_chkvect(m,ione,ldx,ix,ijx,desc_a,info,iix,jjx)
|
|
|
|
@ -151,15 +147,13 @@ subroutine psb_ihalom(x,desc_a,info,alpha,jx,ik,work,tran,mode,data)
|
|
|
|
|
call psb_errcomm(ictxt,err)
|
|
|
|
|
if(err /= 0) goto 9999
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
! we should write an "iscal"
|
|
|
|
|
!!$ if(present(alpha)) then
|
|
|
|
|
!!$ if(alpha /= 1.d0) then
|
|
|
|
|
!!$ do i=0, k-1
|
|
|
|
|
!!$ call iscal(nrow,alpha,x(1,jjx+i),1)
|
|
|
|
|
!!$ end do
|
|
|
|
|
!!$ end if
|
|
|
|
|
!!$ end if
|
|
|
|
|
if(present(alpha)) then
|
|
|
|
|
if(alpha /= ione) then
|
|
|
|
|
do i=0, k-1
|
|
|
|
|
call iscal(int(nrow,kind=psb_mpik_),alpha,x(:,jjx+i),1)
|
|
|
|
|
end do
|
|
|
|
|
end if
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
liwork=nrow
|
|
|
|
|
if (present(work)) then
|
|
|
|
@ -179,6 +173,7 @@ subroutine psb_ihalom(x,desc_a,info,alpha,jx,ik,work,tran,mode,data)
|
|
|
|
|
else
|
|
|
|
|
aliw=.true.
|
|
|
|
|
allocate(iwork(liwork),stat=info)
|
|
|
|
|
|
|
|
|
|
if(info /= psb_success_) then
|
|
|
|
|
info=psb_err_from_subroutine_
|
|
|
|
|
ch_err='psb_realloc'
|
|
|
|
@ -187,14 +182,14 @@ subroutine psb_ihalom(x,desc_a,info,alpha,jx,ik,work,tran,mode,data)
|
|
|
|
|
end if
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
xp => x(iix:ldx,jjx:jjx+k-1)
|
|
|
|
|
! exchange halo elements
|
|
|
|
|
xp => x(iix:size(x,1),jjx:jjx+k-1)
|
|
|
|
|
if(tran_ == 'N') then
|
|
|
|
|
call psi_swapdata(imode,k,izero,xp,&
|
|
|
|
|
& desc_a,iwork,info,data=data_)
|
|
|
|
|
else if((tran_ == 'T').or.(tran_ == 'C')) then
|
|
|
|
|
call psi_swaptran(imode,k,ione,xp,&
|
|
|
|
|
& desc_a,iwork,info)
|
|
|
|
|
&desc_a,iwork,info)
|
|
|
|
|
else
|
|
|
|
|
info = psb_err_internal_error_
|
|
|
|
|
call psb_errpush(info,name,a_err='invalid tran')
|
|
|
|
@ -202,7 +197,8 @@ subroutine psb_ihalom(x,desc_a,info,alpha,jx,ik,work,tran,mode,data)
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
if(info /= psb_success_) then
|
|
|
|
|
call psb_errpush(psb_err_from_subroutine_,name,a_err='PSI_iSwap...')
|
|
|
|
|
ch_err='PSI_cswapdata'
|
|
|
|
|
call psb_errpush(psb_err_from_subroutine_,name,a_err=ch_err)
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
@ -251,19 +247,19 @@ end subroutine psb_ihalom
|
|
|
|
|
!!$ POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
!!$
|
|
|
|
|
!!$
|
|
|
|
|
|
|
|
|
|
!
|
|
|
|
|
! Subroutine: psb_ihalov
|
|
|
|
|
! This subroutine performs the exchange of the halo elements in a
|
|
|
|
|
! distributed dense matrix between all the processes.
|
|
|
|
|
! distributed dense vector between all the processes.
|
|
|
|
|
!
|
|
|
|
|
! Arguments:
|
|
|
|
|
! x - integer(psb_ipk_),dimension(:). The local part of the dense matrix.
|
|
|
|
|
! x - real,dimension(:). The local part of the dense vector.
|
|
|
|
|
! desc_a - type(psb_desc_type). The communication descriptor.
|
|
|
|
|
! info - integer. Return code
|
|
|
|
|
! alpha - real(optional). Scale factor.
|
|
|
|
|
! alpha - integer(optional). Scale factor.
|
|
|
|
|
! jx - integer(optional). The starting column of the global matrix.
|
|
|
|
|
! ik - integer(optional). The number of columns to gather.
|
|
|
|
|
! work - real(optional). Work area.
|
|
|
|
|
! work - integer(optional). Work area.
|
|
|
|
|
! tran - character(optional). Transpose exchange.
|
|
|
|
|
! mode - integer(optional). Communication mode (see Swapdata)
|
|
|
|
|
! data - integer Which index list in desc_a should be used
|
|
|
|
@ -279,19 +275,19 @@ subroutine psb_ihalov(x,desc_a,info,alpha,work,tran,mode,data)
|
|
|
|
|
use psi_mod
|
|
|
|
|
implicit none
|
|
|
|
|
|
|
|
|
|
integer(psb_ipk_), intent(inout) :: x(:)
|
|
|
|
|
type(psb_desc_type), intent(in) :: desc_a
|
|
|
|
|
integer(psb_ipk_), intent(out) :: info
|
|
|
|
|
integer(psb_ipk_), intent(in), optional :: alpha
|
|
|
|
|
integer(psb_ipk_), intent(inout), optional, target :: work(:)
|
|
|
|
|
integer(psb_ipk_), intent(in), optional :: mode,data
|
|
|
|
|
character, intent(in), optional :: tran
|
|
|
|
|
integer(psb_ipk_), intent(inout) :: x(:)
|
|
|
|
|
type(psb_desc_type), intent(in) :: desc_a
|
|
|
|
|
integer(psb_ipk_), intent(out) :: info
|
|
|
|
|
integer(psb_ipk_), intent(in), optional :: alpha
|
|
|
|
|
integer(psb_ipk_), target, optional, intent(inout) :: work(:)
|
|
|
|
|
integer(psb_ipk_), intent(in), optional :: mode,data
|
|
|
|
|
character, intent(in), optional :: tran
|
|
|
|
|
|
|
|
|
|
! locals
|
|
|
|
|
integer(psb_ipk_) :: ictxt, np, me,&
|
|
|
|
|
& err_act, m, n, iix, jjx, ix, ijx, nrow, imode,&
|
|
|
|
|
& err, liwork, data_,ldx
|
|
|
|
|
integer(psb_ipk_),pointer :: iwork(:)
|
|
|
|
|
integer(psb_mpik_) :: ictxt, np, me
|
|
|
|
|
integer(psb_ipk_) :: err_act, ldx, &
|
|
|
|
|
& m, n, iix, jjx, ix, ijx, nrow, imode, err, liwork,data_
|
|
|
|
|
integer(psb_ipk_),pointer :: iwork(:)
|
|
|
|
|
character :: tran_
|
|
|
|
|
character(len=20) :: name, ch_err
|
|
|
|
|
logical :: aliw
|
|
|
|
@ -317,8 +313,6 @@ subroutine psb_ihalov(x,desc_a,info,alpha,work,tran,mode,data)
|
|
|
|
|
m = desc_a%get_global_rows()
|
|
|
|
|
n = desc_a%get_global_cols()
|
|
|
|
|
nrow = desc_a%get_local_rows()
|
|
|
|
|
! ncol = desc_a%get_local_cols()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (present(tran)) then
|
|
|
|
|
tran_ = psb_toupper(tran)
|
|
|
|
@ -335,7 +329,6 @@ subroutine psb_ihalov(x,desc_a,info,alpha,work,tran,mode,data)
|
|
|
|
|
else
|
|
|
|
|
imode = IOR(psb_swap_send_,psb_swap_recv_)
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
ldx = size(x,1)
|
|
|
|
|
! check vector correctness
|
|
|
|
|
call psb_chkvect(m,ione,ldx,ix,ijx,desc_a,info,iix,jjx)
|
|
|
|
@ -354,11 +347,11 @@ subroutine psb_ihalov(x,desc_a,info,alpha,work,tran,mode,data)
|
|
|
|
|
call psb_errcomm(ictxt,err)
|
|
|
|
|
if(err /= 0) goto 9999
|
|
|
|
|
|
|
|
|
|
!!$ if(present(alpha)) then
|
|
|
|
|
!!$ if(alpha /= 1.d0) then
|
|
|
|
|
!!$ call dscal(nrow,alpha,x,1)
|
|
|
|
|
!!$ end if
|
|
|
|
|
!!$ end if
|
|
|
|
|
if(present(alpha)) then
|
|
|
|
|
if(alpha /= ione) then
|
|
|
|
|
call iscal(int(nrow,kind=psb_mpik_),alpha,x,ione)
|
|
|
|
|
end if
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
liwork=nrow
|
|
|
|
|
if (present(work)) then
|
|
|
|
@ -400,7 +393,8 @@ subroutine psb_ihalov(x,desc_a,info,alpha,work,tran,mode,data)
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
if(info /= psb_success_) then
|
|
|
|
|
call psb_errpush(psb_err_from_subroutine_,name,a_err='PSI_iswapdata')
|
|
|
|
|
ch_err='PSI_swapdata'
|
|
|
|
|
call psb_errpush(psb_err_from_subroutine_,name,a_err=ch_err)
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
@ -416,8 +410,6 @@ subroutine psb_ihalov(x,desc_a,info,alpha,work,tran,mode,data)
|
|
|
|
|
end subroutine psb_ihalov
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
subroutine psb_ihalo_vect(x,desc_a,info,alpha,work,tran,mode,data)
|
|
|
|
|
use psb_base_mod, psb_protect_name => psb_ihalo_vect
|
|
|
|
|
use psi_mod
|
|
|
|
@ -502,7 +494,7 @@ subroutine psb_ihalo_vect(x,desc_a,info,alpha,work,tran,mode,data)
|
|
|
|
|
if(err /= 0) goto 9999
|
|
|
|
|
|
|
|
|
|
if(present(alpha)) then
|
|
|
|
|
if(alpha /= done) then
|
|
|
|
|
if(alpha /= ione) then
|
|
|
|
|
call x%scal(alpha)
|
|
|
|
|
end if
|
|
|
|
|
end if
|
|
|
|
|