Partial cleanup of aggregation code.

stopcriterion
Salvatore Filippone 5 years ago
parent 4291f08cc7
commit 85a03d87ba

@ -164,7 +164,7 @@ subroutine mld_c_dec_aggregator_mat_asb(ag,parms,a,desc_a,ilaggr,nlaggr,&
call op_prol%set_ncols(desc_ac%get_local_cols()) call op_prol%set_ncols(desc_ac%get_local_cols())
if (np>1) then if (np>1) then
call op_restr%cscnv(info,type='coo',dupl=psb_dupl_add_) !call op_restr%cscnv(info,type='coo',dupl=psb_dupl_add_)
call op_restr%mv_to(acoo) call op_restr%mv_to(acoo)
nzl = acoo%get_nzeros() nzl = acoo%get_nzeros()
if (info == psb_success_) call psb_glob_to_loc(acoo%ia(1:nzl),desc_ac,info,'I') if (info == psb_success_) call psb_glob_to_loc(acoo%ia(1:nzl),desc_ac,info,'I')

@ -35,13 +35,193 @@
! File: mld_daggrmat_nosmth_bld.F90 ! File: mld_daggrmat_nosmth_bld.F90
! !
! !
subroutine mld_c_spmm_bld_inner(a_csr,desc_a,ilaggr,nlaggr,parms,ac,& subroutine mld_c_spmm_bld_inner(a_csr,desc_a,nlaggr,parms,ac,&
& op_prol,op_restr,info) & coo_prol,desc_cprol,coo_restr,info)
use psb_base_mod use psb_base_mod
use mld_c_inner_mod use mld_c_inner_mod
use mld_c_base_aggregator_mod, mld_protect_name => mld_c_spmm_bld_inner use mld_c_base_aggregator_mod, mld_protect_name => mld_c_spmm_bld_inner
implicit none implicit none
! Arguments
type(psb_lc_csr_sparse_mat), intent(inout) :: a_csr
type(psb_desc_type), intent(in) :: desc_a
integer(psb_lpk_), intent(inout) :: nlaggr(:)
type(mld_sml_parms), intent(inout) :: parms
type(psb_lc_coo_sparse_mat), intent(inout) :: coo_prol, coo_restr
type(psb_desc_type), intent(inout) :: desc_cprol
type(psb_lcspmat_type), intent(out) :: ac
integer(psb_ipk_), intent(out) :: info
! Local variables
integer(psb_ipk_) :: err_act
integer(psb_ipk_) :: ictxt,np,me, icomm, ndx, minfo
character(len=40) :: name
integer(psb_ipk_) :: ierr(5)
type(psb_lc_coo_sparse_mat) :: ac_coo, tmpcoo
type(psb_lc_csr_sparse_mat) :: acsr3, csr_prol, ac_csr, csr_restr
integer(psb_ipk_) :: debug_level, debug_unit, naggr
integer(psb_lpk_) :: nrow, nglob, ncol, ntaggr, nzl, ip, &
& nzt, naggrm1, naggrp1, i, k
integer(psb_lpk_) :: nrsave, ncsave, nzsave, nza, nrpsave, ncpsave, nzpsave
logical, parameter :: do_timings=.true., oldstyle=.false., debug=.false.
integer(psb_ipk_), save :: idx_spspmm=-1
name='mld_spmm_bld_inner'
if(psb_get_errstatus().ne.0) return
info=psb_success_
call psb_erractionsave(err_act)
ictxt = desc_a%get_context()
icomm = desc_a%get_mpic()
call psb_info(ictxt, me, np)
debug_unit = psb_get_debug_unit()
debug_level = psb_get_debug_level()
nglob = desc_a%get_global_rows()
nrow = desc_a%get_local_rows()
ncol = desc_a%get_local_cols()
if ((do_timings).and.(idx_spspmm==-1)) &
& idx_spspmm = psb_get_timer_idx("SPMM_BLD: par_spspmm")
naggr = nlaggr(me+1)
ntaggr = sum(nlaggr)
naggrm1 = sum(nlaggr(1:me))
naggrp1 = sum(nlaggr(1:me+1))
!write(0,*)me,' ',name,' input sizes',nlaggr(:),':',naggr
nrpsave = coo_prol%get_nrows()
ncpsave = coo_prol%get_ncols()
nzpsave = coo_prol%get_nzeros()
!write(0,*)me,' ',name,' input coo_prol ',nrpsave,ncpsave,nzpsave
!
! Here COO_PROL should be with GLOBAL indices on the cols
! and LOCAL indices on the rows.
!
if (debug) write(0,*) me,' ',trim(name),' Size check on entry New: ',&
& coo_prol%get_fmt(),coo_prol%get_nrows(),coo_prol%get_ncols(),coo_prol%get_nzeros(),&
& nrow,ntaggr,naggr
call coo_prol%cp_to_fmt(csr_prol,info)
if (debug) write(0,*) me,trim(name),' Product AxPROL ',&
& a_csr%get_nrows(),a_csr%get_ncols(), csr_prol%get_nrows(), &
& desc_a%get_local_rows(),desc_a%get_local_cols(),&
& desc_cprol%get_local_rows(),desc_a%get_local_cols()
if (debug) flush(0)
if (do_timings) call psb_tic(idx_spspmm)
call psb_par_spspmm(a_csr,desc_a,csr_prol,acsr3,desc_cprol,info)
if (do_timings) call psb_toc(idx_spspmm)
if (debug) write(0,*) me,trim(name),' Done AxPROL ',&
& acsr3%get_nrows(),acsr3%get_ncols(), acsr3%get_nzeros(),&
& desc_cprol%get_local_rows(),desc_cprol%get_local_cols()
!
! Ok first product done.
!
! Remember that RESTR must be built from PROL after halo extension,
! which is done above in psb_par_spspmm
if (debug) write(0,*)me,' ',name,' No inp_restr, transposing prol ',&
& csr_prol%get_nrows(),csr_prol%get_ncols(),csr_prol%get_nzeros()
call csr_prol%cp_to_fmt(coo_restr,info)
!!$ write(0,*)me,' ',name,' new into transposition ',coo_restr%get_nrows(),&
!!$ & coo_restr%get_ncols(),coo_restr%get_nzeros()
call coo_restr%transp()
nzl = coo_restr%get_nzeros()
call desc_cprol%l2gip(coo_restr%ia(1:nzl),info)
i=0
!
! Now we have to fix this. The only rows of the restrictor that are correct
! are those corresponding to "local" aggregates, i.e. indices in ilaggr(:)
!
do k=1, nzl
if ((naggrm1 < coo_restr%ia(k)) .and.(coo_restr%ia(k) <= naggrp1)) then
i = i+1
coo_restr%val(i) = coo_restr%val(k)
coo_restr%ia(i) = coo_restr%ia(k)
coo_restr%ja(i) = coo_restr%ja(k)
end if
end do
call coo_restr%set_nzeros(i)
call coo_restr%fix(info)
call coo_restr%cp_to_coo(tmpcoo,info)
!!$ write(0,*)me,' ',name,' after transposition ',coo_restr%get_nrows(),coo_restr%get_ncols(),coo_restr%get_nzeros()
if (info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='spcnv coo_restr')
goto 9999
end if
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'starting sphalo/ rwxtd'
nzl = tmpcoo%get_nzeros()
call psb_glob_to_loc(tmpcoo%ia(1:nzl),desc_cprol,info,iact='I',owned=.true.)
call tmpcoo%clean_negidx(info)
nzl = tmpcoo%get_nzeros()
call tmpcoo%set_nrows(desc_cprol%get_local_rows())
call tmpcoo%set_ncols(desc_a%get_local_cols())
!!$ write(0,*)me,' ',name,' after G2L on rows ',tmpcoo%get_nrows(),tmpcoo%get_ncols(),tmpcoo%get_nzeros()
call csr_restr%mv_from_coo(tmpcoo,info)
if (debug) write(0,*) me,trim(name),' Product RESTRxAP ',&
& csr_restr%get_nrows(),csr_restr%get_ncols(), &
& desc_cprol%get_local_rows(),desc_a%get_local_cols(),&
& acsr3%get_nrows(),acsr3%get_ncols()
if (do_timings) call psb_tic(idx_spspmm)
call psb_par_spspmm(csr_restr,desc_a,acsr3,ac_csr,desc_cprol,info)
if (do_timings) call psb_toc(idx_spspmm)
call csr_restr%free()
call ac_csr%mv_to_coo(ac_coo,info)
nza = ac_coo%get_nzeros()
if (debug) write(0,*) me,trim(name),' Fixing ac ',&
& ac_coo%get_nrows(),ac_coo%get_ncols(), nza
call ac_coo%fix(info)
call desc_cprol%indxmap%l2gip(ac_coo%ia(1:nza),info)
call desc_cprol%indxmap%l2gip(ac_coo%ja(1:nza),info)
call ac_coo%set_nrows(ntaggr)
call ac_coo%set_ncols(ntaggr)
if (debug) write(0,*) me,' ',trim(name),' Before mv_from',psb_get_errstatus()
if (info == 0) call ac%mv_from(ac_coo)
if (debug) write(0,*) me,' ',trim(name),' After mv_from',psb_get_errstatus()
if (debug) write(0,*) me,' ',trim(name),' ',ac%get_fmt(),ac%get_nrows(),ac%get_ncols(),ac%get_nzeros(),naggr,ntaggr
! write(0,*) me,' ',trim(name),' Final AC newstyle ',ac%get_fmt(),ac%get_nrows(),ac%get_ncols(),ac%get_nzeros()
nza = coo_prol%get_nzeros()
call desc_cprol%indxmap%l2gip(coo_prol%ja(1:nza),info)
if (debug) then
write(0,*) me,' ',trim(name),' Checkpoint at exit'
call psb_barrier(ictxt)
write(0,*) me,' ',trim(name),' Checkpoint through'
end if
if (info /= psb_success_) then
call psb_errpush(psb_err_internal_error_,name,a_err='Build ac = coo_restr x am3')
goto 9999
end if
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done smooth_aggregate '
call psb_erractionrestore(err_act)
return
9999 call psb_error_handler(err_act)
return
end subroutine mld_c_spmm_bld_inner
subroutine mld_c_old_spmm_bld_inner(a_csr,desc_a,ilaggr,nlaggr,parms,ac,&
& op_prol,op_restr,info)
use psb_base_mod
use mld_c_inner_mod
use mld_c_base_aggregator_mod, mld_protect_name => mld_c_old_spmm_bld_inner
implicit none
! Arguments ! Arguments
type(psb_lc_csr_sparse_mat), intent(inout) :: a_csr type(psb_lc_csr_sparse_mat), intent(inout) :: a_csr
type(psb_desc_type), intent(in) :: desc_a type(psb_desc_type), intent(in) :: desc_a
@ -218,4 +398,4 @@ subroutine mld_c_spmm_bld_inner(a_csr,desc_a,ilaggr,nlaggr,parms,ac,&
return return
end subroutine mld_c_spmm_bld_inner end subroutine mld_c_old_spmm_bld_inner

@ -126,7 +126,7 @@ subroutine mld_caggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_rest
integer(psb_ipk_) :: ictxt, np, me integer(psb_ipk_) :: ictxt, np, me
character(len=20) :: name character(len=20) :: name
type(psb_desc_type) :: tmp_desc type(psb_desc_type) :: tmp_desc
type(psb_lc_coo_sparse_mat) :: tmpcoo type(psb_lc_coo_sparse_mat) :: coo_prol, coo_restr, tmpcoo
type(psb_lc_csr_sparse_mat) :: acsr1, acsrf, csr_prol, acsr type(psb_lc_csr_sparse_mat) :: acsr1, acsrf, csr_prol, acsr
complex(psb_spk_), allocatable :: adiag(:) complex(psb_spk_), allocatable :: adiag(:)
real(psb_spk_), allocatable :: arwsum(:) real(psb_spk_), allocatable :: arwsum(:)
@ -176,7 +176,7 @@ subroutine mld_caggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_rest
if (info == psb_success_) & if (info == psb_success_) &
& call psb_halo(adiag,desc_a,info) & call psb_halo(adiag,desc_a,info)
if (info == psb_success_) call a%cp_to(acsr) if (info == psb_success_) call a%cp_to(acsr)
call op_prol%cp_to(tmpcoo) call op_prol%mv_to(coo_prol)
if(info /= psb_success_) then if(info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='sp_getdiag') call psb_errpush(psb_err_from_subroutine_,name,a_err='sp_getdiag')
@ -257,10 +257,10 @@ subroutine mld_caggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_rest
inaggr = naggr inaggr = naggr
call psb_cdall(ictxt,tmp_desc,info,nl=inaggr) call psb_cdall(ictxt,tmp_desc,info,nl=inaggr)
nzlp = tmpcoo%get_nzeros() nzlp = coo_prol%get_nzeros()
call tmp_desc%indxmap%g2lip_ins(tmpcoo%ja(1:nzlp),info) call tmp_desc%indxmap%g2lip_ins(coo_prol%ja(1:nzlp),info)
call tmpcoo%set_ncols(tmp_desc%get_local_cols()) call coo_prol%set_ncols(tmp_desc%get_local_cols())
call tmpcoo%mv_to_fmt(csr_prol,info) call coo_prol%mv_to_fmt(csr_prol,info)
! !
! Build the smoothed prolongator using either A or Af ! Build the smoothed prolongator using either A or Af
! acsr1 = (I-w*D*A) Prol acsr1 = (I-w*D*Af) Prol ! acsr1 = (I-w*D*A) Prol acsr1 = (I-w*D*Af) Prol
@ -278,16 +278,24 @@ subroutine mld_caggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_rest
if (debug_level >= psb_debug_outer_) & if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),& & write(debug_unit,*) me,' ',trim(name),&
& 'Done SPSPMM 1' & 'Done SPSPMM 1'
if (.true.) then
nzl = acsr1%get_nzeros()
call acsr1%mv_to_coo(coo_prol,info)
call mld_spmm_bld_inner(acsr,desc_a,nlaggr,parms,ac,&
& coo_prol,tmp_desc,coo_restr,info)
call op_prol%mv_from(coo_prol)
call op_restr%mv_from(coo_restr)
else
nzl = acsr1%get_nzeros() nzl = acsr1%get_nzeros()
call tmp_desc%l2gip(acsr1%ja(1:nzl),info) call tmp_desc%l2gip(acsr1%ja(1:nzl),info)
call acsr1%set_dupl(psb_dupl_add_) call op_prol%mv_from(acsr1)
call acsr1%set_ncols(ntaggr)
call op_prol%cp_from(acsr1)
call mld_spmm_bld_inner(acsr,desc_a,ilaggr,nlaggr,parms,ac,& call mld_spmm_bld_inner(acsr,desc_a,ilaggr,nlaggr,parms,ac,&
& op_prol,op_restr,info) & op_prol,op_restr,info)
end if
if (debug_level >= psb_debug_outer_) & if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),& & write(debug_unit,*) me,' ',trim(name),&

@ -164,7 +164,7 @@ subroutine mld_d_dec_aggregator_mat_asb(ag,parms,a,desc_a,ilaggr,nlaggr,&
call op_prol%set_ncols(desc_ac%get_local_cols()) call op_prol%set_ncols(desc_ac%get_local_cols())
if (np>1) then if (np>1) then
call op_restr%cscnv(info,type='coo',dupl=psb_dupl_add_) !call op_restr%cscnv(info,type='coo',dupl=psb_dupl_add_)
call op_restr%mv_to(acoo) call op_restr%mv_to(acoo)
nzl = acoo%get_nzeros() nzl = acoo%get_nzeros()
if (info == psb_success_) call psb_glob_to_loc(acoo%ia(1:nzl),desc_ac,info,'I') if (info == psb_success_) call psb_glob_to_loc(acoo%ia(1:nzl),desc_ac,info,'I')

@ -35,11 +35,11 @@
! File: mld_daggrmat_nosmth_bld.F90 ! File: mld_daggrmat_nosmth_bld.F90
! !
! !
subroutine mld_d_new_spmm_bld_inner(a_csr,desc_a,nlaggr,parms,ac,& subroutine mld_d_spmm_bld_inner(a_csr,desc_a,nlaggr,parms,ac,&
& coo_prol,desc_cprol,coo_restr,info) & coo_prol,desc_cprol,coo_restr,info)
use psb_base_mod use psb_base_mod
use mld_d_inner_mod use mld_d_inner_mod
use mld_d_base_aggregator_mod, mld_protect_name => mld_d_new_spmm_bld_inner use mld_d_base_aggregator_mod, mld_protect_name => mld_d_spmm_bld_inner
implicit none implicit none
! Arguments ! Arguments
@ -63,7 +63,7 @@ subroutine mld_d_new_spmm_bld_inner(a_csr,desc_a,nlaggr,parms,ac,&
integer(psb_lpk_) :: nrow, nglob, ncol, ntaggr, nzl, ip, & integer(psb_lpk_) :: nrow, nglob, ncol, ntaggr, nzl, ip, &
& nzt, naggrm1, naggrp1, i, k & nzt, naggrm1, naggrp1, i, k
integer(psb_lpk_) :: nrsave, ncsave, nzsave, nza, nrpsave, ncpsave, nzpsave integer(psb_lpk_) :: nrsave, ncsave, nzsave, nza, nrpsave, ncpsave, nzpsave
logical, parameter :: do_timings=.true., oldstyle=.false., debug=.true. logical, parameter :: do_timings=.true., oldstyle=.false., debug=.false.
integer(psb_ipk_), save :: idx_spspmm=-1 integer(psb_ipk_), save :: idx_spspmm=-1
name='mld_spmm_bld_inner' name='mld_spmm_bld_inner'
@ -92,7 +92,7 @@ subroutine mld_d_new_spmm_bld_inner(a_csr,desc_a,nlaggr,parms,ac,&
nrpsave = coo_prol%get_nrows() nrpsave = coo_prol%get_nrows()
ncpsave = coo_prol%get_ncols() ncpsave = coo_prol%get_ncols()
nzpsave = coo_prol%get_nzeros() nzpsave = coo_prol%get_nzeros()
write(0,*)me,' ',name,' input coo_prol ',nrpsave,ncpsave,nzpsave !write(0,*)me,' ',name,' input coo_prol ',nrpsave,ncpsave,nzpsave
! !
! Here COO_PROL should be with GLOBAL indices on the cols ! Here COO_PROL should be with GLOBAL indices on the cols
@ -214,12 +214,12 @@ subroutine mld_d_new_spmm_bld_inner(a_csr,desc_a,nlaggr,parms,ac,&
return return
end subroutine mld_d_new_spmm_bld_inner end subroutine mld_d_spmm_bld_inner
subroutine mld_d_spmm_bld_inner(a_csr,desc_a,ilaggr,nlaggr,parms,ac,& subroutine mld_d_old_spmm_bld_inner(a_csr,desc_a,ilaggr,nlaggr,parms,ac,&
& op_prol,op_restr,info) & op_prol,op_restr,info)
use psb_base_mod use psb_base_mod
use mld_d_inner_mod use mld_d_inner_mod
use mld_d_base_aggregator_mod, mld_protect_name => mld_d_spmm_bld_inner use mld_d_base_aggregator_mod, mld_protect_name => mld_d_old_spmm_bld_inner
implicit none implicit none
! Arguments ! Arguments
@ -243,7 +243,7 @@ subroutine mld_d_spmm_bld_inner(a_csr,desc_a,ilaggr,nlaggr,parms,ac,&
integer(psb_lpk_) :: nrow, nglob, ncol, ntaggr, nzl, ip, & integer(psb_lpk_) :: nrow, nglob, ncol, ntaggr, nzl, ip, &
& nzt, naggrm1, naggrp1, i, k & nzt, naggrm1, naggrp1, i, k
integer(psb_lpk_) :: nrsave, ncsave, nzsave, nza, nrpsave, ncpsave, nzpsave integer(psb_lpk_) :: nrsave, ncsave, nzsave, nza, nrpsave, ncpsave, nzpsave
logical, parameter :: do_timings=.true., oldstyle=.false., debug=.true. logical, parameter :: do_timings=.true., oldstyle=.false., debug=.false.
integer(psb_ipk_), save :: idx_spspmm=-1 integer(psb_ipk_), save :: idx_spspmm=-1
name='mld_spmm_bld_inner' name='mld_spmm_bld_inner'
@ -272,7 +272,7 @@ subroutine mld_d_spmm_bld_inner(a_csr,desc_a,ilaggr,nlaggr,parms,ac,&
nrpsave = op_prol%get_nrows() nrpsave = op_prol%get_nrows()
ncpsave = op_prol%get_ncols() ncpsave = op_prol%get_ncols()
nzpsave = op_prol%get_nzeros() nzpsave = op_prol%get_nzeros()
write(0,*)me,' ',name,' input op_prol ',nrpsave,ncpsave,nzpsave !write(0,*)me,' ',name,' input op_prol ',nrpsave,ncpsave,nzpsave
! !
! Here OP_PROL should be with GLOBAL indices on the cols ! Here OP_PROL should be with GLOBAL indices on the cols
@ -398,5 +398,4 @@ subroutine mld_d_spmm_bld_inner(a_csr,desc_a,ilaggr,nlaggr,parms,ac,&
return return
end subroutine mld_d_spmm_bld_inner end subroutine mld_d_old_spmm_bld_inner

@ -278,31 +278,23 @@ subroutine mld_daggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_rest
if (debug_level >= psb_debug_outer_) & if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),& & write(debug_unit,*) me,' ',trim(name),&
& 'Done SPSPMM 1' & 'Done SPSPMM 1'
if (.true.) then
nzl = acsr1%get_nzeros() nzl = acsr1%get_nzeros()
write(0,*) acsr1%get_nrows(),acsr1%get_ncols(),acsr1%get_nzeros()
if (.false.) then
call tmp_desc%l2gip(acsr1%ja(1:nzl),info)
call acsr1%set_dupl(psb_dupl_add_)
call acsr1%set_ncols(ntaggr)
call op_prol%cp_from(acsr1)
call mld_spmm_bld_inner(acsr,desc_a,ilaggr,nlaggr,parms,ac,&
& op_prol,op_restr,info)
call op_prol%print(0)
else
!call tmp_desc%l2gip(acsr1%ja(1:nzl),info)
call acsr1%mv_to_coo(coo_prol,info) call acsr1%mv_to_coo(coo_prol,info)
call mld_spmm_bld_inner(acsr,desc_a,nlaggr,parms,ac,& call mld_spmm_bld_inner(acsr,desc_a,nlaggr,parms,ac,&
& coo_prol,tmp_desc,coo_restr,info) & coo_prol,tmp_desc,coo_restr,info)
call op_prol%mv_from(coo_prol) call op_prol%mv_from(coo_prol)
call op_prol%print(0)
call op_restr%mv_from(coo_restr) call op_restr%mv_from(coo_restr)
else
nzl = acsr1%get_nzeros()
call tmp_desc%l2gip(acsr1%ja(1:nzl),info)
call op_prol%mv_from(acsr1)
call mld_spmm_bld_inner(acsr,desc_a,ilaggr,nlaggr,parms,ac,&
& op_prol,op_restr,info)
end if end if
if (debug_level >= psb_debug_outer_) & if (debug_level >= psb_debug_outer_) &

@ -164,7 +164,7 @@ subroutine mld_s_dec_aggregator_mat_asb(ag,parms,a,desc_a,ilaggr,nlaggr,&
call op_prol%set_ncols(desc_ac%get_local_cols()) call op_prol%set_ncols(desc_ac%get_local_cols())
if (np>1) then if (np>1) then
call op_restr%cscnv(info,type='coo',dupl=psb_dupl_add_) !call op_restr%cscnv(info,type='coo',dupl=psb_dupl_add_)
call op_restr%mv_to(acoo) call op_restr%mv_to(acoo)
nzl = acoo%get_nzeros() nzl = acoo%get_nzeros()
if (info == psb_success_) call psb_glob_to_loc(acoo%ia(1:nzl),desc_ac,info,'I') if (info == psb_success_) call psb_glob_to_loc(acoo%ia(1:nzl),desc_ac,info,'I')

@ -35,13 +35,193 @@
! File: mld_daggrmat_nosmth_bld.F90 ! File: mld_daggrmat_nosmth_bld.F90
! !
! !
subroutine mld_s_spmm_bld_inner(a_csr,desc_a,ilaggr,nlaggr,parms,ac,& subroutine mld_s_spmm_bld_inner(a_csr,desc_a,nlaggr,parms,ac,&
& op_prol,op_restr,info) & coo_prol,desc_cprol,coo_restr,info)
use psb_base_mod use psb_base_mod
use mld_s_inner_mod use mld_s_inner_mod
use mld_s_base_aggregator_mod, mld_protect_name => mld_s_spmm_bld_inner use mld_s_base_aggregator_mod, mld_protect_name => mld_s_spmm_bld_inner
implicit none implicit none
! Arguments
type(psb_ls_csr_sparse_mat), intent(inout) :: a_csr
type(psb_desc_type), intent(in) :: desc_a
integer(psb_lpk_), intent(inout) :: nlaggr(:)
type(mld_sml_parms), intent(inout) :: parms
type(psb_ls_coo_sparse_mat), intent(inout) :: coo_prol, coo_restr
type(psb_desc_type), intent(inout) :: desc_cprol
type(psb_lsspmat_type), intent(out) :: ac
integer(psb_ipk_), intent(out) :: info
! Local variables
integer(psb_ipk_) :: err_act
integer(psb_ipk_) :: ictxt,np,me, icomm, ndx, minfo
character(len=40) :: name
integer(psb_ipk_) :: ierr(5)
type(psb_ls_coo_sparse_mat) :: ac_coo, tmpcoo
type(psb_ls_csr_sparse_mat) :: acsr3, csr_prol, ac_csr, csr_restr
integer(psb_ipk_) :: debug_level, debug_unit, naggr
integer(psb_lpk_) :: nrow, nglob, ncol, ntaggr, nzl, ip, &
& nzt, naggrm1, naggrp1, i, k
integer(psb_lpk_) :: nrsave, ncsave, nzsave, nza, nrpsave, ncpsave, nzpsave
logical, parameter :: do_timings=.true., oldstyle=.false., debug=.false.
integer(psb_ipk_), save :: idx_spspmm=-1
name='mld_spmm_bld_inner'
if(psb_get_errstatus().ne.0) return
info=psb_success_
call psb_erractionsave(err_act)
ictxt = desc_a%get_context()
icomm = desc_a%get_mpic()
call psb_info(ictxt, me, np)
debug_unit = psb_get_debug_unit()
debug_level = psb_get_debug_level()
nglob = desc_a%get_global_rows()
nrow = desc_a%get_local_rows()
ncol = desc_a%get_local_cols()
if ((do_timings).and.(idx_spspmm==-1)) &
& idx_spspmm = psb_get_timer_idx("SPMM_BLD: par_spspmm")
naggr = nlaggr(me+1)
ntaggr = sum(nlaggr)
naggrm1 = sum(nlaggr(1:me))
naggrp1 = sum(nlaggr(1:me+1))
!write(0,*)me,' ',name,' input sizes',nlaggr(:),':',naggr
nrpsave = coo_prol%get_nrows()
ncpsave = coo_prol%get_ncols()
nzpsave = coo_prol%get_nzeros()
!write(0,*)me,' ',name,' input coo_prol ',nrpsave,ncpsave,nzpsave
!
! Here COO_PROL should be with GLOBAL indices on the cols
! and LOCAL indices on the rows.
!
if (debug) write(0,*) me,' ',trim(name),' Size check on entry New: ',&
& coo_prol%get_fmt(),coo_prol%get_nrows(),coo_prol%get_ncols(),coo_prol%get_nzeros(),&
& nrow,ntaggr,naggr
call coo_prol%cp_to_fmt(csr_prol,info)
if (debug) write(0,*) me,trim(name),' Product AxPROL ',&
& a_csr%get_nrows(),a_csr%get_ncols(), csr_prol%get_nrows(), &
& desc_a%get_local_rows(),desc_a%get_local_cols(),&
& desc_cprol%get_local_rows(),desc_a%get_local_cols()
if (debug) flush(0)
if (do_timings) call psb_tic(idx_spspmm)
call psb_par_spspmm(a_csr,desc_a,csr_prol,acsr3,desc_cprol,info)
if (do_timings) call psb_toc(idx_spspmm)
if (debug) write(0,*) me,trim(name),' Done AxPROL ',&
& acsr3%get_nrows(),acsr3%get_ncols(), acsr3%get_nzeros(),&
& desc_cprol%get_local_rows(),desc_cprol%get_local_cols()
!
! Ok first product done.
!
! Remember that RESTR must be built from PROL after halo extension,
! which is done above in psb_par_spspmm
if (debug) write(0,*)me,' ',name,' No inp_restr, transposing prol ',&
& csr_prol%get_nrows(),csr_prol%get_ncols(),csr_prol%get_nzeros()
call csr_prol%cp_to_fmt(coo_restr,info)
!!$ write(0,*)me,' ',name,' new into transposition ',coo_restr%get_nrows(),&
!!$ & coo_restr%get_ncols(),coo_restr%get_nzeros()
call coo_restr%transp()
nzl = coo_restr%get_nzeros()
call desc_cprol%l2gip(coo_restr%ia(1:nzl),info)
i=0
!
! Now we have to fix this. The only rows of the restrictor that are correct
! are those corresponding to "local" aggregates, i.e. indices in ilaggr(:)
!
do k=1, nzl
if ((naggrm1 < coo_restr%ia(k)) .and.(coo_restr%ia(k) <= naggrp1)) then
i = i+1
coo_restr%val(i) = coo_restr%val(k)
coo_restr%ia(i) = coo_restr%ia(k)
coo_restr%ja(i) = coo_restr%ja(k)
end if
end do
call coo_restr%set_nzeros(i)
call coo_restr%fix(info)
call coo_restr%cp_to_coo(tmpcoo,info)
!!$ write(0,*)me,' ',name,' after transposition ',coo_restr%get_nrows(),coo_restr%get_ncols(),coo_restr%get_nzeros()
if (info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='spcnv coo_restr')
goto 9999
end if
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'starting sphalo/ rwxtd'
nzl = tmpcoo%get_nzeros()
call psb_glob_to_loc(tmpcoo%ia(1:nzl),desc_cprol,info,iact='I',owned=.true.)
call tmpcoo%clean_negidx(info)
nzl = tmpcoo%get_nzeros()
call tmpcoo%set_nrows(desc_cprol%get_local_rows())
call tmpcoo%set_ncols(desc_a%get_local_cols())
!!$ write(0,*)me,' ',name,' after G2L on rows ',tmpcoo%get_nrows(),tmpcoo%get_ncols(),tmpcoo%get_nzeros()
call csr_restr%mv_from_coo(tmpcoo,info)
if (debug) write(0,*) me,trim(name),' Product RESTRxAP ',&
& csr_restr%get_nrows(),csr_restr%get_ncols(), &
& desc_cprol%get_local_rows(),desc_a%get_local_cols(),&
& acsr3%get_nrows(),acsr3%get_ncols()
if (do_timings) call psb_tic(idx_spspmm)
call psb_par_spspmm(csr_restr,desc_a,acsr3,ac_csr,desc_cprol,info)
if (do_timings) call psb_toc(idx_spspmm)
call csr_restr%free()
call ac_csr%mv_to_coo(ac_coo,info)
nza = ac_coo%get_nzeros()
if (debug) write(0,*) me,trim(name),' Fixing ac ',&
& ac_coo%get_nrows(),ac_coo%get_ncols(), nza
call ac_coo%fix(info)
call desc_cprol%indxmap%l2gip(ac_coo%ia(1:nza),info)
call desc_cprol%indxmap%l2gip(ac_coo%ja(1:nza),info)
call ac_coo%set_nrows(ntaggr)
call ac_coo%set_ncols(ntaggr)
if (debug) write(0,*) me,' ',trim(name),' Before mv_from',psb_get_errstatus()
if (info == 0) call ac%mv_from(ac_coo)
if (debug) write(0,*) me,' ',trim(name),' After mv_from',psb_get_errstatus()
if (debug) write(0,*) me,' ',trim(name),' ',ac%get_fmt(),ac%get_nrows(),ac%get_ncols(),ac%get_nzeros(),naggr,ntaggr
! write(0,*) me,' ',trim(name),' Final AC newstyle ',ac%get_fmt(),ac%get_nrows(),ac%get_ncols(),ac%get_nzeros()
nza = coo_prol%get_nzeros()
call desc_cprol%indxmap%l2gip(coo_prol%ja(1:nza),info)
if (debug) then
write(0,*) me,' ',trim(name),' Checkpoint at exit'
call psb_barrier(ictxt)
write(0,*) me,' ',trim(name),' Checkpoint through'
end if
if (info /= psb_success_) then
call psb_errpush(psb_err_internal_error_,name,a_err='Build ac = coo_restr x am3')
goto 9999
end if
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done smooth_aggregate '
call psb_erractionrestore(err_act)
return
9999 call psb_error_handler(err_act)
return
end subroutine mld_s_spmm_bld_inner
subroutine mld_s_old_spmm_bld_inner(a_csr,desc_a,ilaggr,nlaggr,parms,ac,&
& op_prol,op_restr,info)
use psb_base_mod
use mld_s_inner_mod
use mld_s_base_aggregator_mod, mld_protect_name => mld_s_old_spmm_bld_inner
implicit none
! Arguments ! Arguments
type(psb_ls_csr_sparse_mat), intent(inout) :: a_csr type(psb_ls_csr_sparse_mat), intent(inout) :: a_csr
type(psb_desc_type), intent(in) :: desc_a type(psb_desc_type), intent(in) :: desc_a
@ -218,4 +398,4 @@ subroutine mld_s_spmm_bld_inner(a_csr,desc_a,ilaggr,nlaggr,parms,ac,&
return return
end subroutine mld_s_spmm_bld_inner end subroutine mld_s_old_spmm_bld_inner

@ -126,7 +126,7 @@ subroutine mld_saggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_rest
integer(psb_ipk_) :: ictxt, np, me integer(psb_ipk_) :: ictxt, np, me
character(len=20) :: name character(len=20) :: name
type(psb_desc_type) :: tmp_desc type(psb_desc_type) :: tmp_desc
type(psb_ls_coo_sparse_mat) :: tmpcoo type(psb_ls_coo_sparse_mat) :: coo_prol, coo_restr, tmpcoo
type(psb_ls_csr_sparse_mat) :: acsr1, acsrf, csr_prol, acsr type(psb_ls_csr_sparse_mat) :: acsr1, acsrf, csr_prol, acsr
real(psb_spk_), allocatable :: adiag(:) real(psb_spk_), allocatable :: adiag(:)
real(psb_spk_), allocatable :: arwsum(:) real(psb_spk_), allocatable :: arwsum(:)
@ -176,7 +176,7 @@ subroutine mld_saggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_rest
if (info == psb_success_) & if (info == psb_success_) &
& call psb_halo(adiag,desc_a,info) & call psb_halo(adiag,desc_a,info)
if (info == psb_success_) call a%cp_to(acsr) if (info == psb_success_) call a%cp_to(acsr)
call op_prol%cp_to(tmpcoo) call op_prol%mv_to(coo_prol)
if(info /= psb_success_) then if(info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='sp_getdiag') call psb_errpush(psb_err_from_subroutine_,name,a_err='sp_getdiag')
@ -257,10 +257,10 @@ subroutine mld_saggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_rest
inaggr = naggr inaggr = naggr
call psb_cdall(ictxt,tmp_desc,info,nl=inaggr) call psb_cdall(ictxt,tmp_desc,info,nl=inaggr)
nzlp = tmpcoo%get_nzeros() nzlp = coo_prol%get_nzeros()
call tmp_desc%indxmap%g2lip_ins(tmpcoo%ja(1:nzlp),info) call tmp_desc%indxmap%g2lip_ins(coo_prol%ja(1:nzlp),info)
call tmpcoo%set_ncols(tmp_desc%get_local_cols()) call coo_prol%set_ncols(tmp_desc%get_local_cols())
call tmpcoo%mv_to_fmt(csr_prol,info) call coo_prol%mv_to_fmt(csr_prol,info)
! !
! Build the smoothed prolongator using either A or Af ! Build the smoothed prolongator using either A or Af
! acsr1 = (I-w*D*A) Prol acsr1 = (I-w*D*Af) Prol ! acsr1 = (I-w*D*A) Prol acsr1 = (I-w*D*Af) Prol
@ -278,16 +278,24 @@ subroutine mld_saggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_rest
if (debug_level >= psb_debug_outer_) & if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),& & write(debug_unit,*) me,' ',trim(name),&
& 'Done SPSPMM 1' & 'Done SPSPMM 1'
if (.true.) then
nzl = acsr1%get_nzeros()
call acsr1%mv_to_coo(coo_prol,info)
call mld_spmm_bld_inner(acsr,desc_a,nlaggr,parms,ac,&
& coo_prol,tmp_desc,coo_restr,info)
call op_prol%mv_from(coo_prol)
call op_restr%mv_from(coo_restr)
else
nzl = acsr1%get_nzeros() nzl = acsr1%get_nzeros()
call tmp_desc%l2gip(acsr1%ja(1:nzl),info) call tmp_desc%l2gip(acsr1%ja(1:nzl),info)
call acsr1%set_dupl(psb_dupl_add_) call op_prol%mv_from(acsr1)
call acsr1%set_ncols(ntaggr)
call op_prol%cp_from(acsr1)
call mld_spmm_bld_inner(acsr,desc_a,ilaggr,nlaggr,parms,ac,& call mld_spmm_bld_inner(acsr,desc_a,ilaggr,nlaggr,parms,ac,&
& op_prol,op_restr,info) & op_prol,op_restr,info)
end if
if (debug_level >= psb_debug_outer_) & if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),& & write(debug_unit,*) me,' ',trim(name),&

@ -164,7 +164,7 @@ subroutine mld_z_dec_aggregator_mat_asb(ag,parms,a,desc_a,ilaggr,nlaggr,&
call op_prol%set_ncols(desc_ac%get_local_cols()) call op_prol%set_ncols(desc_ac%get_local_cols())
if (np>1) then if (np>1) then
call op_restr%cscnv(info,type='coo',dupl=psb_dupl_add_) !call op_restr%cscnv(info,type='coo',dupl=psb_dupl_add_)
call op_restr%mv_to(acoo) call op_restr%mv_to(acoo)
nzl = acoo%get_nzeros() nzl = acoo%get_nzeros()
if (info == psb_success_) call psb_glob_to_loc(acoo%ia(1:nzl),desc_ac,info,'I') if (info == psb_success_) call psb_glob_to_loc(acoo%ia(1:nzl),desc_ac,info,'I')

@ -35,13 +35,193 @@
! File: mld_daggrmat_nosmth_bld.F90 ! File: mld_daggrmat_nosmth_bld.F90
! !
! !
subroutine mld_z_spmm_bld_inner(a_csr,desc_a,ilaggr,nlaggr,parms,ac,& subroutine mld_z_spmm_bld_inner(a_csr,desc_a,nlaggr,parms,ac,&
& op_prol,op_restr,info) & coo_prol,desc_cprol,coo_restr,info)
use psb_base_mod use psb_base_mod
use mld_z_inner_mod use mld_z_inner_mod
use mld_z_base_aggregator_mod, mld_protect_name => mld_z_spmm_bld_inner use mld_z_base_aggregator_mod, mld_protect_name => mld_z_spmm_bld_inner
implicit none implicit none
! Arguments
type(psb_lz_csr_sparse_mat), intent(inout) :: a_csr
type(psb_desc_type), intent(in) :: desc_a
integer(psb_lpk_), intent(inout) :: nlaggr(:)
type(mld_dml_parms), intent(inout) :: parms
type(psb_lz_coo_sparse_mat), intent(inout) :: coo_prol, coo_restr
type(psb_desc_type), intent(inout) :: desc_cprol
type(psb_lzspmat_type), intent(out) :: ac
integer(psb_ipk_), intent(out) :: info
! Local variables
integer(psb_ipk_) :: err_act
integer(psb_ipk_) :: ictxt,np,me, icomm, ndx, minfo
character(len=40) :: name
integer(psb_ipk_) :: ierr(5)
type(psb_lz_coo_sparse_mat) :: ac_coo, tmpcoo
type(psb_lz_csr_sparse_mat) :: acsr3, csr_prol, ac_csr, csr_restr
integer(psb_ipk_) :: debug_level, debug_unit, naggr
integer(psb_lpk_) :: nrow, nglob, ncol, ntaggr, nzl, ip, &
& nzt, naggrm1, naggrp1, i, k
integer(psb_lpk_) :: nrsave, ncsave, nzsave, nza, nrpsave, ncpsave, nzpsave
logical, parameter :: do_timings=.true., oldstyle=.false., debug=.false.
integer(psb_ipk_), save :: idx_spspmm=-1
name='mld_spmm_bld_inner'
if(psb_get_errstatus().ne.0) return
info=psb_success_
call psb_erractionsave(err_act)
ictxt = desc_a%get_context()
icomm = desc_a%get_mpic()
call psb_info(ictxt, me, np)
debug_unit = psb_get_debug_unit()
debug_level = psb_get_debug_level()
nglob = desc_a%get_global_rows()
nrow = desc_a%get_local_rows()
ncol = desc_a%get_local_cols()
if ((do_timings).and.(idx_spspmm==-1)) &
& idx_spspmm = psb_get_timer_idx("SPMM_BLD: par_spspmm")
naggr = nlaggr(me+1)
ntaggr = sum(nlaggr)
naggrm1 = sum(nlaggr(1:me))
naggrp1 = sum(nlaggr(1:me+1))
!write(0,*)me,' ',name,' input sizes',nlaggr(:),':',naggr
nrpsave = coo_prol%get_nrows()
ncpsave = coo_prol%get_ncols()
nzpsave = coo_prol%get_nzeros()
!write(0,*)me,' ',name,' input coo_prol ',nrpsave,ncpsave,nzpsave
!
! Here COO_PROL should be with GLOBAL indices on the cols
! and LOCAL indices on the rows.
!
if (debug) write(0,*) me,' ',trim(name),' Size check on entry New: ',&
& coo_prol%get_fmt(),coo_prol%get_nrows(),coo_prol%get_ncols(),coo_prol%get_nzeros(),&
& nrow,ntaggr,naggr
call coo_prol%cp_to_fmt(csr_prol,info)
if (debug) write(0,*) me,trim(name),' Product AxPROL ',&
& a_csr%get_nrows(),a_csr%get_ncols(), csr_prol%get_nrows(), &
& desc_a%get_local_rows(),desc_a%get_local_cols(),&
& desc_cprol%get_local_rows(),desc_a%get_local_cols()
if (debug) flush(0)
if (do_timings) call psb_tic(idx_spspmm)
call psb_par_spspmm(a_csr,desc_a,csr_prol,acsr3,desc_cprol,info)
if (do_timings) call psb_toc(idx_spspmm)
if (debug) write(0,*) me,trim(name),' Done AxPROL ',&
& acsr3%get_nrows(),acsr3%get_ncols(), acsr3%get_nzeros(),&
& desc_cprol%get_local_rows(),desc_cprol%get_local_cols()
!
! Ok first product done.
!
! Remember that RESTR must be built from PROL after halo extension,
! which is done above in psb_par_spspmm
if (debug) write(0,*)me,' ',name,' No inp_restr, transposing prol ',&
& csr_prol%get_nrows(),csr_prol%get_ncols(),csr_prol%get_nzeros()
call csr_prol%cp_to_fmt(coo_restr,info)
!!$ write(0,*)me,' ',name,' new into transposition ',coo_restr%get_nrows(),&
!!$ & coo_restr%get_ncols(),coo_restr%get_nzeros()
call coo_restr%transp()
nzl = coo_restr%get_nzeros()
call desc_cprol%l2gip(coo_restr%ia(1:nzl),info)
i=0
!
! Now we have to fix this. The only rows of the restrictor that are correct
! are those corresponding to "local" aggregates, i.e. indices in ilaggr(:)
!
do k=1, nzl
if ((naggrm1 < coo_restr%ia(k)) .and.(coo_restr%ia(k) <= naggrp1)) then
i = i+1
coo_restr%val(i) = coo_restr%val(k)
coo_restr%ia(i) = coo_restr%ia(k)
coo_restr%ja(i) = coo_restr%ja(k)
end if
end do
call coo_restr%set_nzeros(i)
call coo_restr%fix(info)
call coo_restr%cp_to_coo(tmpcoo,info)
!!$ write(0,*)me,' ',name,' after transposition ',coo_restr%get_nrows(),coo_restr%get_ncols(),coo_restr%get_nzeros()
if (info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='spcnv coo_restr')
goto 9999
end if
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'starting sphalo/ rwxtd'
nzl = tmpcoo%get_nzeros()
call psb_glob_to_loc(tmpcoo%ia(1:nzl),desc_cprol,info,iact='I',owned=.true.)
call tmpcoo%clean_negidx(info)
nzl = tmpcoo%get_nzeros()
call tmpcoo%set_nrows(desc_cprol%get_local_rows())
call tmpcoo%set_ncols(desc_a%get_local_cols())
!!$ write(0,*)me,' ',name,' after G2L on rows ',tmpcoo%get_nrows(),tmpcoo%get_ncols(),tmpcoo%get_nzeros()
call csr_restr%mv_from_coo(tmpcoo,info)
if (debug) write(0,*) me,trim(name),' Product RESTRxAP ',&
& csr_restr%get_nrows(),csr_restr%get_ncols(), &
& desc_cprol%get_local_rows(),desc_a%get_local_cols(),&
& acsr3%get_nrows(),acsr3%get_ncols()
if (do_timings) call psb_tic(idx_spspmm)
call psb_par_spspmm(csr_restr,desc_a,acsr3,ac_csr,desc_cprol,info)
if (do_timings) call psb_toc(idx_spspmm)
call csr_restr%free()
call ac_csr%mv_to_coo(ac_coo,info)
nza = ac_coo%get_nzeros()
if (debug) write(0,*) me,trim(name),' Fixing ac ',&
& ac_coo%get_nrows(),ac_coo%get_ncols(), nza
call ac_coo%fix(info)
call desc_cprol%indxmap%l2gip(ac_coo%ia(1:nza),info)
call desc_cprol%indxmap%l2gip(ac_coo%ja(1:nza),info)
call ac_coo%set_nrows(ntaggr)
call ac_coo%set_ncols(ntaggr)
if (debug) write(0,*) me,' ',trim(name),' Before mv_from',psb_get_errstatus()
if (info == 0) call ac%mv_from(ac_coo)
if (debug) write(0,*) me,' ',trim(name),' After mv_from',psb_get_errstatus()
if (debug) write(0,*) me,' ',trim(name),' ',ac%get_fmt(),ac%get_nrows(),ac%get_ncols(),ac%get_nzeros(),naggr,ntaggr
! write(0,*) me,' ',trim(name),' Final AC newstyle ',ac%get_fmt(),ac%get_nrows(),ac%get_ncols(),ac%get_nzeros()
nza = coo_prol%get_nzeros()
call desc_cprol%indxmap%l2gip(coo_prol%ja(1:nza),info)
if (debug) then
write(0,*) me,' ',trim(name),' Checkpoint at exit'
call psb_barrier(ictxt)
write(0,*) me,' ',trim(name),' Checkpoint through'
end if
if (info /= psb_success_) then
call psb_errpush(psb_err_internal_error_,name,a_err='Build ac = coo_restr x am3')
goto 9999
end if
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done smooth_aggregate '
call psb_erractionrestore(err_act)
return
9999 call psb_error_handler(err_act)
return
end subroutine mld_z_spmm_bld_inner
subroutine mld_z_old_spmm_bld_inner(a_csr,desc_a,ilaggr,nlaggr,parms,ac,&
& op_prol,op_restr,info)
use psb_base_mod
use mld_z_inner_mod
use mld_z_base_aggregator_mod, mld_protect_name => mld_z_old_spmm_bld_inner
implicit none
! Arguments ! Arguments
type(psb_lz_csr_sparse_mat), intent(inout) :: a_csr type(psb_lz_csr_sparse_mat), intent(inout) :: a_csr
type(psb_desc_type), intent(in) :: desc_a type(psb_desc_type), intent(in) :: desc_a
@ -218,4 +398,4 @@ subroutine mld_z_spmm_bld_inner(a_csr,desc_a,ilaggr,nlaggr,parms,ac,&
return return
end subroutine mld_z_spmm_bld_inner end subroutine mld_z_old_spmm_bld_inner

@ -126,7 +126,7 @@ subroutine mld_zaggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_rest
integer(psb_ipk_) :: ictxt, np, me integer(psb_ipk_) :: ictxt, np, me
character(len=20) :: name character(len=20) :: name
type(psb_desc_type) :: tmp_desc type(psb_desc_type) :: tmp_desc
type(psb_lz_coo_sparse_mat) :: tmpcoo type(psb_lz_coo_sparse_mat) :: coo_prol, coo_restr, tmpcoo
type(psb_lz_csr_sparse_mat) :: acsr1, acsrf, csr_prol, acsr type(psb_lz_csr_sparse_mat) :: acsr1, acsrf, csr_prol, acsr
complex(psb_dpk_), allocatable :: adiag(:) complex(psb_dpk_), allocatable :: adiag(:)
real(psb_dpk_), allocatable :: arwsum(:) real(psb_dpk_), allocatable :: arwsum(:)
@ -176,7 +176,7 @@ subroutine mld_zaggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_rest
if (info == psb_success_) & if (info == psb_success_) &
& call psb_halo(adiag,desc_a,info) & call psb_halo(adiag,desc_a,info)
if (info == psb_success_) call a%cp_to(acsr) if (info == psb_success_) call a%cp_to(acsr)
call op_prol%cp_to(tmpcoo) call op_prol%mv_to(coo_prol)
if(info /= psb_success_) then if(info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='sp_getdiag') call psb_errpush(psb_err_from_subroutine_,name,a_err='sp_getdiag')
@ -257,10 +257,10 @@ subroutine mld_zaggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_rest
inaggr = naggr inaggr = naggr
call psb_cdall(ictxt,tmp_desc,info,nl=inaggr) call psb_cdall(ictxt,tmp_desc,info,nl=inaggr)
nzlp = tmpcoo%get_nzeros() nzlp = coo_prol%get_nzeros()
call tmp_desc%indxmap%g2lip_ins(tmpcoo%ja(1:nzlp),info) call tmp_desc%indxmap%g2lip_ins(coo_prol%ja(1:nzlp),info)
call tmpcoo%set_ncols(tmp_desc%get_local_cols()) call coo_prol%set_ncols(tmp_desc%get_local_cols())
call tmpcoo%mv_to_fmt(csr_prol,info) call coo_prol%mv_to_fmt(csr_prol,info)
! !
! Build the smoothed prolongator using either A or Af ! Build the smoothed prolongator using either A or Af
! acsr1 = (I-w*D*A) Prol acsr1 = (I-w*D*Af) Prol ! acsr1 = (I-w*D*A) Prol acsr1 = (I-w*D*Af) Prol
@ -278,16 +278,24 @@ subroutine mld_zaggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_rest
if (debug_level >= psb_debug_outer_) & if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),& & write(debug_unit,*) me,' ',trim(name),&
& 'Done SPSPMM 1' & 'Done SPSPMM 1'
if (.true.) then
nzl = acsr1%get_nzeros()
call acsr1%mv_to_coo(coo_prol,info)
call mld_spmm_bld_inner(acsr,desc_a,nlaggr,parms,ac,&
& coo_prol,tmp_desc,coo_restr,info)
call op_prol%mv_from(coo_prol)
call op_restr%mv_from(coo_restr)
else
nzl = acsr1%get_nzeros() nzl = acsr1%get_nzeros()
call tmp_desc%l2gip(acsr1%ja(1:nzl),info) call tmp_desc%l2gip(acsr1%ja(1:nzl),info)
call acsr1%set_dupl(psb_dupl_add_) call op_prol%mv_from(acsr1)
call acsr1%set_ncols(ntaggr)
call op_prol%cp_from(acsr1)
call mld_spmm_bld_inner(acsr,desc_a,ilaggr,nlaggr,parms,ac,& call mld_spmm_bld_inner(acsr,desc_a,ilaggr,nlaggr,parms,ac,&
& op_prol,op_restr,info) & op_prol,op_restr,info)
end if
if (debug_level >= psb_debug_outer_) & if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),& & write(debug_unit,*) me,' ',trim(name),&

@ -44,7 +44,7 @@ module mld_c_base_aggregator_mod
use mld_base_prec_type, only : mld_sml_parms, mld_saggr_data use mld_base_prec_type, only : mld_sml_parms, mld_saggr_data
use psb_base_mod, only : psb_cspmat_type, psb_lcspmat_type, psb_c_vect_type, & use psb_base_mod, only : psb_cspmat_type, psb_lcspmat_type, psb_c_vect_type, &
& psb_c_base_vect_type, psb_clinmap_type, psb_spk_, psb_lc_csr_sparse_mat, & & psb_c_base_vect_type, psb_clinmap_type, psb_spk_, psb_lc_csr_sparse_mat, &
& psb_ipk_, psb_epk_, psb_lpk_, psb_desc_type, psb_i_base_vect_type, & & psb_lc_coo_sparse_mat, psb_ipk_, psb_epk_, psb_lpk_, psb_desc_type, psb_i_base_vect_type, &
& psb_erractionsave, psb_error_handler, psb_success_, psb_toupper & psb_erractionsave, psb_error_handler, psb_success_, psb_toupper
! !
! !
@ -119,7 +119,21 @@ module mld_c_base_aggregator_mod
end interface end interface
interface mld_spmm_bld_inner interface mld_spmm_bld_inner
subroutine mld_c_spmm_bld_inner(a_csr,desc_a,ilaggr,nlaggr,parms,ac,& subroutine mld_c_spmm_bld_inner(a_csr,desc_a,nlaggr,parms,ac,&
& coo_prol,desc_cprol,coo_restr,info)
import :: psb_lc_csr_sparse_mat, psb_lcspmat_type, psb_desc_type, &
& psb_lc_coo_sparse_mat, mld_sml_parms, psb_spk_, psb_ipk_, psb_lpk_
implicit none
type(psb_lc_csr_sparse_mat), intent(inout) :: a_csr
type(psb_desc_type), intent(in) :: desc_a
integer(psb_lpk_), intent(inout) :: nlaggr(:)
type(mld_sml_parms), intent(inout) :: parms
type(psb_lc_coo_sparse_mat), intent(inout) :: coo_prol, coo_restr
type(psb_desc_type), intent(inout) :: desc_cprol
type(psb_lcspmat_type), intent(out) :: ac
integer(psb_ipk_), intent(out) :: info
end subroutine mld_c_spmm_bld_inner
subroutine mld_c_old_spmm_bld_inner(a_csr,desc_a,ilaggr,nlaggr,parms,ac,&
& op_prol,op_restr,info) & op_prol,op_restr,info)
import :: psb_lc_csr_sparse_mat, psb_lcspmat_type, psb_desc_type, & import :: psb_lc_csr_sparse_mat, psb_lcspmat_type, psb_desc_type, &
& mld_sml_parms, psb_spk_, psb_ipk_, psb_lpk_ & mld_sml_parms, psb_spk_, psb_ipk_, psb_lpk_
@ -133,7 +147,7 @@ module mld_c_base_aggregator_mod
type(psb_lcspmat_type), intent(inout) :: op_prol, op_restr type(psb_lcspmat_type), intent(inout) :: op_prol, op_restr
type(psb_lcspmat_type), intent(out) :: ac type(psb_lcspmat_type), intent(out) :: ac
integer(psb_ipk_), intent(out) :: info integer(psb_ipk_), intent(out) :: info
end subroutine mld_c_spmm_bld_inner end subroutine mld_c_old_spmm_bld_inner
end interface mld_spmm_bld_inner end interface mld_spmm_bld_inner
contains contains

@ -44,8 +44,7 @@ module mld_d_base_aggregator_mod
use mld_base_prec_type, only : mld_dml_parms, mld_daggr_data use mld_base_prec_type, only : mld_dml_parms, mld_daggr_data
use psb_base_mod, only : psb_dspmat_type, psb_ldspmat_type, psb_d_vect_type, & use psb_base_mod, only : psb_dspmat_type, psb_ldspmat_type, psb_d_vect_type, &
& psb_d_base_vect_type, psb_dlinmap_type, psb_dpk_, psb_ld_csr_sparse_mat, & & psb_d_base_vect_type, psb_dlinmap_type, psb_dpk_, psb_ld_csr_sparse_mat, &
& psb_ld_coo_sparse_mat, & & psb_ld_coo_sparse_mat, psb_ipk_, psb_epk_, psb_lpk_, psb_desc_type, psb_i_base_vect_type, &
& psb_ipk_, psb_epk_, psb_lpk_, psb_desc_type, psb_i_base_vect_type, &
& psb_erractionsave, psb_error_handler, psb_success_, psb_toupper & psb_erractionsave, psb_error_handler, psb_success_, psb_toupper
! !
! !
@ -120,33 +119,35 @@ module mld_d_base_aggregator_mod
end interface end interface
interface mld_spmm_bld_inner interface mld_spmm_bld_inner
subroutine mld_d_spmm_bld_inner(a_csr,desc_a,ilaggr,nlaggr,parms,ac,& subroutine mld_d_spmm_bld_inner(a_csr,desc_a,nlaggr,parms,ac,&
& op_prol,op_restr,info) & coo_prol,desc_cprol,coo_restr,info)
import :: psb_ld_csr_sparse_mat, psb_ldspmat_type, psb_desc_type, & import :: psb_ld_csr_sparse_mat, psb_ldspmat_type, psb_desc_type, &
& mld_dml_parms, psb_dpk_, psb_ipk_, psb_lpk_ & psb_ld_coo_sparse_mat, mld_dml_parms, psb_dpk_, psb_ipk_, psb_lpk_
implicit none implicit none
type(psb_ld_csr_sparse_mat), intent(inout) :: a_csr type(psb_ld_csr_sparse_mat), intent(inout) :: a_csr
type(psb_desc_type), intent(in) :: desc_a type(psb_desc_type), intent(in) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:) integer(psb_lpk_), intent(inout) :: nlaggr(:)
type(mld_dml_parms), intent(inout) :: parms type(mld_dml_parms), intent(inout) :: parms
type(psb_ldspmat_type), intent(inout) :: op_prol, op_restr type(psb_ld_coo_sparse_mat), intent(inout) :: coo_prol, coo_restr
type(psb_desc_type), intent(inout) :: desc_cprol
type(psb_ldspmat_type), intent(out) :: ac type(psb_ldspmat_type), intent(out) :: ac
integer(psb_ipk_), intent(out) :: info integer(psb_ipk_), intent(out) :: info
end subroutine mld_d_spmm_bld_inner end subroutine mld_d_spmm_bld_inner
subroutine mld_d_new_spmm_bld_inner(a_csr,desc_a,nlaggr,parms,ac,& subroutine mld_d_old_spmm_bld_inner(a_csr,desc_a,ilaggr,nlaggr,parms,ac,&
& coo_prol,desc_cprol,coo_restr,info) & op_prol,op_restr,info)
import :: psb_ld_csr_sparse_mat, psb_ldspmat_type, psb_desc_type, & import :: psb_ld_csr_sparse_mat, psb_ldspmat_type, psb_desc_type, &
& psb_ld_coo_sparse_mat, mld_dml_parms, psb_dpk_, psb_ipk_, psb_lpk_ & mld_dml_parms, psb_dpk_, psb_ipk_, psb_lpk_
implicit none implicit none
! Arguments
type(psb_ld_csr_sparse_mat), intent(inout) :: a_csr type(psb_ld_csr_sparse_mat), intent(inout) :: a_csr
type(psb_desc_type), intent(in) :: desc_a type(psb_desc_type), intent(in) :: desc_a
integer(psb_lpk_), intent(inout) :: nlaggr(:) integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(mld_dml_parms), intent(inout) :: parms type(mld_dml_parms), intent(inout) :: parms
type(psb_ld_coo_sparse_mat), intent(inout) :: coo_prol, coo_restr type(psb_ldspmat_type), intent(inout) :: op_prol, op_restr
type(psb_desc_type), intent(inout) :: desc_cprol
type(psb_ldspmat_type), intent(out) :: ac type(psb_ldspmat_type), intent(out) :: ac
integer(psb_ipk_), intent(out) :: info integer(psb_ipk_), intent(out) :: info
end subroutine mld_d_new_spmm_bld_inner end subroutine mld_d_old_spmm_bld_inner
end interface mld_spmm_bld_inner end interface mld_spmm_bld_inner
contains contains

@ -44,7 +44,7 @@ module mld_s_base_aggregator_mod
use mld_base_prec_type, only : mld_sml_parms, mld_saggr_data use mld_base_prec_type, only : mld_sml_parms, mld_saggr_data
use psb_base_mod, only : psb_sspmat_type, psb_lsspmat_type, psb_s_vect_type, & use psb_base_mod, only : psb_sspmat_type, psb_lsspmat_type, psb_s_vect_type, &
& psb_s_base_vect_type, psb_slinmap_type, psb_spk_, psb_ls_csr_sparse_mat, & & psb_s_base_vect_type, psb_slinmap_type, psb_spk_, psb_ls_csr_sparse_mat, &
& psb_ipk_, psb_epk_, psb_lpk_, psb_desc_type, psb_i_base_vect_type, & & psb_ls_coo_sparse_mat, psb_ipk_, psb_epk_, psb_lpk_, psb_desc_type, psb_i_base_vect_type, &
& psb_erractionsave, psb_error_handler, psb_success_, psb_toupper & psb_erractionsave, psb_error_handler, psb_success_, psb_toupper
! !
! !
@ -119,7 +119,21 @@ module mld_s_base_aggregator_mod
end interface end interface
interface mld_spmm_bld_inner interface mld_spmm_bld_inner
subroutine mld_s_spmm_bld_inner(a_csr,desc_a,ilaggr,nlaggr,parms,ac,& subroutine mld_s_spmm_bld_inner(a_csr,desc_a,nlaggr,parms,ac,&
& coo_prol,desc_cprol,coo_restr,info)
import :: psb_ls_csr_sparse_mat, psb_lsspmat_type, psb_desc_type, &
& psb_ls_coo_sparse_mat, mld_sml_parms, psb_spk_, psb_ipk_, psb_lpk_
implicit none
type(psb_ls_csr_sparse_mat), intent(inout) :: a_csr
type(psb_desc_type), intent(in) :: desc_a
integer(psb_lpk_), intent(inout) :: nlaggr(:)
type(mld_sml_parms), intent(inout) :: parms
type(psb_ls_coo_sparse_mat), intent(inout) :: coo_prol, coo_restr
type(psb_desc_type), intent(inout) :: desc_cprol
type(psb_lsspmat_type), intent(out) :: ac
integer(psb_ipk_), intent(out) :: info
end subroutine mld_s_spmm_bld_inner
subroutine mld_s_old_spmm_bld_inner(a_csr,desc_a,ilaggr,nlaggr,parms,ac,&
& op_prol,op_restr,info) & op_prol,op_restr,info)
import :: psb_ls_csr_sparse_mat, psb_lsspmat_type, psb_desc_type, & import :: psb_ls_csr_sparse_mat, psb_lsspmat_type, psb_desc_type, &
& mld_sml_parms, psb_spk_, psb_ipk_, psb_lpk_ & mld_sml_parms, psb_spk_, psb_ipk_, psb_lpk_
@ -133,7 +147,7 @@ module mld_s_base_aggregator_mod
type(psb_lsspmat_type), intent(inout) :: op_prol, op_restr type(psb_lsspmat_type), intent(inout) :: op_prol, op_restr
type(psb_lsspmat_type), intent(out) :: ac type(psb_lsspmat_type), intent(out) :: ac
integer(psb_ipk_), intent(out) :: info integer(psb_ipk_), intent(out) :: info
end subroutine mld_s_spmm_bld_inner end subroutine mld_s_old_spmm_bld_inner
end interface mld_spmm_bld_inner end interface mld_spmm_bld_inner
contains contains

@ -44,7 +44,7 @@ module mld_z_base_aggregator_mod
use mld_base_prec_type, only : mld_dml_parms, mld_daggr_data use mld_base_prec_type, only : mld_dml_parms, mld_daggr_data
use psb_base_mod, only : psb_zspmat_type, psb_lzspmat_type, psb_z_vect_type, & use psb_base_mod, only : psb_zspmat_type, psb_lzspmat_type, psb_z_vect_type, &
& psb_z_base_vect_type, psb_zlinmap_type, psb_dpk_, psb_lz_csr_sparse_mat, & & psb_z_base_vect_type, psb_zlinmap_type, psb_dpk_, psb_lz_csr_sparse_mat, &
& psb_ipk_, psb_epk_, psb_lpk_, psb_desc_type, psb_i_base_vect_type, & & psb_lz_coo_sparse_mat, psb_ipk_, psb_epk_, psb_lpk_, psb_desc_type, psb_i_base_vect_type, &
& psb_erractionsave, psb_error_handler, psb_success_, psb_toupper & psb_erractionsave, psb_error_handler, psb_success_, psb_toupper
! !
! !
@ -119,7 +119,21 @@ module mld_z_base_aggregator_mod
end interface end interface
interface mld_spmm_bld_inner interface mld_spmm_bld_inner
subroutine mld_z_spmm_bld_inner(a_csr,desc_a,ilaggr,nlaggr,parms,ac,& subroutine mld_z_spmm_bld_inner(a_csr,desc_a,nlaggr,parms,ac,&
& coo_prol,desc_cprol,coo_restr,info)
import :: psb_lz_csr_sparse_mat, psb_lzspmat_type, psb_desc_type, &
& psb_lz_coo_sparse_mat, mld_dml_parms, psb_dpk_, psb_ipk_, psb_lpk_
implicit none
type(psb_lz_csr_sparse_mat), intent(inout) :: a_csr
type(psb_desc_type), intent(in) :: desc_a
integer(psb_lpk_), intent(inout) :: nlaggr(:)
type(mld_dml_parms), intent(inout) :: parms
type(psb_lz_coo_sparse_mat), intent(inout) :: coo_prol, coo_restr
type(psb_desc_type), intent(inout) :: desc_cprol
type(psb_lzspmat_type), intent(out) :: ac
integer(psb_ipk_), intent(out) :: info
end subroutine mld_z_spmm_bld_inner
subroutine mld_z_old_spmm_bld_inner(a_csr,desc_a,ilaggr,nlaggr,parms,ac,&
& op_prol,op_restr,info) & op_prol,op_restr,info)
import :: psb_lz_csr_sparse_mat, psb_lzspmat_type, psb_desc_type, & import :: psb_lz_csr_sparse_mat, psb_lzspmat_type, psb_desc_type, &
& mld_dml_parms, psb_dpk_, psb_ipk_, psb_lpk_ & mld_dml_parms, psb_dpk_, psb_ipk_, psb_lpk_
@ -133,7 +147,7 @@ module mld_z_base_aggregator_mod
type(psb_lzspmat_type), intent(inout) :: op_prol, op_restr type(psb_lzspmat_type), intent(inout) :: op_prol, op_restr
type(psb_lzspmat_type), intent(out) :: ac type(psb_lzspmat_type), intent(out) :: ac
integer(psb_ipk_), intent(out) :: info integer(psb_ipk_), intent(out) :: info
end subroutine mld_z_spmm_bld_inner end subroutine mld_z_old_spmm_bld_inner
end interface mld_spmm_bld_inner end interface mld_spmm_bld_inner
contains contains

Loading…
Cancel
Save