Merge branch 'unify_aggr_bld' into development

implement-ainv
Salvatore Filippone 5 years ago
commit dd9f1070a4

@ -14,42 +14,34 @@ mld_s_dec_aggregator_mat_bld.o \
mld_s_dec_aggregator_tprol.o \
mld_s_symdec_aggregator_tprol.o \
mld_s_map_to_tprol.o mld_s_soc1_map_bld.o mld_s_soc2_map_bld.o\
mld_s_spmm_bld_inner.o \
mld_saggrmat_biz_bld.o mld_saggrmat_minnrg_bld.o\
mld_s_ptap.o \
mld_saggrmat_minnrg_bld.o\
mld_saggrmat_nosmth_bld.o mld_saggrmat_smth_bld.o \
mld_d_dec_aggregator_mat_asb.o \
mld_d_dec_aggregator_mat_bld.o \
mld_d_dec_aggregator_tprol.o \
mld_d_symdec_aggregator_tprol.o \
mld_d_map_to_tprol.o mld_d_soc1_map_bld.o mld_d_soc2_map_bld.o \
mld_d_spmm_bld_inner.o \
mld_daggrmat_biz_bld.o mld_daggrmat_minnrg_bld.o \
mld_d_ptap.o \
mld_daggrmat_minnrg_bld.o \
mld_daggrmat_nosmth_bld.o mld_daggrmat_smth_bld.o \
mld_c_dec_aggregator_mat_asb.o \
mld_c_dec_aggregator_mat_bld.o \
mld_c_dec_aggregator_tprol.o \
mld_c_symdec_aggregator_tprol.o \
mld_c_map_to_tprol.o mld_c_soc1_map_bld.o mld_c_soc2_map_bld.o\
mld_c_spmm_bld_inner.o \
mld_caggrmat_biz_bld.o mld_caggrmat_minnrg_bld.o\
mld_c_ptap.o \
mld_caggrmat_minnrg_bld.o\
mld_caggrmat_nosmth_bld.o mld_caggrmat_smth_bld.o \
mld_z_dec_aggregator_mat_asb.o \
mld_z_dec_aggregator_mat_bld.o \
mld_z_dec_aggregator_tprol.o \
mld_z_symdec_aggregator_tprol.o \
mld_z_map_to_tprol.o mld_z_soc1_map_bld.o mld_z_soc2_map_bld.o\
mld_z_spmm_bld_inner.o \
mld_zaggrmat_biz_bld.o mld_zaggrmat_minnrg_bld.o\
mld_z_ptap.o \
mld_zaggrmat_minnrg_bld.o\
mld_zaggrmat_nosmth_bld.o mld_zaggrmat_smth_bld.o
#mld_s_hybrid_aggregator_tprol.o \
#mld_d_hybrid_aggregator_tprol.o \
#mld_c_hybrid_aggregator_tprol.o \
#mld_z_hybrid_aggregator_tprol.o \
#bootCMatch_interface.o mld_d_bcmatch_aggregator_tprol.o\
#mld_d_bcmatch_map_to_tprol.o mld_d_bcmatch_aggregator_mat_bld.o \
LIBNAME=libmld_prec.a

@ -83,7 +83,7 @@
! info - integer, output.
! Error code.
!
subroutine mld_c_dec_aggregator_mat_asb(ag,parms,a,desc_a,ilaggr,nlaggr,&
subroutine mld_c_dec_aggregator_mat_asb(ag,parms,a,desc_a,&
& ac,desc_ac, op_prol,op_restr,info)
use psb_base_mod
use mld_base_prec_type
@ -93,16 +93,13 @@ subroutine mld_c_dec_aggregator_mat_asb(ag,parms,a,desc_a,ilaggr,nlaggr,&
type(mld_sml_parms), intent(inout) :: parms
type(psb_cspmat_type), intent(in) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(psb_lcspmat_type), intent(inout) :: op_prol, ac,op_restr
type(psb_cspmat_type), intent(inout) :: op_prol, ac,op_restr
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
!
integer(psb_ipk_) :: ictxt, np, me
type(psb_lc_coo_sparse_mat) :: lacoo, lbcoo
type(psb_c_coo_sparse_mat) :: acoo
type(psb_lc_csr_sparse_mat) :: acsr1
type(psb_cspmat_type) :: tmp_ac
type(psb_lc_coo_sparse_mat) :: tmpcoo
type(psb_lcspmat_type) :: tmp_ac
integer(psb_ipk_) :: i_nr, i_nc, i_nl, nzl
integer(psb_lpk_) :: ntaggr
integer(psb_ipk_) :: err_act, debug_level, debug_unit
@ -117,70 +114,13 @@ subroutine mld_c_dec_aggregator_mat_asb(ag,parms,a,desc_a,ilaggr,nlaggr,&
ictxt = desc_a%get_context()
call psb_info(ictxt,me,np)
ntaggr = sum(nlaggr)
select case(parms%coarse_mat)
case(mld_distr_mat_)
call ac%mv_to(lbcoo)
nzl = lbcoo%get_nzeros()
i_nl = nlaggr(me+1)
if (info == psb_success_) call psb_cdall(ictxt,desc_ac,info,nl=i_nl)
if (info == psb_success_) call psb_cdins(nzl,lbcoo%ia,lbcoo%ja,desc_ac,info)
if (info == psb_success_) call psb_cdasb(desc_ac,info)
if (info == psb_success_) call psb_glob_to_loc(lbcoo%ia(1:nzl),desc_ac,info,iact='I')
if (info == psb_success_) call psb_glob_to_loc(lbcoo%ja(1:nzl),desc_ac,info,iact='I')
if (info /= psb_success_) then
call psb_errpush(psb_err_internal_error_,name,&
& a_err='Creating desc_ac and converting ac')
goto 9999
end if
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Assembld aux descr. distr.'
call ac%mv_from(lbcoo)
call ac%set_nrows(desc_ac%get_local_rows())
call ac%set_ncols(desc_ac%get_local_cols())
call ac%set_asb()
if (info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='psb_sp_free')
goto 9999
end if
if (np>1) then
call op_prol%mv_to(acsr1)
nzl = acsr1%get_nzeros()
call psb_glob_to_loc(acsr1%ja(1:nzl),desc_ac,info,'I')
if(info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='psb_glob_to_loc')
goto 9999
end if
call op_prol%mv_from(acsr1)
endif
call op_prol%set_ncols(desc_ac%get_local_cols())
if (np>1) then
!call op_restr%cscnv(info,type='coo',dupl=psb_dupl_add_)
call op_restr%mv_to(lacoo)
nzl = lacoo%get_nzeros()
if (info == psb_success_) call psb_glob_to_loc(lacoo%ia(1:nzl),desc_ac,info,'I')
call lacoo%set_dupl(psb_dupl_add_)
if (info == psb_success_) call op_restr%mv_from(lacoo)
if (info == psb_success_) call op_restr%cscnv(info,type='csr')
if(info /= psb_success_) then
call psb_errpush(psb_err_internal_error_,name,&
& a_err='Converting op_restr to local')
goto 9999
end if
end if
!
! Clip to local rows.
!
call op_restr%set_nrows(desc_ac%get_local_rows())
call ac%cscnv(info,type='csr')
call op_prol%cscnv(info,type='csr')
call op_restr%cscnv(info,type='csr')
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
@ -188,23 +128,39 @@ subroutine mld_c_dec_aggregator_mat_asb(ag,parms,a,desc_a,ilaggr,nlaggr,&
case(mld_repl_mat_)
!
! We are assuming here that an c matrix
! can hold all entries
!
! If we are here, it means we assume that an IPK version of the
! coarse matrix can hold all indices. User beware!
!
if (desc_ac%get_global_rows() < huge(1_psb_ipk_) ) then
ntaggr = desc_ac%get_global_rows()
i_nr = ntaggr
else
info = psb_err_internal_error_
call psb_errpush(info,name,a_err='invalid mld_coarse_mat_')
goto 9999
end if
call op_prol%mv_to(tmpcoo)
nzl = tmpcoo%get_nzeros()
call psb_loc_to_glob(tmpcoo%ja(1:nzl),desc_ac,info,'I')
call op_prol%mv_from(tmpcoo)
call op_restr%mv_to(tmpcoo)
nzl = tmpcoo%get_nzeros()
call psb_loc_to_glob(tmpcoo%ia(1:nzl),desc_ac,info,'I')
call op_restr%mv_from(tmpcoo)
call op_prol%set_ncols(i_nr)
call op_restr%set_nrows(i_nr)
call psb_gather(tmp_ac,ac,desc_ac,info,root=-ione,&
& dupl=psb_dupl_add_,keeploc=.false.)
call tmp_ac%mv_to(tmpcoo)
call ac%mv_from(tmpcoo)
!
! op_prol/op_restr come from par_spmm_bld with local sizes
! suitable for DIST option, fix relevant sizes
!
call op_prol%set_ncols(ntaggr)
call op_restr%set_nrows(ntaggr)
call psb_cdall(ictxt,desc_ac,info,mg=ntaggr,repl=.true.)
if (info == psb_success_) call psb_cdasb(desc_ac,info)
if (info == psb_success_) call ac%mv_to(acoo)
if (info == psb_success_) call tmp_ac%mv_from(acoo)
if (info == psb_success_) &
& call psb_gather(ac,tmp_ac,desc_ac,info,dupl=psb_dupl_add_,keeploc=.false.)
if (info /= psb_success_) goto 9999
case default
@ -221,4 +177,19 @@ subroutine mld_c_dec_aggregator_mat_asb(ag,parms,a,desc_a,ilaggr,nlaggr,&
return
contains
subroutine check_coo(me,string,coo)
implicit none
integer(psb_ipk_) :: me
type(psb_lc_coo_sparse_mat) :: coo
character(len=*) :: string
integer(psb_lpk_) :: nr,nc,nz
nr = coo%get_nrows()
nc = coo%get_ncols()
nz = coo%get_nzeros()
write(0,*) me,string,nr,nc,&
& minval(coo%ia(1:nz)),maxval(coo%ia(1:nz)),&
& minval(coo%ja(1:nz)),maxval(coo%ja(1:nz))
end subroutine check_coo
end subroutine mld_c_dec_aggregator_mat_asb

@ -133,7 +133,8 @@
! info - integer, output.
! Error code.
!
subroutine mld_c_dec_aggregator_mat_bld(ag,parms,a,desc_a,ilaggr,nlaggr,ac,op_prol,op_restr,info)
subroutine mld_c_dec_aggregator_mat_bld(ag,parms,a,desc_a,ilaggr,nlaggr,&
& ac,desc_ac,op_prol,op_restr,t_prol,info)
use psb_base_mod
use mld_c_prec_type, mld_protect_name => mld_c_dec_aggregator_mat_bld
use mld_c_inner_mod
@ -144,15 +145,14 @@ subroutine mld_c_dec_aggregator_mat_bld(ag,parms,a,desc_a,ilaggr,nlaggr,ac,op_p
type(psb_cspmat_type), intent(in) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(psb_lcspmat_type), intent(inout) :: op_prol
type(psb_lcspmat_type), intent(out) :: ac,op_restr
type(psb_lcspmat_type), intent(inout) :: t_prol
type(psb_cspmat_type), intent(out) :: op_prol,ac,op_restr
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
! Local variables
character(len=20) :: name
integer(psb_mpk_) :: ictxt, np, me
type(psb_lc_coo_sparse_mat) :: acoo, bcoo
type(psb_lc_csr_sparse_mat) :: acsr1
integer(psb_lpk_) :: nzl,ntaggr
integer(psb_ipk_) :: err_act
integer(psb_ipk_) :: debug_level, debug_unit
@ -177,22 +177,22 @@ subroutine mld_c_dec_aggregator_mat_bld(ag,parms,a,desc_a,ilaggr,nlaggr,ac,op_p
case (mld_no_smooth_)
call mld_caggrmat_nosmth_bld(a,desc_a,ilaggr,nlaggr,&
& parms,ac,op_prol,op_restr,info)
& parms,ac,desc_ac,op_prol,op_restr,t_prol,info)
case(mld_smooth_prol_)
call mld_caggrmat_smth_bld(a,desc_a,ilaggr,nlaggr, &
& parms,ac,op_prol,op_restr,info)
& parms,ac,desc_ac,op_prol,op_restr,t_prol,info)
case(mld_biz_prol_)
call mld_caggrmat_biz_bld(a,desc_a,ilaggr,nlaggr, &
& parms,ac,op_prol,op_restr,info)
!!$ case(mld_biz_prol_)
!!$
!!$ call mld_caggrmat_biz_bld(a,desc_a,ilaggr,nlaggr, &
!!$ & parms,ac,desc_ac,op_prol,op_restr,t_prol,info)
case(mld_min_energy_)
call mld_caggrmat_minnrg_bld(a,desc_a,ilaggr,nlaggr, &
& parms,ac,op_prol,op_restr,info)
& parms,ac,desc_ac,op_prol,op_restr,t_prol,info)
case default
info = psb_err_internal_error_

@ -68,14 +68,14 @@
! overlap.
! nlaggr - integer, dimension(:), allocatable, output
! nlaggr(i) contains the aggregates held by process i.
! op_prol - type(psb_cspmat_type), output
! t_prol - type(psb_cspmat_type), output
! The tentative prolongator, based on ilaggr.
!
! info - integer, output.
! Error code.
!
subroutine mld_c_dec_aggregator_build_tprol(ag,parms,ag_data,&
& a,desc_a,ilaggr,nlaggr,op_prol,info)
& a,desc_a,ilaggr,nlaggr,t_prol,info)
use psb_base_mod
use mld_c_prec_type, mld_protect_name => mld_c_dec_aggregator_build_tprol
use mld_c_inner_mod
@ -86,7 +86,7 @@ subroutine mld_c_dec_aggregator_build_tprol(ag,parms,ag_data,&
type(psb_cspmat_type), intent(in) :: a
type(psb_desc_type), intent(in) :: desc_a
integer(psb_lpk_), allocatable, intent(out) :: ilaggr(:),nlaggr(:)
type(psb_lcspmat_type), intent(out) :: op_prol
type(psb_lcspmat_type), intent(out) :: t_prol
integer(psb_ipk_), intent(out) :: info
! Local variables
@ -123,7 +123,7 @@ subroutine mld_c_dec_aggregator_build_tprol(ag,parms,ag_data,&
clean_zeros = ag%do_clean_zeros
call ag%soc_map_bld(parms%aggr_ord,parms%aggr_thresh,clean_zeros,a,desc_a,nlaggr,ilaggr,info)
if (info==psb_success_) call mld_map_to_tprol(desc_a,ilaggr,nlaggr,op_prol,info)
if (info==psb_success_) call mld_map_to_tprol(desc_a,ilaggr,nlaggr,t_prol,info)
if (info /= psb_success_) then
info=psb_err_from_subroutine_
call psb_errpush(info,name,a_err='soc_map_bld/map_to_tprol')

@ -124,9 +124,9 @@ subroutine mld_c_map_to_tprol(desc_a,ilaggr,nlaggr,op_prol,info)
goto 9999
end if
call tmpcoo%allocate(ncol,ntaggr,ncol)
call tmpcoo%allocate(nrow,ntaggr,ncol)
k = 0
do i=1,ncol
do i=1,nrow
!
! Note: at this point, a value ilaggr(i)<=0
! tags a "singleton" row, and it has to be

@ -0,0 +1,689 @@
!
!
! MLD2P4 Extensions
!
! (C) Copyright 2019
!
! Salvatore Filippone Cranfield University
! Pasqua D'Ambra IAC-CNR, Naples, IT
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the MLD2P4 group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE MLD2P4 GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
! File: mld_daggrmat_nosmth_bld.F90
!
!
subroutine mld_c_ptap(a_csr,desc_a,nlaggr,parms,ac,&
& coo_prol,desc_ac,coo_restr,info,desc_ax)
use psb_base_mod
use mld_c_inner_mod
use mld_c_base_aggregator_mod, mld_protect_name => mld_c_ptap
implicit none
! Arguments
type(psb_c_csr_sparse_mat), intent(inout) :: a_csr
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: nlaggr(:)
type(mld_sml_parms), intent(inout) :: parms
type(psb_c_coo_sparse_mat), intent(inout) :: coo_prol, coo_restr
type(psb_desc_type), intent(inout) :: desc_ac
type(psb_cspmat_type), intent(out) :: ac
integer(psb_ipk_), intent(out) :: info
type(psb_desc_type), intent(inout), optional :: desc_ax
! 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_c_csr_sparse_mat) :: acsr3, csr_prol, ac_csr, csr_restr
integer(psb_ipk_) :: debug_level, debug_unit, naggr
integer(psb_lpk_) :: nglob, ntaggr, naggrm1, naggrp1
integer(psb_ipk_) :: nrow, ncol, nrl, nzl, ip, nzt, i, k
integer(psb_lpk_) :: nrsave, ncsave, nzsave, nza
logical, parameter :: do_timings=.false., oldstyle=.false., debug=.false.
integer(psb_ipk_), save :: idx_spspmm=-1
name='mld_ptap'
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
!
! COO_PROL should arrive here with local numbering
!
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_ac%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_ac,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_ac%get_local_rows(),desc_ac%get_local_cols()
!
! Ok first product done.
if (present(desc_ax)) then
block
call coo_prol%cp_to_coo(coo_restr,info)
call coo_restr%set_ncols(desc_ac%get_local_cols())
call coo_restr%set_nrows(desc_a%get_local_rows())
call psb_c_coo_glob_transpose(coo_restr,desc_a,info,desc_c=desc_ac,desc_rx=desc_ax)
call coo_restr%set_nrows(desc_ac%get_local_rows())
call coo_restr%set_ncols(desc_ax%get_local_cols())
!!$ write(0,*) me,' ',trim(name),' check on glob_transpose 1: ',&
!!$ & desc_a%get_local_cols(),desc_ax%get_local_cols(),coo_restr%get_nzeros()
if (desc_a%get_local_cols()<desc_ax%get_local_cols()) then
write(0,*) me,' ',trim(name),' WARNING: GLOB_TRANSPOSE NEW INDICES '
end if
end block
call csr_restr%cp_from_coo(coo_restr,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'
if (debug) write(0,*) me,trim(name),' Product RESTRxAP ',&
& csr_restr%get_nrows(),csr_restr%get_ncols(), &
& desc_ac%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_ax,acsr3,ac_csr,desc_ac,info)
if (do_timings) call psb_toc(idx_spspmm)
call acsr3%free()
else
!
! 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%mv_to_coo(coo_restr,info)
!!$ write(0,*)me,' ',name,' new into transposition ',coo_restr%get_nrows(),&
!!$ & coo_restr%get_ncols(),coo_restr%get_nzeros()
if (debug) call check_coo(me,trim(name)//' Check 1 (before transp) on coo_restr:',coo_restr)
call coo_restr%transp()
nzl = coo_restr%get_nzeros()
nrl = desc_ac%get_local_rows()
i=0
!
! Only keep local rows
!
do k=1, nzl
if ((1 <= coo_restr%ia(k)) .and.(coo_restr%ia(k) <= nrl)) 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)
nzl = coo_restr%get_nzeros()
call coo_restr%set_nrows(desc_ac%get_local_rows())
call coo_restr%set_ncols(desc_a%get_local_cols())
if (debug) call check_coo(me,trim(name)//' Check 2 on coo_restr:',coo_restr)
call csr_restr%cp_from_coo(coo_restr,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'
if (debug) write(0,*) me,trim(name),' Product RESTRxAP ',&
& csr_restr%get_nrows(),csr_restr%get_ncols(), &
& desc_ac%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_ac,info)
if (do_timings) call psb_toc(idx_spspmm)
call acsr3%free()
end if
call psb_cdasb(desc_ac,info)
call ac_csr%set_nrows(desc_ac%get_local_rows())
call ac_csr%set_ncols(desc_ac%get_local_cols())
call ac%mv_from(ac_csr)
call ac%set_asb()
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()
call coo_prol%set_ncols(desc_ac%get_local_cols())
if (debug) call check_coo(me,trim(name)//' Check 3 on coo_restr:',coo_restr)
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done ptap '
call psb_erractionrestore(err_act)
return
9999 call psb_error_handler(err_act)
return
contains
subroutine check_coo(me,string,coo)
implicit none
integer(psb_ipk_) :: me
type(psb_c_coo_sparse_mat) :: coo
character(len=*) :: string
integer(psb_lpk_) :: nr,nc,nz
nr = coo%get_nrows()
nc = coo%get_ncols()
nz = coo%get_nzeros()
write(0,*) me,string,nr,nc,&
& minval(coo%ia(1:nz)),maxval(coo%ia(1:nz)),&
& minval(coo%ja(1:nz)),maxval(coo%ja(1:nz))
end subroutine check_coo
end subroutine mld_c_ptap
subroutine mld_c_lc_ptap(a_csr,desc_a,nlaggr,parms,ac,&
& coo_prol,desc_ac,coo_restr,info,desc_ax)
use psb_base_mod
use mld_c_inner_mod
use mld_c_base_aggregator_mod !, mld_protect_name => mld_c_lc_ptap
implicit none
! Arguments
type(psb_c_csr_sparse_mat), intent(inout) :: a_csr
type(psb_desc_type), intent(inout) :: 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_ac
type(psb_lcspmat_type), intent(out) :: ac
integer(psb_ipk_), intent(out) :: info
type(psb_desc_type), intent(inout), optional :: desc_ax
! 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_c_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, nrl, nzl, ip, &
& nzt, naggrm1, naggrp1, i, k
integer(psb_lpk_) :: nrsave, ncsave, nzsave, nza
logical, parameter :: do_timings=.false., oldstyle=.false., debug=.false.
integer(psb_ipk_), save :: idx_spspmm=-1
name='mld_ptap'
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
!
! COO_PROL should arrive here with local numbering
!
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_ifmt(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_ac%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_ac,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_ac%get_local_rows(),desc_ac%get_local_cols()
!
! Ok first product done.
if (present(desc_ax)) then
block
type(psb_c_coo_sparse_mat) :: icoo_restr
call coo_prol%cp_to_icoo(icoo_restr,info)
call icoo_restr%set_ncols(desc_ac%get_local_cols())
call icoo_restr%set_nrows(desc_a%get_local_rows())
call psb_c_coo_glob_transpose(icoo_restr,desc_a,info,desc_c=desc_ac,desc_rx=desc_ax)
call icoo_restr%set_nrows(desc_ac%get_local_rows())
call icoo_restr%set_ncols(desc_ax%get_local_cols())
write(0,*) me,' ',trim(name),' check on glob_transpose 1: ',&
& desc_a%get_local_cols(),desc_ax%get_local_cols(),icoo_restr%get_nzeros()
if (desc_a%get_local_cols()<desc_ax%get_local_cols()) then
write(0,*) me,' ',trim(name),' WARNING: GLOB_TRANSPOSE NEW INDICES '
end if
call coo_restr%cp_from_icoo(icoo_restr,info)
end block
call csr_restr%cp_from_lcoo(coo_restr,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'
if (debug) write(0,*) me,trim(name),' Product RESTRxAP ',&
& csr_restr%get_nrows(),csr_restr%get_ncols(), &
& desc_ac%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_ax,acsr3,ac_csr,desc_ac,info)
if (do_timings) call psb_toc(idx_spspmm)
call acsr3%free()
else
!
! 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%mv_to_lcoo(coo_restr,info)
!!$ write(0,*)me,' ',name,' new into transposition ',coo_restr%get_nrows(),&
!!$ & coo_restr%get_ncols(),coo_restr%get_nzeros()
if (debug) call check_coo(me,trim(name)//' Check 1 (before transp) on coo_restr:',coo_restr)
call coo_restr%transp()
nzl = coo_restr%get_nzeros()
nrl = desc_ac%get_local_rows()
i=0
!
! Only keep local rows
!
do k=1, nzl
if ((1 <= coo_restr%ia(k)) .and.(coo_restr%ia(k) <= nrl)) 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)
nzl = coo_restr%get_nzeros()
call coo_restr%set_nrows(desc_ac%get_local_rows())
call coo_restr%set_ncols(desc_a%get_local_cols())
if (debug) call check_coo(me,trim(name)//' Check 2 on coo_restr:',coo_restr)
call csr_restr%cp_from_lcoo(coo_restr,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'
if (debug) write(0,*) me,trim(name),' Product RESTRxAP ',&
& csr_restr%get_nrows(),csr_restr%get_ncols(), &
& desc_ac%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_ac,info)
if (do_timings) call psb_toc(idx_spspmm)
call acsr3%free()
end if
call psb_cdasb(desc_ac,info)
call ac_csr%set_nrows(desc_ac%get_local_rows())
call ac_csr%set_ncols(desc_ac%get_local_cols())
call ac%mv_from(ac_csr)
call ac%set_asb()
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()
call coo_prol%set_ncols(desc_ac%get_local_cols())
if (debug) call check_coo(me,trim(name)//' Check 3 on coo_restr:',coo_restr)
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done ptap '
call psb_erractionrestore(err_act)
return
9999 call psb_error_handler(err_act)
return
contains
subroutine check_coo(me,string,coo)
implicit none
integer(psb_ipk_) :: me
type(psb_lc_coo_sparse_mat) :: coo
character(len=*) :: string
integer(psb_lpk_) :: nr,nc,nz
nr = coo%get_nrows()
nc = coo%get_ncols()
nz = coo%get_nzeros()
write(0,*) me,string,nr,nc,&
& minval(coo%ia(1:nz)),maxval(coo%ia(1:nz)),&
& minval(coo%ja(1:nz)),maxval(coo%ja(1:nz))
end subroutine check_coo
end subroutine mld_c_lc_ptap
subroutine mld_lc_ptap(a_csr,desc_a,nlaggr,parms,ac,&
& coo_prol,desc_ac,coo_restr,info,desc_ax)
use psb_base_mod
use mld_c_inner_mod
use mld_c_base_aggregator_mod!, mld_protect_name => mld_lc_ptap
implicit none
! Arguments
type(psb_lc_csr_sparse_mat), intent(inout) :: a_csr
type(psb_desc_type), intent(inout) :: 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_ac
type(psb_lcspmat_type), intent(out) :: ac
integer(psb_ipk_), intent(out) :: info
type(psb_desc_type), intent(inout), optional :: desc_ax
! 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, nrl, nzl, ip, &
& nzt, naggrm1, naggrp1, i, k
integer(psb_lpk_) :: nrsave, ncsave, nzsave, nza
logical, parameter :: do_timings=.true., oldstyle=.false., debug=.false.
integer(psb_ipk_), save :: idx_spspmm=-1
name='mld_ptap'
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
!
! COO_PROL should arrive here with local numbering
!
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_ac%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_ac,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_ac%get_local_rows(),desc_ac%get_local_cols()
!
! Ok first product done.
if (present(desc_ax)) then
block
type(psb_c_coo_sparse_mat) :: icoo_restr
call coo_prol%cp_to_icoo(icoo_restr,info)
call icoo_restr%set_ncols(desc_ac%get_local_cols())
call icoo_restr%set_nrows(desc_a%get_local_rows())
call psb_c_coo_glob_transpose(icoo_restr,desc_a,info,desc_c=desc_ac,desc_rx=desc_ax)
call icoo_restr%set_nrows(desc_ac%get_local_rows())
call icoo_restr%set_ncols(desc_ax%get_local_cols())
write(0,*) me,' ',trim(name),' check on glob_transpose 1: ',&
& desc_a%get_local_cols(),desc_ax%get_local_cols(),icoo_restr%get_nzeros()
if (desc_a%get_local_cols()<desc_ax%get_local_cols()) then
write(0,*) me,' ',trim(name),' WARNING: GLOB_TRANSPOSE NEW INDICES '
end if
call coo_restr%cp_from_icoo(icoo_restr,info)
end block
call csr_restr%cp_from_coo(coo_restr,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'
if (debug) write(0,*) me,trim(name),' Product RESTRxAP ',&
& csr_restr%get_nrows(),csr_restr%get_ncols(), &
& desc_ac%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_ax,acsr3,ac_csr,desc_ac,info)
if (do_timings) call psb_toc(idx_spspmm)
call acsr3%free()
else
!
! 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%mv_to_coo(coo_restr,info)
!!$ write(0,*)me,' ',name,' new into transposition ',coo_restr%get_nrows(),&
!!$ & coo_restr%get_ncols(),coo_restr%get_nzeros()
if (debug) call check_coo(me,trim(name)//' Check 1 (before transp) on coo_restr:',coo_restr)
call coo_restr%transp()
nzl = coo_restr%get_nzeros()
nrl = desc_ac%get_local_rows()
i=0
!
! Only keep local rows
!
do k=1, nzl
if ((1 <= coo_restr%ia(k)) .and.(coo_restr%ia(k) <= nrl)) 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)
nzl = coo_restr%get_nzeros()
call coo_restr%set_nrows(desc_ac%get_local_rows())
call coo_restr%set_ncols(desc_a%get_local_cols())
if (debug) call check_coo(me,trim(name)//' Check 2 on coo_restr:',coo_restr)
call csr_restr%cp_from_coo(coo_restr,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'
if (debug) write(0,*) me,trim(name),' Product RESTRxAP ',&
& csr_restr%get_nrows(),csr_restr%get_ncols(), &
& desc_ac%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_ac,info)
if (do_timings) call psb_toc(idx_spspmm)
call acsr3%free()
end if
call psb_cdasb(desc_ac,info)
call ac_csr%set_nrows(desc_ac%get_local_rows())
call ac_csr%set_ncols(desc_ac%get_local_cols())
call ac%mv_from(ac_csr)
call ac%set_asb()
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()
call coo_prol%set_ncols(desc_ac%get_local_cols())
!call coo_restr%mv_from_ifmt(csr_restr,info)
!!$ call coo_restr%set_nrows(desc_ac%get_local_rows())
!!$ call coo_restr%set_ncols(desc_a%get_local_cols())
if (debug) call check_coo(me,trim(name)//' Check 3 on coo_restr:',coo_restr)
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done ptap '
call psb_erractionrestore(err_act)
return
9999 call psb_error_handler(err_act)
return
contains
subroutine check_coo(me,string,coo)
implicit none
integer(psb_ipk_) :: me
type(psb_lc_coo_sparse_mat) :: coo
character(len=*) :: string
integer(psb_lpk_) :: nr,nc,nz
nr = coo%get_nrows()
nc = coo%get_ncols()
nz = coo%get_nzeros()
write(0,*) me,string,nr,nc,&
& minval(coo%ia(1:nz)),maxval(coo%ia(1:nz)),&
& minval(coo%ja(1:nz)),maxval(coo%ja(1:nz))
end subroutine check_coo
end subroutine mld_lc_ptap

@ -1,390 +0,0 @@
!
!
! MLD2P4 Extensions
!
! (C) Copyright 2019
!
! Salvatore Filippone Cranfield University
! Pasqua D'Ambra IAC-CNR, Naples, IT
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the MLD2P4 group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE MLD2P4 GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
! File: mld_daggrmat_nosmth_bld.F90
!
!
subroutine mld_c_spmm_bld_inner(a_csr,desc_a,nlaggr,parms,ac,&
& coo_prol,desc_cprol,coo_restr,info)
use psb_base_mod
use mld_c_inner_mod
use mld_c_base_aggregator_mod, mld_protect_name => mld_c_spmm_bld_inner
implicit none
! Arguments
type(psb_c_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_c_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
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
!
! COO_PROL should arrive here with local numbering
!
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_ifmt(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_lcoo(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_lcoo(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 acsr3%free()
call ac_csr%mv_to_lcoo(ac_coo,info)
call ac_coo%fix(info)
nza = ac_coo%get_nzeros()
if (debug) write(0,*) me,trim(name),' Fixed ac ',&
& ac_coo%get_nrows(),ac_coo%get_ncols(), nza
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 spmm_bld_inner '
call psb_erractionrestore(err_act)
return
9999 call psb_error_handler(err_act)
return
end subroutine mld_c_spmm_bld_inner
subroutine mld_lc_spmm_bld_inner(a_csr,desc_a,nlaggr,parms,ac,&
& coo_prol,desc_cprol,coo_restr,info)
use psb_base_mod
use mld_c_inner_mod
use mld_c_base_aggregator_mod, mld_protect_name => mld_lc_spmm_bld_inner
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
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
!
! 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 spmm_bld_inner '
call psb_erractionrestore(err_act)
return
9999 call psb_error_handler(err_act)
return
end subroutine mld_lc_spmm_bld_inner

@ -1,300 +0,0 @@
!
!
! MLD2P4 version 2.2
! MultiLevel Domain Decomposition Parallel Preconditioners Package
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
!
! (C) Copyright 2008-2018
!
! Salvatore Filippone
! Pasqua D'Ambra
! Daniela di Serafino
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the MLD2P4 group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE MLD2P4 GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
! File: mld_caggrmat_biz_bld.F90
!
! Subroutine: mld_caggrmat_biz_bld
! Version: complex
!
! This routine builds a coarse-level matrix A_C from a fine-level matrix A
! by using the Galerkin approach, i.e.
!
! A_C = P_C^T A P_C,
!
! where P_C is a prolongator from the coarse level to the fine one.
!
! This routine builds A_C according to a "bizarre" aggregation algorithm,
! using a "naive" prolongator proposed by the authors of MLD2P4. However, this
! prolongator still requires additional analysis and testing and its use is not
! recommended.
!
! The coarse-level matrix A_C is distributed among the parallel processes or
! replicated on each of them, according to the value of p%parms%coarse_mat,
! specified by the user through mld_cprecinit and mld_zprecset.
! On output from this routine the entries of AC, op_prol, op_restr
! are still in "global numbering" mode; this is fixed in the calling routine
! mld_c_lev_aggrmat_bld.
!
! Arguments:
! a - type(psb_cspmat_type), input.
! The sparse matrix structure containing the local part of
! the fine-level matrix.
! desc_a - type(psb_desc_type), input.
! The communication descriptor of the fine-level matrix.
! p - type(mld_c_onelev_type), input/output.
! The 'one-level' data structure that will contain the local
! part of the matrix to be built as well as the information
! concerning the prolongator and its transpose.
! ilaggr - integer, dimension(:), allocatable.
! The mapping between the row indices of the coarse-level
! matrix and the row indices of the fine-level matrix.
! ilaggr(i)=j means that node i in the adjacency graph
! of the fine-level matrix is mapped onto node j in the
! adjacency graph of the coarse-level matrix.
! nlaggr - integer, dimension(:), allocatable.
! nlaggr(i) contains the aggregates held by process i.
! info - integer, output.
! Error code.
!
subroutine mld_caggrmat_biz_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,info)
use psb_base_mod
use mld_base_prec_type
use mld_c_inner_mod, mld_protect_name => mld_caggrmat_biz_bld
use mld_c_base_aggregator_mod
implicit none
! Arguments
type(psb_cspmat_type), intent(in) :: a
type(psb_desc_type), intent(in) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(mld_sml_parms), intent(inout) :: parms
type(psb_lcspmat_type), intent(inout) :: op_prol
type(psb_lcspmat_type), intent(out) :: ac,op_restr
integer(psb_ipk_), intent(out) :: info
! Local variables
integer(psb_lpk_) :: nrow, nglob, ncol, ntaggr, ip, &
& naggr, nzl,naggrm1,naggrp1, i, j, k, jd, icolF, nrw
integer(psb_ipk_) :: inaggr, nzlp, inrow
integer(psb_ipk_) :: ictxt, np, me
character(len=20) :: name
type(psb_desc_type) :: tmp_desc
type(psb_c_coo_sparse_mat) :: icoo
type(psb_lc_coo_sparse_mat) :: coo_prol, coo_restr, tmpcoo
type(psb_lc_csr_sparse_mat) :: acsr1, acsrf, csr_prol, acsr
complex(psb_spk_), allocatable :: adiag(:)
real(psb_spk_), allocatable :: arwsum(:)
integer(psb_ipk_) :: ierr(5)
logical :: filter_mat
integer(psb_ipk_) :: debug_level, debug_unit, err_act
integer(psb_ipk_), parameter :: ncmax=16
real(psb_spk_) :: anorm, omega, tmp, dg, theta
logical, parameter :: debug_new=.false.
character(len=80) :: filename
name='mld_aggrmat_biz_bld'
info=psb_success_
call psb_erractionsave(err_act)
if (psb_errstatus_fatal()) then
info = psb_err_internal_error_; goto 9999
end if
debug_unit = psb_get_debug_unit()
debug_level = psb_get_debug_level()
ictxt = desc_a%get_context()
call psb_info(ictxt, me, np)
nglob = desc_a%get_global_rows()
nrow = desc_a%get_local_rows()
ncol = desc_a%get_local_cols()
theta = parms%aggr_thresh
naggr = nlaggr(me+1)
ntaggr = sum(nlaggr)
naggrm1 = sum(nlaggr(1:me))
naggrp1 = sum(nlaggr(1:me+1))
filter_mat = (parms%aggr_filter == mld_filter_mat_)
!
! naggr: number of local aggregates
! nrow: local rows.
!
! Get the diagonal D
adiag = a%get_diag(info)
if (info == psb_success_) &
& call psb_realloc(ncol,adiag,info)
if (info == psb_success_) &
& call psb_halo(adiag,desc_a,info)
if (info == psb_success_) call a%csclip(icoo,info,jmax=a%get_nrows())
call icoo%mv_to_lfmt(acsr,info)
call op_prol%mv_to(coo_prol)
if(info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='sp_getdiag')
goto 9999
end if
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& ' Initial copies done.'
call acsr%cp_to_fmt(acsrf,info)
if (filter_mat) then
!
! Build the filtered matrix Af from A
!
do i=1, nrow
tmp = czero
jd = -1
do j=acsrf%irp(i),acsrf%irp(i+1)-1
if (acsrf%ja(j) == i) jd = j
if (abs(acsrf%val(j)) < theta*sqrt(abs(adiag(i)*adiag(acsrf%ja(j))))) then
tmp=tmp+acsrf%val(j)
acsrf%val(j)=czero
endif
enddo
if (jd == -1) then
write(0,*) 'Wrong input: we need the diagonal!!!!', i
else
acsrf%val(jd)=acsrf%val(jd)-tmp
end if
enddo
! Take out zeroed terms
call acsrf%clean_zeros(info)
end if
do i=1,size(adiag)
if (adiag(i) /= czero) then
adiag(i) = cone / adiag(i)
else
adiag(i) = cone
end if
end do
if (parms%aggr_omega_alg == mld_eig_est_) then
if (parms%aggr_eig == mld_max_norm_) then
allocate(arwsum(nrow))
call acsr%arwsum(arwsum)
anorm = maxval(abs(adiag(1:nrow)*arwsum(1:nrow)))
call psb_amx(ictxt,anorm)
omega = 4.d0/(3.d0*anorm)
parms%aggr_omega_val = omega
else
info = psb_err_internal_error_
call psb_errpush(info,name,a_err='invalid mld_aggr_eig_')
goto 9999
end if
else if (parms%aggr_omega_alg == mld_user_choice_) then
omega = parms%aggr_omega_val
else if (parms%aggr_omega_alg /= mld_user_choice_) then
info = psb_err_internal_error_
call psb_errpush(info,name,a_err='invalid mld_aggr_omega_alg_')
goto 9999
end if
call acsrf%scal(adiag,info)
if (info /= psb_success_) goto 9999
inaggr = naggr
call psb_cdall(ictxt,tmp_desc,info,nl=inaggr)
nzlp = coo_prol%get_nzeros()
call tmp_desc%indxmap%g2lip_ins(coo_prol%ja(1:nzlp),info)
call coo_prol%set_ncols(tmp_desc%get_local_cols())
call coo_prol%mv_to_fmt(csr_prol,info)
!
! Build the smoothed prolongator using either A or Af
! acsr1 = (I-w*D*A) Prol acsr1 = (I-w*D*Af) Prol
! This is always done through the variable acsrf which
! is a bit less readable, butsaves space and one extra matrix copy
!
call omega_smooth(omega,acsrf)
call psb_par_spspmm(acsrf,desc_a,csr_prol,acsr1,tmp_desc,info)
if(info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='spspmm 1')
goto 9999
end if
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done SPSPMM 1'
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)
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done smooth_aggregate '
call psb_erractionrestore(err_act)
return
9999 continue
call psb_errpush(info,name)
call psb_error_handler(err_act)
return
contains
subroutine omega_smooth(omega,acsr)
implicit none
real(psb_spk_),intent(in) :: omega
type(psb_lc_csr_sparse_mat), intent(inout) :: acsr
!
integer(psb_lpk_) :: i,j
do i=1,acsr%get_nrows()
do j=acsr%irp(i),acsr%irp(i+1)-1
if (acsr%ja(j) == i) then
acsr%val(j) = cone - omega*acsr%val(j)
else
acsr%val(j) = - omega*acsr%val(j)
end if
end do
end do
end subroutine omega_smooth
end subroutine mld_caggrmat_biz_bld

@ -104,7 +104,8 @@
! Error code.
!
!
subroutine mld_caggrmat_minnrg_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,info)
subroutine mld_caggrmat_minnrg_bld(a,desc_a,ilaggr,nlaggr,parms,&
& ac,desc_ac,op_prol,op_restr,info)
use psb_base_mod
use mld_base_prec_type
use mld_c_inner_mod, mld_protect_name => mld_caggrmat_minnrg_bld
@ -113,11 +114,12 @@ subroutine mld_caggrmat_minnrg_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_re
! Arguments
type(psb_cspmat_type), intent(in) :: a
type(psb_desc_type), intent(in) :: desc_a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(mld_sml_parms), intent(inout) :: parms
type(psb_lcspmat_type), intent(inout) :: op_prol
type(psb_lcspmat_type), intent(out) :: ac,op_restr
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
! Local variables

@ -96,7 +96,8 @@
! Error code.
!
!
subroutine mld_caggrmat_nosmth_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,info)
subroutine mld_caggrmat_nosmth_bld(a,desc_a,ilaggr,nlaggr,parms,&
& ac,desc_ac,op_prol,op_restr,t_prol,info)
use psb_base_mod
use mld_base_prec_type
use mld_c_inner_mod, mld_protect_name => mld_caggrmat_nosmth_bld
@ -105,26 +106,26 @@ subroutine mld_caggrmat_nosmth_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_re
! Arguments
type(psb_cspmat_type), intent(in) :: a
type(psb_desc_type), intent(in) :: desc_a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(mld_sml_parms), intent(inout) :: parms
type(psb_lcspmat_type), intent(inout) :: op_prol
type(psb_lcspmat_type), intent(out) :: ac,op_restr
type(psb_cspmat_type), intent(inout) :: op_prol,ac,op_restr
type(psb_lcspmat_type), intent(inout) :: t_prol
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
! Local variables
integer(psb_ipk_) :: err_act
integer(psb_ipk_) :: ictxt, np, me, icomm, minfo
character(len=20) :: name
integer(psb_ipk_) :: ierr(5)
type(psb_lcspmat_type) :: la
type(psb_lc_coo_sparse_mat) :: ac_coo, tmpcoo, coo_prol, coo_restr
type(psb_lc_csr_sparse_mat) :: acsr1, acsr2, acsr
type(psb_desc_type) :: tmp_desc
type(psb_lc_coo_sparse_mat) :: lcoo_prol
type(psb_c_coo_sparse_mat) :: coo_prol, coo_restr
type(psb_c_csr_sparse_mat) :: acsr
integer(psb_ipk_) :: debug_level, debug_unit
integer(psb_lpk_) :: nrow, nglob, ncol, ntaggr, nzl, ip, &
& naggr, nzt, naggrm1, naggrp1, i, k
integer(psb_ipk_) :: inaggr, nzlp
logical, parameter :: debug = .false.
name = 'mld_aggrmat_nosmth_bld'
info = psb_success_
@ -145,71 +146,32 @@ subroutine mld_caggrmat_nosmth_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_re
naggrm1 = sum(nlaggr(1:me))
naggrp1 = sum(nlaggr(1:me+1))
if (.false.) then
!
! If we ever want to switch to explicit product when building this..
!
call a%cp_to(acsr)
call op_prol%mv_to(coo_prol)
inaggr = naggr
call psb_cdall(ictxt,tmp_desc,info,nl=inaggr)
nzlp = coo_prol%get_nzeros()
call tmp_desc%indxmap%g2lip_ins(coo_prol%ja(1:nzlp),info)
call coo_prol%set_ncols(tmp_desc%get_local_cols())
call mld_spmm_bld_inner(acsr,desc_a,nlaggr,parms,ac,&
& coo_prol,tmp_desc,coo_restr,info)
call a%cp_to(acsr)
call t_prol%mv_to(lcoo_prol)
inaggr = naggr
call psb_cdall(ictxt,desc_ac,info,nl=inaggr)
nzlp = lcoo_prol%get_nzeros()
call desc_ac%indxmap%g2lip_ins(lcoo_prol%ja(1:nzlp),info)
call lcoo_prol%set_ncols(desc_ac%get_local_cols())
call lcoo_prol%cp_to_icoo(coo_prol,info)
if (debug) call check_coo(me,trim(name)//' Check 1 on coo_prol:',coo_prol)
call op_prol%mv_from(coo_prol)
call op_restr%mv_from(coo_restr)
call psb_cdasb(desc_ac,info)
call psb_cd_reinit(desc_ac,info)
call mld_ptap(acsr,desc_a,nlaggr,parms,ac,&
& coo_prol,desc_ac,coo_restr,info)
else
call a%cp_to(ac_coo)
nzt = ac_coo%get_nzeros()
k = 0
do i = 1, nzt
k = k + 1
ac_coo%ia(k) = ilaggr(ac_coo%ia(i))
ac_coo%ja(k) = ilaggr(ac_coo%ja(i))
ac_coo%val(k) = ac_coo%val(i)
! At this point, there may be negative entries,
! because that's how ILAGGR marks singletons
! If this is the case, roll back K
if ((ac_coo%ia(k)<=0).or.(ac_coo%ja(k)<=0)) k = k-1
enddo
call ac_coo%set_nrows(naggr)
call ac_coo%set_ncols(naggr)
call ac_coo%set_nzeros(k)
call ac_coo%set_dupl(psb_dupl_add_)
call ac_coo%fix(info)
call ac_coo%trim()
call ac%mv_from(ac_coo)
call coo_restr%set_nrows(desc_ac%get_local_rows())
call coo_restr%set_ncols(desc_a%get_local_cols())
call coo_prol%set_nrows(desc_a%get_local_rows())
call coo_prol%set_ncols(desc_ac%get_local_cols())
call op_prol%cp_to(tmpcoo)
if (debug) call check_coo(me,trim(name)//' Check 1 on coo_restr:',coo_restr)
call tmpcoo%transp()
!
! Now we have to fix this. The only rows of tmpcoo/op_restr that are correct
! are those corresponding to "local" aggregates, i.e. indices in ilaggr(:)
!
nzl = tmpcoo%get_nzeros()
i = 0
do k = 1, nzl
if ((naggrm1 < tmpcoo%ia(k)) .and.(tmpcoo%ia(k) <= naggrp1)) then
i = i+1
tmpcoo%val(i) = tmpcoo%val(k)
tmpcoo%ia(i) = tmpcoo%ia(k)
tmpcoo%ja(i) = tmpcoo%ja(k)
end if
end do
call tmpcoo%set_nzeros(i)
call tmpcoo%trim()
call op_restr%mv_from(tmpcoo)
if (info /= psb_success_) goto 9999
end if
call op_prol%mv_from(coo_prol)
call op_restr%mv_from(coo_restr)
call psb_erractionrestore(err_act)
return
@ -217,5 +179,20 @@ subroutine mld_caggrmat_nosmth_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_re
9999 call psb_error_handler(err_act)
return
contains
subroutine check_coo(me,string,coo)
implicit none
integer(psb_ipk_) :: me
type(psb_c_coo_sparse_mat) :: coo
character(len=*) :: string
integer(psb_lpk_) :: nr,nc,nz
nr = coo%get_nrows()
nc = coo%get_ncols()
nz = coo%get_nzeros()
write(0,*) me,string,nr,nc,&
& minval(coo%ia(1:nz)),maxval(coo%ia(1:nz)),&
& minval(coo%ja(1:nz)),maxval(coo%ja(1:nz))
end subroutine check_coo
end subroutine mld_caggrmat_nosmth_bld

@ -102,7 +102,8 @@
! info - integer, output.
! Error code.
!
subroutine mld_caggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,info)
subroutine mld_caggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,&
& ac,desc_ac,op_prol,op_restr,t_prol,info)
use psb_base_mod
use mld_base_prec_type
use mld_c_inner_mod, mld_protect_name => mld_caggrmat_smth_bld
@ -112,11 +113,12 @@ subroutine mld_caggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_rest
! Arguments
type(psb_cspmat_type), intent(in) :: a
type(psb_desc_type), intent(in) :: desc_a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(mld_sml_parms), intent(inout) :: parms
type(psb_lcspmat_type), intent(inout) :: op_prol
type(psb_lcspmat_type), intent(out) :: ac,op_restr
type(mld_sml_parms), intent(inout) :: parms
type(psb_cspmat_type), intent(out) :: op_prol,ac,op_restr
type(psb_lcspmat_type), intent(inout) :: t_prol
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
! Local variables
@ -125,9 +127,9 @@ subroutine mld_caggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_rest
integer(psb_ipk_) :: inaggr, nzlp
integer(psb_ipk_) :: ictxt, np, me
character(len=20) :: name
type(psb_desc_type) :: tmp_desc
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_coo_sparse_mat) :: tmpcoo
type(psb_c_coo_sparse_mat) :: coo_prol, coo_restr
type(psb_c_csr_sparse_mat) :: acsr1, acsrf, csr_prol, acsr
complex(psb_spk_), allocatable :: adiag(:)
real(psb_spk_), allocatable :: arwsum(:)
integer(psb_ipk_) :: ierr(5)
@ -176,7 +178,6 @@ subroutine mld_caggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_rest
if (info == psb_success_) &
& call psb_halo(adiag,desc_a,info)
if (info == psb_success_) call a%cp_to(acsr)
call op_prol%mv_to(coo_prol)
if(info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='sp_getdiag')
@ -255,20 +256,24 @@ subroutine mld_caggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_rest
call acsrf%scal(adiag,info)
if (info /= psb_success_) goto 9999
call t_prol%mv_to(tmpcoo)
inaggr = naggr
call psb_cdall(ictxt,tmp_desc,info,nl=inaggr)
nzlp = coo_prol%get_nzeros()
call tmp_desc%indxmap%g2lip_ins(coo_prol%ja(1:nzlp),info)
call coo_prol%set_ncols(tmp_desc%get_local_cols())
call coo_prol%mv_to_fmt(csr_prol,info)
call psb_cdall(ictxt,desc_ac,info,nl=inaggr)
nzlp = tmpcoo%get_nzeros()
call desc_ac%indxmap%g2lip_ins(tmpcoo%ja(1:nzlp),info)
call tmpcoo%set_ncols(desc_ac%get_local_cols())
call tmpcoo%mv_to_ifmt(csr_prol,info)
call psb_cdasb(desc_ac,info)
call psb_cd_reinit(desc_ac,info)
!
! Build the smoothed prolongator using either A or Af
! acsr1 = (I-w*D*A) Prol acsr1 = (I-w*D*Af) Prol
! This is always done through the variable acsrf which
! is a bit less readable, butsaves space and one extra matrix copy
! is a bit less readable, but saves space and one matrix copy
!
call omega_smooth(omega,acsrf)
call psb_par_spspmm(acsrf,desc_a,csr_prol,acsr1,tmp_desc,info)
call psb_par_spspmm(acsrf,desc_a,csr_prol,acsr1,desc_ac,info)
if(info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='spspmm 1')
goto 9999
@ -281,9 +286,9 @@ subroutine mld_caggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_rest
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 mld_ptap(acsr,desc_a,nlaggr,parms,ac,&
& coo_prol,desc_ac,coo_restr,info)
call op_prol%mv_from(coo_prol)
call op_restr%mv_from(coo_restr)
@ -303,7 +308,7 @@ contains
subroutine omega_smooth(omega,acsr)
implicit none
real(psb_spk_),intent(in) :: omega
type(psb_lc_csr_sparse_mat), intent(inout) :: acsr
type(psb_c_csr_sparse_mat), intent(inout) :: acsr
!
integer(psb_lpk_) :: i,j
do i=1,acsr%get_nrows()

@ -83,7 +83,7 @@
! info - integer, output.
! Error code.
!
subroutine mld_d_dec_aggregator_mat_asb(ag,parms,a,desc_a,ilaggr,nlaggr,&
subroutine mld_d_dec_aggregator_mat_asb(ag,parms,a,desc_a,&
& ac,desc_ac, op_prol,op_restr,info)
use psb_base_mod
use mld_base_prec_type
@ -93,16 +93,13 @@ subroutine mld_d_dec_aggregator_mat_asb(ag,parms,a,desc_a,ilaggr,nlaggr,&
type(mld_dml_parms), intent(inout) :: parms
type(psb_dspmat_type), intent(in) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(psb_ldspmat_type), intent(inout) :: op_prol, ac,op_restr
type(psb_dspmat_type), intent(inout) :: op_prol, ac,op_restr
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
!
integer(psb_ipk_) :: ictxt, np, me
type(psb_ld_coo_sparse_mat) :: lacoo, lbcoo
type(psb_d_coo_sparse_mat) :: acoo
type(psb_ld_csr_sparse_mat) :: acsr1
type(psb_dspmat_type) :: tmp_ac
type(psb_ld_coo_sparse_mat) :: tmpcoo
type(psb_ldspmat_type) :: tmp_ac
integer(psb_ipk_) :: i_nr, i_nc, i_nl, nzl
integer(psb_lpk_) :: ntaggr
integer(psb_ipk_) :: err_act, debug_level, debug_unit
@ -117,70 +114,13 @@ subroutine mld_d_dec_aggregator_mat_asb(ag,parms,a,desc_a,ilaggr,nlaggr,&
ictxt = desc_a%get_context()
call psb_info(ictxt,me,np)
ntaggr = sum(nlaggr)
select case(parms%coarse_mat)
case(mld_distr_mat_)
call ac%mv_to(lbcoo)
nzl = lbcoo%get_nzeros()
i_nl = nlaggr(me+1)
if (info == psb_success_) call psb_cdall(ictxt,desc_ac,info,nl=i_nl)
if (info == psb_success_) call psb_cdins(nzl,lbcoo%ia,lbcoo%ja,desc_ac,info)
if (info == psb_success_) call psb_cdasb(desc_ac,info)
if (info == psb_success_) call psb_glob_to_loc(lbcoo%ia(1:nzl),desc_ac,info,iact='I')
if (info == psb_success_) call psb_glob_to_loc(lbcoo%ja(1:nzl),desc_ac,info,iact='I')
if (info /= psb_success_) then
call psb_errpush(psb_err_internal_error_,name,&
& a_err='Creating desc_ac and converting ac')
goto 9999
end if
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Assembld aux descr. distr.'
call ac%mv_from(lbcoo)
call ac%set_nrows(desc_ac%get_local_rows())
call ac%set_ncols(desc_ac%get_local_cols())
call ac%set_asb()
if (info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='psb_sp_free')
goto 9999
end if
if (np>1) then
call op_prol%mv_to(acsr1)
nzl = acsr1%get_nzeros()
call psb_glob_to_loc(acsr1%ja(1:nzl),desc_ac,info,'I')
if(info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='psb_glob_to_loc')
goto 9999
end if
call op_prol%mv_from(acsr1)
endif
call op_prol%set_ncols(desc_ac%get_local_cols())
if (np>1) then
!call op_restr%cscnv(info,type='coo',dupl=psb_dupl_add_)
call op_restr%mv_to(lacoo)
nzl = lacoo%get_nzeros()
if (info == psb_success_) call psb_glob_to_loc(lacoo%ia(1:nzl),desc_ac,info,'I')
call lacoo%set_dupl(psb_dupl_add_)
if (info == psb_success_) call op_restr%mv_from(lacoo)
if (info == psb_success_) call op_restr%cscnv(info,type='csr')
if(info /= psb_success_) then
call psb_errpush(psb_err_internal_error_,name,&
& a_err='Converting op_restr to local')
goto 9999
end if
end if
!
! Clip to local rows.
!
call op_restr%set_nrows(desc_ac%get_local_rows())
call ac%cscnv(info,type='csr')
call op_prol%cscnv(info,type='csr')
call op_restr%cscnv(info,type='csr')
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
@ -188,23 +128,39 @@ subroutine mld_d_dec_aggregator_mat_asb(ag,parms,a,desc_a,ilaggr,nlaggr,&
case(mld_repl_mat_)
!
! We are assuming here that an d matrix
! can hold all entries
!
! If we are here, it means we assume that an IPK version of the
! coarse matrix can hold all indices. User beware!
!
if (desc_ac%get_global_rows() < huge(1_psb_ipk_) ) then
ntaggr = desc_ac%get_global_rows()
i_nr = ntaggr
else
info = psb_err_internal_error_
call psb_errpush(info,name,a_err='invalid mld_coarse_mat_')
goto 9999
end if
call op_prol%mv_to(tmpcoo)
nzl = tmpcoo%get_nzeros()
call psb_loc_to_glob(tmpcoo%ja(1:nzl),desc_ac,info,'I')
call op_prol%mv_from(tmpcoo)
call op_restr%mv_to(tmpcoo)
nzl = tmpcoo%get_nzeros()
call psb_loc_to_glob(tmpcoo%ia(1:nzl),desc_ac,info,'I')
call op_restr%mv_from(tmpcoo)
call op_prol%set_ncols(i_nr)
call op_restr%set_nrows(i_nr)
call psb_gather(tmp_ac,ac,desc_ac,info,root=-ione,&
& dupl=psb_dupl_add_,keeploc=.false.)
call tmp_ac%mv_to(tmpcoo)
call ac%mv_from(tmpcoo)
!
! op_prol/op_restr come from par_spmm_bld with local sizes
! suitable for DIST option, fix relevant sizes
!
call op_prol%set_ncols(ntaggr)
call op_restr%set_nrows(ntaggr)
call psb_cdall(ictxt,desc_ac,info,mg=ntaggr,repl=.true.)
if (info == psb_success_) call psb_cdasb(desc_ac,info)
if (info == psb_success_) call ac%mv_to(acoo)
if (info == psb_success_) call tmp_ac%mv_from(acoo)
if (info == psb_success_) &
& call psb_gather(ac,tmp_ac,desc_ac,info,dupl=psb_dupl_add_,keeploc=.false.)
if (info /= psb_success_) goto 9999
case default
@ -221,4 +177,19 @@ subroutine mld_d_dec_aggregator_mat_asb(ag,parms,a,desc_a,ilaggr,nlaggr,&
return
contains
subroutine check_coo(me,string,coo)
implicit none
integer(psb_ipk_) :: me
type(psb_ld_coo_sparse_mat) :: coo
character(len=*) :: string
integer(psb_lpk_) :: nr,nc,nz
nr = coo%get_nrows()
nc = coo%get_ncols()
nz = coo%get_nzeros()
write(0,*) me,string,nr,nc,&
& minval(coo%ia(1:nz)),maxval(coo%ia(1:nz)),&
& minval(coo%ja(1:nz)),maxval(coo%ja(1:nz))
end subroutine check_coo
end subroutine mld_d_dec_aggregator_mat_asb

@ -133,7 +133,8 @@
! info - integer, output.
! Error code.
!
subroutine mld_d_dec_aggregator_mat_bld(ag,parms,a,desc_a,ilaggr,nlaggr,ac,op_prol,op_restr,info)
subroutine mld_d_dec_aggregator_mat_bld(ag,parms,a,desc_a,ilaggr,nlaggr,&
& ac,desc_ac,op_prol,op_restr,t_prol,info)
use psb_base_mod
use mld_d_prec_type, mld_protect_name => mld_d_dec_aggregator_mat_bld
use mld_d_inner_mod
@ -144,15 +145,14 @@ subroutine mld_d_dec_aggregator_mat_bld(ag,parms,a,desc_a,ilaggr,nlaggr,ac,op_p
type(psb_dspmat_type), intent(in) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(psb_ldspmat_type), intent(inout) :: op_prol
type(psb_ldspmat_type), intent(out) :: ac,op_restr
type(psb_ldspmat_type), intent(inout) :: t_prol
type(psb_dspmat_type), intent(out) :: op_prol,ac,op_restr
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
! Local variables
character(len=20) :: name
integer(psb_mpk_) :: ictxt, np, me
type(psb_ld_coo_sparse_mat) :: acoo, bcoo
type(psb_ld_csr_sparse_mat) :: acsr1
integer(psb_lpk_) :: nzl,ntaggr
integer(psb_ipk_) :: err_act
integer(psb_ipk_) :: debug_level, debug_unit
@ -177,22 +177,22 @@ subroutine mld_d_dec_aggregator_mat_bld(ag,parms,a,desc_a,ilaggr,nlaggr,ac,op_p
case (mld_no_smooth_)
call mld_daggrmat_nosmth_bld(a,desc_a,ilaggr,nlaggr,&
& parms,ac,op_prol,op_restr,info)
& parms,ac,desc_ac,op_prol,op_restr,t_prol,info)
case(mld_smooth_prol_)
call mld_daggrmat_smth_bld(a,desc_a,ilaggr,nlaggr, &
& parms,ac,op_prol,op_restr,info)
& parms,ac,desc_ac,op_prol,op_restr,t_prol,info)
case(mld_biz_prol_)
call mld_daggrmat_biz_bld(a,desc_a,ilaggr,nlaggr, &
& parms,ac,op_prol,op_restr,info)
!!$ case(mld_biz_prol_)
!!$
!!$ call mld_daggrmat_biz_bld(a,desc_a,ilaggr,nlaggr, &
!!$ & parms,ac,desc_ac,op_prol,op_restr,t_prol,info)
case(mld_min_energy_)
call mld_daggrmat_minnrg_bld(a,desc_a,ilaggr,nlaggr, &
& parms,ac,op_prol,op_restr,info)
& parms,ac,desc_ac,op_prol,op_restr,t_prol,info)
case default
info = psb_err_internal_error_

@ -68,14 +68,14 @@
! overlap.
! nlaggr - integer, dimension(:), allocatable, output
! nlaggr(i) contains the aggregates held by process i.
! op_prol - type(psb_dspmat_type), output
! t_prol - type(psb_dspmat_type), output
! The tentative prolongator, based on ilaggr.
!
! info - integer, output.
! Error code.
!
subroutine mld_d_dec_aggregator_build_tprol(ag,parms,ag_data,&
& a,desc_a,ilaggr,nlaggr,op_prol,info)
& a,desc_a,ilaggr,nlaggr,t_prol,info)
use psb_base_mod
use mld_d_prec_type, mld_protect_name => mld_d_dec_aggregator_build_tprol
use mld_d_inner_mod
@ -86,7 +86,7 @@ subroutine mld_d_dec_aggregator_build_tprol(ag,parms,ag_data,&
type(psb_dspmat_type), intent(in) :: a
type(psb_desc_type), intent(in) :: desc_a
integer(psb_lpk_), allocatable, intent(out) :: ilaggr(:),nlaggr(:)
type(psb_ldspmat_type), intent(out) :: op_prol
type(psb_ldspmat_type), intent(out) :: t_prol
integer(psb_ipk_), intent(out) :: info
! Local variables
@ -123,7 +123,7 @@ subroutine mld_d_dec_aggregator_build_tprol(ag,parms,ag_data,&
clean_zeros = ag%do_clean_zeros
call ag%soc_map_bld(parms%aggr_ord,parms%aggr_thresh,clean_zeros,a,desc_a,nlaggr,ilaggr,info)
if (info==psb_success_) call mld_map_to_tprol(desc_a,ilaggr,nlaggr,op_prol,info)
if (info==psb_success_) call mld_map_to_tprol(desc_a,ilaggr,nlaggr,t_prol,info)
if (info /= psb_success_) then
info=psb_err_from_subroutine_
call psb_errpush(info,name,a_err='soc_map_bld/map_to_tprol')

@ -124,9 +124,9 @@ subroutine mld_d_map_to_tprol(desc_a,ilaggr,nlaggr,op_prol,info)
goto 9999
end if
call tmpcoo%allocate(ncol,ntaggr,ncol)
call tmpcoo%allocate(nrow,ntaggr,ncol)
k = 0
do i=1,ncol
do i=1,nrow
!
! Note: at this point, a value ilaggr(i)<=0
! tags a "singleton" row, and it has to be

@ -0,0 +1,689 @@
!
!
! MLD2P4 Extensions
!
! (C) Copyright 2019
!
! Salvatore Filippone Cranfield University
! Pasqua D'Ambra IAC-CNR, Naples, IT
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the MLD2P4 group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE MLD2P4 GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
! File: mld_daggrmat_nosmth_bld.F90
!
!
subroutine mld_d_ptap(a_csr,desc_a,nlaggr,parms,ac,&
& coo_prol,desc_ac,coo_restr,info,desc_ax)
use psb_base_mod
use mld_d_inner_mod
use mld_d_base_aggregator_mod, mld_protect_name => mld_d_ptap
implicit none
! Arguments
type(psb_d_csr_sparse_mat), intent(inout) :: a_csr
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: nlaggr(:)
type(mld_dml_parms), intent(inout) :: parms
type(psb_d_coo_sparse_mat), intent(inout) :: coo_prol, coo_restr
type(psb_desc_type), intent(inout) :: desc_ac
type(psb_dspmat_type), intent(out) :: ac
integer(psb_ipk_), intent(out) :: info
type(psb_desc_type), intent(inout), optional :: desc_ax
! 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_ld_coo_sparse_mat) :: ac_coo, tmpcoo
type(psb_d_csr_sparse_mat) :: acsr3, csr_prol, ac_csr, csr_restr
integer(psb_ipk_) :: debug_level, debug_unit, naggr
integer(psb_lpk_) :: nglob, ntaggr, naggrm1, naggrp1
integer(psb_ipk_) :: nrow, ncol, nrl, nzl, ip, nzt, i, k
integer(psb_lpk_) :: nrsave, ncsave, nzsave, nza
logical, parameter :: do_timings=.false., oldstyle=.false., debug=.false.
integer(psb_ipk_), save :: idx_spspmm=-1
name='mld_ptap'
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
!
! COO_PROL should arrive here with local numbering
!
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_ac%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_ac,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_ac%get_local_rows(),desc_ac%get_local_cols()
!
! Ok first product done.
if (present(desc_ax)) then
block
call coo_prol%cp_to_coo(coo_restr,info)
call coo_restr%set_ncols(desc_ac%get_local_cols())
call coo_restr%set_nrows(desc_a%get_local_rows())
call psb_d_coo_glob_transpose(coo_restr,desc_a,info,desc_c=desc_ac,desc_rx=desc_ax)
call coo_restr%set_nrows(desc_ac%get_local_rows())
call coo_restr%set_ncols(desc_ax%get_local_cols())
!!$ write(0,*) me,' ',trim(name),' check on glob_transpose 1: ',&
!!$ & desc_a%get_local_cols(),desc_ax%get_local_cols(),coo_restr%get_nzeros()
if (desc_a%get_local_cols()<desc_ax%get_local_cols()) then
write(0,*) me,' ',trim(name),' WARNING: GLOB_TRANSPOSE NEW INDICES '
end if
end block
call csr_restr%cp_from_coo(coo_restr,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'
if (debug) write(0,*) me,trim(name),' Product RESTRxAP ',&
& csr_restr%get_nrows(),csr_restr%get_ncols(), &
& desc_ac%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_ax,acsr3,ac_csr,desc_ac,info)
if (do_timings) call psb_toc(idx_spspmm)
call acsr3%free()
else
!
! 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%mv_to_coo(coo_restr,info)
!!$ write(0,*)me,' ',name,' new into transposition ',coo_restr%get_nrows(),&
!!$ & coo_restr%get_ncols(),coo_restr%get_nzeros()
if (debug) call check_coo(me,trim(name)//' Check 1 (before transp) on coo_restr:',coo_restr)
call coo_restr%transp()
nzl = coo_restr%get_nzeros()
nrl = desc_ac%get_local_rows()
i=0
!
! Only keep local rows
!
do k=1, nzl
if ((1 <= coo_restr%ia(k)) .and.(coo_restr%ia(k) <= nrl)) 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)
nzl = coo_restr%get_nzeros()
call coo_restr%set_nrows(desc_ac%get_local_rows())
call coo_restr%set_ncols(desc_a%get_local_cols())
if (debug) call check_coo(me,trim(name)//' Check 2 on coo_restr:',coo_restr)
call csr_restr%cp_from_coo(coo_restr,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'
if (debug) write(0,*) me,trim(name),' Product RESTRxAP ',&
& csr_restr%get_nrows(),csr_restr%get_ncols(), &
& desc_ac%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_ac,info)
if (do_timings) call psb_toc(idx_spspmm)
call acsr3%free()
end if
call psb_cdasb(desc_ac,info)
call ac_csr%set_nrows(desc_ac%get_local_rows())
call ac_csr%set_ncols(desc_ac%get_local_cols())
call ac%mv_from(ac_csr)
call ac%set_asb()
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()
call coo_prol%set_ncols(desc_ac%get_local_cols())
if (debug) call check_coo(me,trim(name)//' Check 3 on coo_restr:',coo_restr)
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done ptap '
call psb_erractionrestore(err_act)
return
9999 call psb_error_handler(err_act)
return
contains
subroutine check_coo(me,string,coo)
implicit none
integer(psb_ipk_) :: me
type(psb_d_coo_sparse_mat) :: coo
character(len=*) :: string
integer(psb_lpk_) :: nr,nc,nz
nr = coo%get_nrows()
nc = coo%get_ncols()
nz = coo%get_nzeros()
write(0,*) me,string,nr,nc,&
& minval(coo%ia(1:nz)),maxval(coo%ia(1:nz)),&
& minval(coo%ja(1:nz)),maxval(coo%ja(1:nz))
end subroutine check_coo
end subroutine mld_d_ptap
subroutine mld_d_ld_ptap(a_csr,desc_a,nlaggr,parms,ac,&
& coo_prol,desc_ac,coo_restr,info,desc_ax)
use psb_base_mod
use mld_d_inner_mod
use mld_d_base_aggregator_mod !, mld_protect_name => mld_d_ld_ptap
implicit none
! Arguments
type(psb_d_csr_sparse_mat), intent(inout) :: a_csr
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: nlaggr(:)
type(mld_dml_parms), intent(inout) :: parms
type(psb_ld_coo_sparse_mat), intent(inout) :: coo_prol, coo_restr
type(psb_desc_type), intent(inout) :: desc_ac
type(psb_ldspmat_type), intent(out) :: ac
integer(psb_ipk_), intent(out) :: info
type(psb_desc_type), intent(inout), optional :: desc_ax
! 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_ld_coo_sparse_mat) :: ac_coo, tmpcoo
type(psb_d_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, nrl, nzl, ip, &
& nzt, naggrm1, naggrp1, i, k
integer(psb_lpk_) :: nrsave, ncsave, nzsave, nza
logical, parameter :: do_timings=.false., oldstyle=.false., debug=.false.
integer(psb_ipk_), save :: idx_spspmm=-1
name='mld_ptap'
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
!
! COO_PROL should arrive here with local numbering
!
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_ifmt(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_ac%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_ac,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_ac%get_local_rows(),desc_ac%get_local_cols()
!
! Ok first product done.
if (present(desc_ax)) then
block
type(psb_d_coo_sparse_mat) :: icoo_restr
call coo_prol%cp_to_icoo(icoo_restr,info)
call icoo_restr%set_ncols(desc_ac%get_local_cols())
call icoo_restr%set_nrows(desc_a%get_local_rows())
call psb_d_coo_glob_transpose(icoo_restr,desc_a,info,desc_c=desc_ac,desc_rx=desc_ax)
call icoo_restr%set_nrows(desc_ac%get_local_rows())
call icoo_restr%set_ncols(desc_ax%get_local_cols())
write(0,*) me,' ',trim(name),' check on glob_transpose 1: ',&
& desc_a%get_local_cols(),desc_ax%get_local_cols(),icoo_restr%get_nzeros()
if (desc_a%get_local_cols()<desc_ax%get_local_cols()) then
write(0,*) me,' ',trim(name),' WARNING: GLOB_TRANSPOSE NEW INDICES '
end if
call coo_restr%cp_from_icoo(icoo_restr,info)
end block
call csr_restr%cp_from_lcoo(coo_restr,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'
if (debug) write(0,*) me,trim(name),' Product RESTRxAP ',&
& csr_restr%get_nrows(),csr_restr%get_ncols(), &
& desc_ac%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_ax,acsr3,ac_csr,desc_ac,info)
if (do_timings) call psb_toc(idx_spspmm)
call acsr3%free()
else
!
! 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%mv_to_lcoo(coo_restr,info)
!!$ write(0,*)me,' ',name,' new into transposition ',coo_restr%get_nrows(),&
!!$ & coo_restr%get_ncols(),coo_restr%get_nzeros()
if (debug) call check_coo(me,trim(name)//' Check 1 (before transp) on coo_restr:',coo_restr)
call coo_restr%transp()
nzl = coo_restr%get_nzeros()
nrl = desc_ac%get_local_rows()
i=0
!
! Only keep local rows
!
do k=1, nzl
if ((1 <= coo_restr%ia(k)) .and.(coo_restr%ia(k) <= nrl)) 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)
nzl = coo_restr%get_nzeros()
call coo_restr%set_nrows(desc_ac%get_local_rows())
call coo_restr%set_ncols(desc_a%get_local_cols())
if (debug) call check_coo(me,trim(name)//' Check 2 on coo_restr:',coo_restr)
call csr_restr%cp_from_lcoo(coo_restr,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'
if (debug) write(0,*) me,trim(name),' Product RESTRxAP ',&
& csr_restr%get_nrows(),csr_restr%get_ncols(), &
& desc_ac%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_ac,info)
if (do_timings) call psb_toc(idx_spspmm)
call acsr3%free()
end if
call psb_cdasb(desc_ac,info)
call ac_csr%set_nrows(desc_ac%get_local_rows())
call ac_csr%set_ncols(desc_ac%get_local_cols())
call ac%mv_from(ac_csr)
call ac%set_asb()
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()
call coo_prol%set_ncols(desc_ac%get_local_cols())
if (debug) call check_coo(me,trim(name)//' Check 3 on coo_restr:',coo_restr)
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done ptap '
call psb_erractionrestore(err_act)
return
9999 call psb_error_handler(err_act)
return
contains
subroutine check_coo(me,string,coo)
implicit none
integer(psb_ipk_) :: me
type(psb_ld_coo_sparse_mat) :: coo
character(len=*) :: string
integer(psb_lpk_) :: nr,nc,nz
nr = coo%get_nrows()
nc = coo%get_ncols()
nz = coo%get_nzeros()
write(0,*) me,string,nr,nc,&
& minval(coo%ia(1:nz)),maxval(coo%ia(1:nz)),&
& minval(coo%ja(1:nz)),maxval(coo%ja(1:nz))
end subroutine check_coo
end subroutine mld_d_ld_ptap
subroutine mld_ld_ptap(a_csr,desc_a,nlaggr,parms,ac,&
& coo_prol,desc_ac,coo_restr,info,desc_ax)
use psb_base_mod
use mld_d_inner_mod
use mld_d_base_aggregator_mod!, mld_protect_name => mld_ld_ptap
implicit none
! Arguments
type(psb_ld_csr_sparse_mat), intent(inout) :: a_csr
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: nlaggr(:)
type(mld_dml_parms), intent(inout) :: parms
type(psb_ld_coo_sparse_mat), intent(inout) :: coo_prol, coo_restr
type(psb_desc_type), intent(inout) :: desc_ac
type(psb_ldspmat_type), intent(out) :: ac
integer(psb_ipk_), intent(out) :: info
type(psb_desc_type), intent(inout), optional :: desc_ax
! 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_ld_coo_sparse_mat) :: ac_coo, tmpcoo
type(psb_ld_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, nrl, nzl, ip, &
& nzt, naggrm1, naggrp1, i, k
integer(psb_lpk_) :: nrsave, ncsave, nzsave, nza
logical, parameter :: do_timings=.true., oldstyle=.false., debug=.false.
integer(psb_ipk_), save :: idx_spspmm=-1
name='mld_ptap'
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
!
! COO_PROL should arrive here with local numbering
!
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_ac%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_ac,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_ac%get_local_rows(),desc_ac%get_local_cols()
!
! Ok first product done.
if (present(desc_ax)) then
block
type(psb_d_coo_sparse_mat) :: icoo_restr
call coo_prol%cp_to_icoo(icoo_restr,info)
call icoo_restr%set_ncols(desc_ac%get_local_cols())
call icoo_restr%set_nrows(desc_a%get_local_rows())
call psb_d_coo_glob_transpose(icoo_restr,desc_a,info,desc_c=desc_ac,desc_rx=desc_ax)
call icoo_restr%set_nrows(desc_ac%get_local_rows())
call icoo_restr%set_ncols(desc_ax%get_local_cols())
write(0,*) me,' ',trim(name),' check on glob_transpose 1: ',&
& desc_a%get_local_cols(),desc_ax%get_local_cols(),icoo_restr%get_nzeros()
if (desc_a%get_local_cols()<desc_ax%get_local_cols()) then
write(0,*) me,' ',trim(name),' WARNING: GLOB_TRANSPOSE NEW INDICES '
end if
call coo_restr%cp_from_icoo(icoo_restr,info)
end block
call csr_restr%cp_from_coo(coo_restr,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'
if (debug) write(0,*) me,trim(name),' Product RESTRxAP ',&
& csr_restr%get_nrows(),csr_restr%get_ncols(), &
& desc_ac%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_ax,acsr3,ac_csr,desc_ac,info)
if (do_timings) call psb_toc(idx_spspmm)
call acsr3%free()
else
!
! 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%mv_to_coo(coo_restr,info)
!!$ write(0,*)me,' ',name,' new into transposition ',coo_restr%get_nrows(),&
!!$ & coo_restr%get_ncols(),coo_restr%get_nzeros()
if (debug) call check_coo(me,trim(name)//' Check 1 (before transp) on coo_restr:',coo_restr)
call coo_restr%transp()
nzl = coo_restr%get_nzeros()
nrl = desc_ac%get_local_rows()
i=0
!
! Only keep local rows
!
do k=1, nzl
if ((1 <= coo_restr%ia(k)) .and.(coo_restr%ia(k) <= nrl)) 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)
nzl = coo_restr%get_nzeros()
call coo_restr%set_nrows(desc_ac%get_local_rows())
call coo_restr%set_ncols(desc_a%get_local_cols())
if (debug) call check_coo(me,trim(name)//' Check 2 on coo_restr:',coo_restr)
call csr_restr%cp_from_coo(coo_restr,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'
if (debug) write(0,*) me,trim(name),' Product RESTRxAP ',&
& csr_restr%get_nrows(),csr_restr%get_ncols(), &
& desc_ac%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_ac,info)
if (do_timings) call psb_toc(idx_spspmm)
call acsr3%free()
end if
call psb_cdasb(desc_ac,info)
call ac_csr%set_nrows(desc_ac%get_local_rows())
call ac_csr%set_ncols(desc_ac%get_local_cols())
call ac%mv_from(ac_csr)
call ac%set_asb()
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()
call coo_prol%set_ncols(desc_ac%get_local_cols())
!call coo_restr%mv_from_ifmt(csr_restr,info)
!!$ call coo_restr%set_nrows(desc_ac%get_local_rows())
!!$ call coo_restr%set_ncols(desc_a%get_local_cols())
if (debug) call check_coo(me,trim(name)//' Check 3 on coo_restr:',coo_restr)
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done ptap '
call psb_erractionrestore(err_act)
return
9999 call psb_error_handler(err_act)
return
contains
subroutine check_coo(me,string,coo)
implicit none
integer(psb_ipk_) :: me
type(psb_ld_coo_sparse_mat) :: coo
character(len=*) :: string
integer(psb_lpk_) :: nr,nc,nz
nr = coo%get_nrows()
nc = coo%get_ncols()
nz = coo%get_nzeros()
write(0,*) me,string,nr,nc,&
& minval(coo%ia(1:nz)),maxval(coo%ia(1:nz)),&
& minval(coo%ja(1:nz)),maxval(coo%ja(1:nz))
end subroutine check_coo
end subroutine mld_ld_ptap

@ -1,390 +0,0 @@
!
!
! MLD2P4 Extensions
!
! (C) Copyright 2019
!
! Salvatore Filippone Cranfield University
! Pasqua D'Ambra IAC-CNR, Naples, IT
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the MLD2P4 group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE MLD2P4 GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
! File: mld_daggrmat_nosmth_bld.F90
!
!
subroutine mld_d_spmm_bld_inner(a_csr,desc_a,nlaggr,parms,ac,&
& coo_prol,desc_cprol,coo_restr,info)
use psb_base_mod
use mld_d_inner_mod
use mld_d_base_aggregator_mod, mld_protect_name => mld_d_spmm_bld_inner
implicit none
! Arguments
type(psb_d_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_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
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_ld_coo_sparse_mat) :: ac_coo, tmpcoo
type(psb_d_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
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
!
! COO_PROL should arrive here with local numbering
!
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_ifmt(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_lcoo(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_lcoo(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 acsr3%free()
call ac_csr%mv_to_lcoo(ac_coo,info)
call ac_coo%fix(info)
nza = ac_coo%get_nzeros()
if (debug) write(0,*) me,trim(name),' Fixed ac ',&
& ac_coo%get_nrows(),ac_coo%get_ncols(), nza
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 spmm_bld_inner '
call psb_erractionrestore(err_act)
return
9999 call psb_error_handler(err_act)
return
end subroutine mld_d_spmm_bld_inner
subroutine mld_ld_spmm_bld_inner(a_csr,desc_a,nlaggr,parms,ac,&
& coo_prol,desc_cprol,coo_restr,info)
use psb_base_mod
use mld_d_inner_mod
use mld_d_base_aggregator_mod, mld_protect_name => mld_ld_spmm_bld_inner
implicit none
! Arguments
type(psb_ld_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_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
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_ld_coo_sparse_mat) :: ac_coo, tmpcoo
type(psb_ld_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
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
!
! 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 spmm_bld_inner '
call psb_erractionrestore(err_act)
return
9999 call psb_error_handler(err_act)
return
end subroutine mld_ld_spmm_bld_inner

@ -1,300 +0,0 @@
!
!
! MLD2P4 version 2.2
! MultiLevel Domain Decomposition Parallel Preconditioners Package
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
!
! (C) Copyright 2008-2018
!
! Salvatore Filippone
! Pasqua D'Ambra
! Daniela di Serafino
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the MLD2P4 group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE MLD2P4 GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
! File: mld_daggrmat_biz_bld.F90
!
! Subroutine: mld_daggrmat_biz_bld
! Version: real
!
! This routine builds a coarse-level matrix A_C from a fine-level matrix A
! by using the Galerkin approach, i.e.
!
! A_C = P_C^T A P_C,
!
! where P_C is a prolongator from the coarse level to the fine one.
!
! This routine builds A_C according to a "bizarre" aggregation algorithm,
! using a "naive" prolongator proposed by the authors of MLD2P4. However, this
! prolongator still requires additional analysis and testing and its use is not
! recommended.
!
! The coarse-level matrix A_C is distributed among the parallel processes or
! replicated on each of them, according to the value of p%parms%coarse_mat,
! specified by the user through mld_dprecinit and mld_zprecset.
! On output from this routine the entries of AC, op_prol, op_restr
! are still in "global numbering" mode; this is fixed in the calling routine
! mld_d_lev_aggrmat_bld.
!
! Arguments:
! a - type(psb_dspmat_type), input.
! The sparse matrix structure containing the local part of
! the fine-level matrix.
! desc_a - type(psb_desc_type), input.
! The communication descriptor of the fine-level matrix.
! p - type(mld_d_onelev_type), input/output.
! The 'one-level' data structure that will contain the local
! part of the matrix to be built as well as the information
! concerning the prolongator and its transpose.
! ilaggr - integer, dimension(:), allocatable.
! The mapping between the row indices of the coarse-level
! matrix and the row indices of the fine-level matrix.
! ilaggr(i)=j means that node i in the adjacency graph
! of the fine-level matrix is mapped onto node j in the
! adjacency graph of the coarse-level matrix.
! nlaggr - integer, dimension(:), allocatable.
! nlaggr(i) contains the aggregates held by process i.
! info - integer, output.
! Error code.
!
subroutine mld_daggrmat_biz_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,info)
use psb_base_mod
use mld_base_prec_type
use mld_d_inner_mod, mld_protect_name => mld_daggrmat_biz_bld
use mld_d_base_aggregator_mod
implicit none
! Arguments
type(psb_dspmat_type), intent(in) :: a
type(psb_desc_type), intent(in) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(mld_dml_parms), intent(inout) :: parms
type(psb_ldspmat_type), intent(inout) :: op_prol
type(psb_ldspmat_type), intent(out) :: ac,op_restr
integer(psb_ipk_), intent(out) :: info
! Local variables
integer(psb_lpk_) :: nrow, nglob, ncol, ntaggr, ip, &
& naggr, nzl,naggrm1,naggrp1, i, j, k, jd, icolF, nrw
integer(psb_ipk_) :: inaggr, nzlp, inrow
integer(psb_ipk_) :: ictxt, np, me
character(len=20) :: name
type(psb_desc_type) :: tmp_desc
type(psb_d_coo_sparse_mat) :: icoo
type(psb_ld_coo_sparse_mat) :: coo_prol, coo_restr, tmpcoo
type(psb_ld_csr_sparse_mat) :: acsr1, acsrf, csr_prol, acsr
real(psb_dpk_), allocatable :: adiag(:)
real(psb_dpk_), allocatable :: arwsum(:)
integer(psb_ipk_) :: ierr(5)
logical :: filter_mat
integer(psb_ipk_) :: debug_level, debug_unit, err_act
integer(psb_ipk_), parameter :: ncmax=16
real(psb_dpk_) :: anorm, omega, tmp, dg, theta
logical, parameter :: debug_new=.false.
character(len=80) :: filename
name='mld_aggrmat_biz_bld'
info=psb_success_
call psb_erractionsave(err_act)
if (psb_errstatus_fatal()) then
info = psb_err_internal_error_; goto 9999
end if
debug_unit = psb_get_debug_unit()
debug_level = psb_get_debug_level()
ictxt = desc_a%get_context()
call psb_info(ictxt, me, np)
nglob = desc_a%get_global_rows()
nrow = desc_a%get_local_rows()
ncol = desc_a%get_local_cols()
theta = parms%aggr_thresh
naggr = nlaggr(me+1)
ntaggr = sum(nlaggr)
naggrm1 = sum(nlaggr(1:me))
naggrp1 = sum(nlaggr(1:me+1))
filter_mat = (parms%aggr_filter == mld_filter_mat_)
!
! naggr: number of local aggregates
! nrow: local rows.
!
! Get the diagonal D
adiag = a%get_diag(info)
if (info == psb_success_) &
& call psb_realloc(ncol,adiag,info)
if (info == psb_success_) &
& call psb_halo(adiag,desc_a,info)
if (info == psb_success_) call a%csclip(icoo,info,jmax=a%get_nrows())
call icoo%mv_to_lfmt(acsr,info)
call op_prol%mv_to(coo_prol)
if(info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='sp_getdiag')
goto 9999
end if
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& ' Initial copies done.'
call acsr%cp_to_fmt(acsrf,info)
if (filter_mat) then
!
! Build the filtered matrix Af from A
!
do i=1, nrow
tmp = dzero
jd = -1
do j=acsrf%irp(i),acsrf%irp(i+1)-1
if (acsrf%ja(j) == i) jd = j
if (abs(acsrf%val(j)) < theta*sqrt(abs(adiag(i)*adiag(acsrf%ja(j))))) then
tmp=tmp+acsrf%val(j)
acsrf%val(j)=dzero
endif
enddo
if (jd == -1) then
write(0,*) 'Wrong input: we need the diagonal!!!!', i
else
acsrf%val(jd)=acsrf%val(jd)-tmp
end if
enddo
! Take out zeroed terms
call acsrf%clean_zeros(info)
end if
do i=1,size(adiag)
if (adiag(i) /= dzero) then
adiag(i) = done / adiag(i)
else
adiag(i) = done
end if
end do
if (parms%aggr_omega_alg == mld_eig_est_) then
if (parms%aggr_eig == mld_max_norm_) then
allocate(arwsum(nrow))
call acsr%arwsum(arwsum)
anorm = maxval(abs(adiag(1:nrow)*arwsum(1:nrow)))
call psb_amx(ictxt,anorm)
omega = 4.d0/(3.d0*anorm)
parms%aggr_omega_val = omega
else
info = psb_err_internal_error_
call psb_errpush(info,name,a_err='invalid mld_aggr_eig_')
goto 9999
end if
else if (parms%aggr_omega_alg == mld_user_choice_) then
omega = parms%aggr_omega_val
else if (parms%aggr_omega_alg /= mld_user_choice_) then
info = psb_err_internal_error_
call psb_errpush(info,name,a_err='invalid mld_aggr_omega_alg_')
goto 9999
end if
call acsrf%scal(adiag,info)
if (info /= psb_success_) goto 9999
inaggr = naggr
call psb_cdall(ictxt,tmp_desc,info,nl=inaggr)
nzlp = coo_prol%get_nzeros()
call tmp_desc%indxmap%g2lip_ins(coo_prol%ja(1:nzlp),info)
call coo_prol%set_ncols(tmp_desc%get_local_cols())
call coo_prol%mv_to_fmt(csr_prol,info)
!
! Build the smoothed prolongator using either A or Af
! acsr1 = (I-w*D*A) Prol acsr1 = (I-w*D*Af) Prol
! This is always done through the variable acsrf which
! is a bit less readable, butsaves space and one extra matrix copy
!
call omega_smooth(omega,acsrf)
call psb_par_spspmm(acsrf,desc_a,csr_prol,acsr1,tmp_desc,info)
if(info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='spspmm 1')
goto 9999
end if
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done SPSPMM 1'
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)
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done smooth_aggregate '
call psb_erractionrestore(err_act)
return
9999 continue
call psb_errpush(info,name)
call psb_error_handler(err_act)
return
contains
subroutine omega_smooth(omega,acsr)
implicit none
real(psb_dpk_),intent(in) :: omega
type(psb_ld_csr_sparse_mat), intent(inout) :: acsr
!
integer(psb_lpk_) :: i,j
do i=1,acsr%get_nrows()
do j=acsr%irp(i),acsr%irp(i+1)-1
if (acsr%ja(j) == i) then
acsr%val(j) = done - omega*acsr%val(j)
else
acsr%val(j) = - omega*acsr%val(j)
end if
end do
end do
end subroutine omega_smooth
end subroutine mld_daggrmat_biz_bld

@ -104,7 +104,8 @@
! Error code.
!
!
subroutine mld_daggrmat_minnrg_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,info)
subroutine mld_daggrmat_minnrg_bld(a,desc_a,ilaggr,nlaggr,parms,&
& ac,desc_ac,op_prol,op_restr,info)
use psb_base_mod
use mld_base_prec_type
use mld_d_inner_mod, mld_protect_name => mld_daggrmat_minnrg_bld
@ -113,11 +114,12 @@ subroutine mld_daggrmat_minnrg_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_re
! Arguments
type(psb_dspmat_type), intent(in) :: a
type(psb_desc_type), intent(in) :: desc_a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(mld_dml_parms), intent(inout) :: parms
type(psb_ldspmat_type), intent(inout) :: op_prol
type(psb_ldspmat_type), intent(out) :: ac,op_restr
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
! Local variables

@ -96,7 +96,8 @@
! Error code.
!
!
subroutine mld_daggrmat_nosmth_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,info)
subroutine mld_daggrmat_nosmth_bld(a,desc_a,ilaggr,nlaggr,parms,&
& ac,desc_ac,op_prol,op_restr,t_prol,info)
use psb_base_mod
use mld_base_prec_type
use mld_d_inner_mod, mld_protect_name => mld_daggrmat_nosmth_bld
@ -105,26 +106,26 @@ subroutine mld_daggrmat_nosmth_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_re
! Arguments
type(psb_dspmat_type), intent(in) :: a
type(psb_desc_type), intent(in) :: desc_a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(mld_dml_parms), intent(inout) :: parms
type(psb_ldspmat_type), intent(inout) :: op_prol
type(psb_ldspmat_type), intent(out) :: ac,op_restr
type(psb_dspmat_type), intent(inout) :: op_prol,ac,op_restr
type(psb_ldspmat_type), intent(inout) :: t_prol
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
! Local variables
integer(psb_ipk_) :: err_act
integer(psb_ipk_) :: ictxt, np, me, icomm, minfo
character(len=20) :: name
integer(psb_ipk_) :: ierr(5)
type(psb_ldspmat_type) :: la
type(psb_ld_coo_sparse_mat) :: ac_coo, tmpcoo, coo_prol, coo_restr
type(psb_ld_csr_sparse_mat) :: acsr1, acsr2, acsr
type(psb_desc_type) :: tmp_desc
type(psb_ld_coo_sparse_mat) :: lcoo_prol
type(psb_d_coo_sparse_mat) :: coo_prol, coo_restr
type(psb_d_csr_sparse_mat) :: acsr
integer(psb_ipk_) :: debug_level, debug_unit
integer(psb_lpk_) :: nrow, nglob, ncol, ntaggr, nzl, ip, &
& naggr, nzt, naggrm1, naggrp1, i, k
integer(psb_ipk_) :: inaggr, nzlp
logical, parameter :: debug = .false.
name = 'mld_aggrmat_nosmth_bld'
info = psb_success_
@ -145,71 +146,32 @@ subroutine mld_daggrmat_nosmth_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_re
naggrm1 = sum(nlaggr(1:me))
naggrp1 = sum(nlaggr(1:me+1))
if (.false.) then
!
! If we ever want to switch to explicit product when building this..
!
call a%cp_to(acsr)
call op_prol%mv_to(coo_prol)
inaggr = naggr
call psb_cdall(ictxt,tmp_desc,info,nl=inaggr)
nzlp = coo_prol%get_nzeros()
call tmp_desc%indxmap%g2lip_ins(coo_prol%ja(1:nzlp),info)
call coo_prol%set_ncols(tmp_desc%get_local_cols())
call mld_spmm_bld_inner(acsr,desc_a,nlaggr,parms,ac,&
& coo_prol,tmp_desc,coo_restr,info)
call a%cp_to(acsr)
call t_prol%mv_to(lcoo_prol)
inaggr = naggr
call psb_cdall(ictxt,desc_ac,info,nl=inaggr)
nzlp = lcoo_prol%get_nzeros()
call desc_ac%indxmap%g2lip_ins(lcoo_prol%ja(1:nzlp),info)
call lcoo_prol%set_ncols(desc_ac%get_local_cols())
call lcoo_prol%cp_to_icoo(coo_prol,info)
if (debug) call check_coo(me,trim(name)//' Check 1 on coo_prol:',coo_prol)
call op_prol%mv_from(coo_prol)
call op_restr%mv_from(coo_restr)
call psb_cdasb(desc_ac,info)
call psb_cd_reinit(desc_ac,info)
call mld_ptap(acsr,desc_a,nlaggr,parms,ac,&
& coo_prol,desc_ac,coo_restr,info)
else
call a%cp_to(ac_coo)
nzt = ac_coo%get_nzeros()
k = 0
do i = 1, nzt
k = k + 1
ac_coo%ia(k) = ilaggr(ac_coo%ia(i))
ac_coo%ja(k) = ilaggr(ac_coo%ja(i))
ac_coo%val(k) = ac_coo%val(i)
! At this point, there may be negative entries,
! because that's how ILAGGR marks singletons
! If this is the case, roll back K
if ((ac_coo%ia(k)<=0).or.(ac_coo%ja(k)<=0)) k = k-1
enddo
call ac_coo%set_nrows(naggr)
call ac_coo%set_ncols(naggr)
call ac_coo%set_nzeros(k)
call ac_coo%set_dupl(psb_dupl_add_)
call ac_coo%fix(info)
call ac_coo%trim()
call ac%mv_from(ac_coo)
call coo_restr%set_nrows(desc_ac%get_local_rows())
call coo_restr%set_ncols(desc_a%get_local_cols())
call coo_prol%set_nrows(desc_a%get_local_rows())
call coo_prol%set_ncols(desc_ac%get_local_cols())
call op_prol%cp_to(tmpcoo)
if (debug) call check_coo(me,trim(name)//' Check 1 on coo_restr:',coo_restr)
call tmpcoo%transp()
!
! Now we have to fix this. The only rows of tmpcoo/op_restr that are correct
! are those corresponding to "local" aggregates, i.e. indices in ilaggr(:)
!
nzl = tmpcoo%get_nzeros()
i = 0
do k = 1, nzl
if ((naggrm1 < tmpcoo%ia(k)) .and.(tmpcoo%ia(k) <= naggrp1)) then
i = i+1
tmpcoo%val(i) = tmpcoo%val(k)
tmpcoo%ia(i) = tmpcoo%ia(k)
tmpcoo%ja(i) = tmpcoo%ja(k)
end if
end do
call tmpcoo%set_nzeros(i)
call tmpcoo%trim()
call op_restr%mv_from(tmpcoo)
if (info /= psb_success_) goto 9999
end if
call op_prol%mv_from(coo_prol)
call op_restr%mv_from(coo_restr)
call psb_erractionrestore(err_act)
return
@ -217,5 +179,20 @@ subroutine mld_daggrmat_nosmth_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_re
9999 call psb_error_handler(err_act)
return
contains
subroutine check_coo(me,string,coo)
implicit none
integer(psb_ipk_) :: me
type(psb_d_coo_sparse_mat) :: coo
character(len=*) :: string
integer(psb_lpk_) :: nr,nc,nz
nr = coo%get_nrows()
nc = coo%get_ncols()
nz = coo%get_nzeros()
write(0,*) me,string,nr,nc,&
& minval(coo%ia(1:nz)),maxval(coo%ia(1:nz)),&
& minval(coo%ja(1:nz)),maxval(coo%ja(1:nz))
end subroutine check_coo
end subroutine mld_daggrmat_nosmth_bld

@ -102,7 +102,8 @@
! info - integer, output.
! Error code.
!
subroutine mld_daggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,info)
subroutine mld_daggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,&
& ac,desc_ac,op_prol,op_restr,t_prol,info)
use psb_base_mod
use mld_base_prec_type
use mld_d_inner_mod, mld_protect_name => mld_daggrmat_smth_bld
@ -112,11 +113,12 @@ subroutine mld_daggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_rest
! Arguments
type(psb_dspmat_type), intent(in) :: a
type(psb_desc_type), intent(in) :: desc_a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(mld_dml_parms), intent(inout) :: parms
type(psb_ldspmat_type), intent(inout) :: op_prol
type(psb_ldspmat_type), intent(out) :: ac,op_restr
type(mld_dml_parms), intent(inout) :: parms
type(psb_dspmat_type), intent(out) :: op_prol,ac,op_restr
type(psb_ldspmat_type), intent(inout) :: t_prol
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
! Local variables
@ -125,9 +127,9 @@ subroutine mld_daggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_rest
integer(psb_ipk_) :: inaggr, nzlp
integer(psb_ipk_) :: ictxt, np, me
character(len=20) :: name
type(psb_desc_type) :: tmp_desc
type(psb_ld_coo_sparse_mat) :: coo_prol, coo_restr, tmpcoo
type(psb_ld_csr_sparse_mat) :: acsr1, acsrf, csr_prol, acsr
type(psb_ld_coo_sparse_mat) :: tmpcoo
type(psb_d_coo_sparse_mat) :: coo_prol, coo_restr
type(psb_d_csr_sparse_mat) :: acsr1, acsrf, csr_prol, acsr
real(psb_dpk_), allocatable :: adiag(:)
real(psb_dpk_), allocatable :: arwsum(:)
integer(psb_ipk_) :: ierr(5)
@ -176,7 +178,6 @@ subroutine mld_daggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_rest
if (info == psb_success_) &
& call psb_halo(adiag,desc_a,info)
if (info == psb_success_) call a%cp_to(acsr)
call op_prol%mv_to(coo_prol)
if(info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='sp_getdiag')
@ -255,20 +256,24 @@ subroutine mld_daggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_rest
call acsrf%scal(adiag,info)
if (info /= psb_success_) goto 9999
call t_prol%mv_to(tmpcoo)
inaggr = naggr
call psb_cdall(ictxt,tmp_desc,info,nl=inaggr)
nzlp = coo_prol%get_nzeros()
call tmp_desc%indxmap%g2lip_ins(coo_prol%ja(1:nzlp),info)
call coo_prol%set_ncols(tmp_desc%get_local_cols())
call coo_prol%mv_to_fmt(csr_prol,info)
call psb_cdall(ictxt,desc_ac,info,nl=inaggr)
nzlp = tmpcoo%get_nzeros()
call desc_ac%indxmap%g2lip_ins(tmpcoo%ja(1:nzlp),info)
call tmpcoo%set_ncols(desc_ac%get_local_cols())
call tmpcoo%mv_to_ifmt(csr_prol,info)
call psb_cdasb(desc_ac,info)
call psb_cd_reinit(desc_ac,info)
!
! Build the smoothed prolongator using either A or Af
! acsr1 = (I-w*D*A) Prol acsr1 = (I-w*D*Af) Prol
! This is always done through the variable acsrf which
! is a bit less readable, butsaves space and one extra matrix copy
! is a bit less readable, but saves space and one matrix copy
!
call omega_smooth(omega,acsrf)
call psb_par_spspmm(acsrf,desc_a,csr_prol,acsr1,tmp_desc,info)
call psb_par_spspmm(acsrf,desc_a,csr_prol,acsr1,desc_ac,info)
if(info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='spspmm 1')
goto 9999
@ -281,9 +286,9 @@ subroutine mld_daggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_rest
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 mld_ptap(acsr,desc_a,nlaggr,parms,ac,&
& coo_prol,desc_ac,coo_restr,info)
call op_prol%mv_from(coo_prol)
call op_restr%mv_from(coo_restr)
@ -303,7 +308,7 @@ contains
subroutine omega_smooth(omega,acsr)
implicit none
real(psb_dpk_),intent(in) :: omega
type(psb_ld_csr_sparse_mat), intent(inout) :: acsr
type(psb_d_csr_sparse_mat), intent(inout) :: acsr
!
integer(psb_lpk_) :: i,j
do i=1,acsr%get_nrows()

@ -83,7 +83,7 @@
! info - integer, output.
! Error code.
!
subroutine mld_s_dec_aggregator_mat_asb(ag,parms,a,desc_a,ilaggr,nlaggr,&
subroutine mld_s_dec_aggregator_mat_asb(ag,parms,a,desc_a,&
& ac,desc_ac, op_prol,op_restr,info)
use psb_base_mod
use mld_base_prec_type
@ -93,16 +93,13 @@ subroutine mld_s_dec_aggregator_mat_asb(ag,parms,a,desc_a,ilaggr,nlaggr,&
type(mld_sml_parms), intent(inout) :: parms
type(psb_sspmat_type), intent(in) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(psb_lsspmat_type), intent(inout) :: op_prol, ac,op_restr
type(psb_sspmat_type), intent(inout) :: op_prol, ac,op_restr
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
!
integer(psb_ipk_) :: ictxt, np, me
type(psb_ls_coo_sparse_mat) :: lacoo, lbcoo
type(psb_s_coo_sparse_mat) :: acoo
type(psb_ls_csr_sparse_mat) :: acsr1
type(psb_sspmat_type) :: tmp_ac
type(psb_ls_coo_sparse_mat) :: tmpcoo
type(psb_lsspmat_type) :: tmp_ac
integer(psb_ipk_) :: i_nr, i_nc, i_nl, nzl
integer(psb_lpk_) :: ntaggr
integer(psb_ipk_) :: err_act, debug_level, debug_unit
@ -117,70 +114,13 @@ subroutine mld_s_dec_aggregator_mat_asb(ag,parms,a,desc_a,ilaggr,nlaggr,&
ictxt = desc_a%get_context()
call psb_info(ictxt,me,np)
ntaggr = sum(nlaggr)
select case(parms%coarse_mat)
case(mld_distr_mat_)
call ac%mv_to(lbcoo)
nzl = lbcoo%get_nzeros()
i_nl = nlaggr(me+1)
if (info == psb_success_) call psb_cdall(ictxt,desc_ac,info,nl=i_nl)
if (info == psb_success_) call psb_cdins(nzl,lbcoo%ia,lbcoo%ja,desc_ac,info)
if (info == psb_success_) call psb_cdasb(desc_ac,info)
if (info == psb_success_) call psb_glob_to_loc(lbcoo%ia(1:nzl),desc_ac,info,iact='I')
if (info == psb_success_) call psb_glob_to_loc(lbcoo%ja(1:nzl),desc_ac,info,iact='I')
if (info /= psb_success_) then
call psb_errpush(psb_err_internal_error_,name,&
& a_err='Creating desc_ac and converting ac')
goto 9999
end if
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Assembld aux descr. distr.'
call ac%mv_from(lbcoo)
call ac%set_nrows(desc_ac%get_local_rows())
call ac%set_ncols(desc_ac%get_local_cols())
call ac%set_asb()
if (info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='psb_sp_free')
goto 9999
end if
if (np>1) then
call op_prol%mv_to(acsr1)
nzl = acsr1%get_nzeros()
call psb_glob_to_loc(acsr1%ja(1:nzl),desc_ac,info,'I')
if(info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='psb_glob_to_loc')
goto 9999
end if
call op_prol%mv_from(acsr1)
endif
call op_prol%set_ncols(desc_ac%get_local_cols())
if (np>1) then
!call op_restr%cscnv(info,type='coo',dupl=psb_dupl_add_)
call op_restr%mv_to(lacoo)
nzl = lacoo%get_nzeros()
if (info == psb_success_) call psb_glob_to_loc(lacoo%ia(1:nzl),desc_ac,info,'I')
call lacoo%set_dupl(psb_dupl_add_)
if (info == psb_success_) call op_restr%mv_from(lacoo)
if (info == psb_success_) call op_restr%cscnv(info,type='csr')
if(info /= psb_success_) then
call psb_errpush(psb_err_internal_error_,name,&
& a_err='Converting op_restr to local')
goto 9999
end if
end if
!
! Clip to local rows.
!
call op_restr%set_nrows(desc_ac%get_local_rows())
call ac%cscnv(info,type='csr')
call op_prol%cscnv(info,type='csr')
call op_restr%cscnv(info,type='csr')
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
@ -188,23 +128,39 @@ subroutine mld_s_dec_aggregator_mat_asb(ag,parms,a,desc_a,ilaggr,nlaggr,&
case(mld_repl_mat_)
!
! We are assuming here that an s matrix
! can hold all entries
!
! If we are here, it means we assume that an IPK version of the
! coarse matrix can hold all indices. User beware!
!
if (desc_ac%get_global_rows() < huge(1_psb_ipk_) ) then
ntaggr = desc_ac%get_global_rows()
i_nr = ntaggr
else
info = psb_err_internal_error_
call psb_errpush(info,name,a_err='invalid mld_coarse_mat_')
goto 9999
end if
call op_prol%mv_to(tmpcoo)
nzl = tmpcoo%get_nzeros()
call psb_loc_to_glob(tmpcoo%ja(1:nzl),desc_ac,info,'I')
call op_prol%mv_from(tmpcoo)
call op_restr%mv_to(tmpcoo)
nzl = tmpcoo%get_nzeros()
call psb_loc_to_glob(tmpcoo%ia(1:nzl),desc_ac,info,'I')
call op_restr%mv_from(tmpcoo)
call op_prol%set_ncols(i_nr)
call op_restr%set_nrows(i_nr)
call psb_gather(tmp_ac,ac,desc_ac,info,root=-ione,&
& dupl=psb_dupl_add_,keeploc=.false.)
call tmp_ac%mv_to(tmpcoo)
call ac%mv_from(tmpcoo)
!
! op_prol/op_restr come from par_spmm_bld with local sizes
! suitable for DIST option, fix relevant sizes
!
call op_prol%set_ncols(ntaggr)
call op_restr%set_nrows(ntaggr)
call psb_cdall(ictxt,desc_ac,info,mg=ntaggr,repl=.true.)
if (info == psb_success_) call psb_cdasb(desc_ac,info)
if (info == psb_success_) call ac%mv_to(acoo)
if (info == psb_success_) call tmp_ac%mv_from(acoo)
if (info == psb_success_) &
& call psb_gather(ac,tmp_ac,desc_ac,info,dupl=psb_dupl_add_,keeploc=.false.)
if (info /= psb_success_) goto 9999
case default
@ -221,4 +177,19 @@ subroutine mld_s_dec_aggregator_mat_asb(ag,parms,a,desc_a,ilaggr,nlaggr,&
return
contains
subroutine check_coo(me,string,coo)
implicit none
integer(psb_ipk_) :: me
type(psb_ls_coo_sparse_mat) :: coo
character(len=*) :: string
integer(psb_lpk_) :: nr,nc,nz
nr = coo%get_nrows()
nc = coo%get_ncols()
nz = coo%get_nzeros()
write(0,*) me,string,nr,nc,&
& minval(coo%ia(1:nz)),maxval(coo%ia(1:nz)),&
& minval(coo%ja(1:nz)),maxval(coo%ja(1:nz))
end subroutine check_coo
end subroutine mld_s_dec_aggregator_mat_asb

@ -133,7 +133,8 @@
! info - integer, output.
! Error code.
!
subroutine mld_s_dec_aggregator_mat_bld(ag,parms,a,desc_a,ilaggr,nlaggr,ac,op_prol,op_restr,info)
subroutine mld_s_dec_aggregator_mat_bld(ag,parms,a,desc_a,ilaggr,nlaggr,&
& ac,desc_ac,op_prol,op_restr,t_prol,info)
use psb_base_mod
use mld_s_prec_type, mld_protect_name => mld_s_dec_aggregator_mat_bld
use mld_s_inner_mod
@ -144,15 +145,14 @@ subroutine mld_s_dec_aggregator_mat_bld(ag,parms,a,desc_a,ilaggr,nlaggr,ac,op_p
type(psb_sspmat_type), intent(in) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(psb_lsspmat_type), intent(inout) :: op_prol
type(psb_lsspmat_type), intent(out) :: ac,op_restr
type(psb_lsspmat_type), intent(inout) :: t_prol
type(psb_sspmat_type), intent(out) :: op_prol,ac,op_restr
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
! Local variables
character(len=20) :: name
integer(psb_mpk_) :: ictxt, np, me
type(psb_ls_coo_sparse_mat) :: acoo, bcoo
type(psb_ls_csr_sparse_mat) :: acsr1
integer(psb_lpk_) :: nzl,ntaggr
integer(psb_ipk_) :: err_act
integer(psb_ipk_) :: debug_level, debug_unit
@ -177,22 +177,22 @@ subroutine mld_s_dec_aggregator_mat_bld(ag,parms,a,desc_a,ilaggr,nlaggr,ac,op_p
case (mld_no_smooth_)
call mld_saggrmat_nosmth_bld(a,desc_a,ilaggr,nlaggr,&
& parms,ac,op_prol,op_restr,info)
& parms,ac,desc_ac,op_prol,op_restr,t_prol,info)
case(mld_smooth_prol_)
call mld_saggrmat_smth_bld(a,desc_a,ilaggr,nlaggr, &
& parms,ac,op_prol,op_restr,info)
& parms,ac,desc_ac,op_prol,op_restr,t_prol,info)
case(mld_biz_prol_)
call mld_saggrmat_biz_bld(a,desc_a,ilaggr,nlaggr, &
& parms,ac,op_prol,op_restr,info)
!!$ case(mld_biz_prol_)
!!$
!!$ call mld_saggrmat_biz_bld(a,desc_a,ilaggr,nlaggr, &
!!$ & parms,ac,desc_ac,op_prol,op_restr,t_prol,info)
case(mld_min_energy_)
call mld_saggrmat_minnrg_bld(a,desc_a,ilaggr,nlaggr, &
& parms,ac,op_prol,op_restr,info)
& parms,ac,desc_ac,op_prol,op_restr,t_prol,info)
case default
info = psb_err_internal_error_

@ -68,14 +68,14 @@
! overlap.
! nlaggr - integer, dimension(:), allocatable, output
! nlaggr(i) contains the aggregates held by process i.
! op_prol - type(psb_sspmat_type), output
! t_prol - type(psb_sspmat_type), output
! The tentative prolongator, based on ilaggr.
!
! info - integer, output.
! Error code.
!
subroutine mld_s_dec_aggregator_build_tprol(ag,parms,ag_data,&
& a,desc_a,ilaggr,nlaggr,op_prol,info)
& a,desc_a,ilaggr,nlaggr,t_prol,info)
use psb_base_mod
use mld_s_prec_type, mld_protect_name => mld_s_dec_aggregator_build_tprol
use mld_s_inner_mod
@ -86,7 +86,7 @@ subroutine mld_s_dec_aggregator_build_tprol(ag,parms,ag_data,&
type(psb_sspmat_type), intent(in) :: a
type(psb_desc_type), intent(in) :: desc_a
integer(psb_lpk_), allocatable, intent(out) :: ilaggr(:),nlaggr(:)
type(psb_lsspmat_type), intent(out) :: op_prol
type(psb_lsspmat_type), intent(out) :: t_prol
integer(psb_ipk_), intent(out) :: info
! Local variables
@ -123,7 +123,7 @@ subroutine mld_s_dec_aggregator_build_tprol(ag,parms,ag_data,&
clean_zeros = ag%do_clean_zeros
call ag%soc_map_bld(parms%aggr_ord,parms%aggr_thresh,clean_zeros,a,desc_a,nlaggr,ilaggr,info)
if (info==psb_success_) call mld_map_to_tprol(desc_a,ilaggr,nlaggr,op_prol,info)
if (info==psb_success_) call mld_map_to_tprol(desc_a,ilaggr,nlaggr,t_prol,info)
if (info /= psb_success_) then
info=psb_err_from_subroutine_
call psb_errpush(info,name,a_err='soc_map_bld/map_to_tprol')

@ -124,9 +124,9 @@ subroutine mld_s_map_to_tprol(desc_a,ilaggr,nlaggr,op_prol,info)
goto 9999
end if
call tmpcoo%allocate(ncol,ntaggr,ncol)
call tmpcoo%allocate(nrow,ntaggr,ncol)
k = 0
do i=1,ncol
do i=1,nrow
!
! Note: at this point, a value ilaggr(i)<=0
! tags a "singleton" row, and it has to be

@ -0,0 +1,689 @@
!
!
! MLD2P4 Extensions
!
! (C) Copyright 2019
!
! Salvatore Filippone Cranfield University
! Pasqua D'Ambra IAC-CNR, Naples, IT
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the MLD2P4 group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE MLD2P4 GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
! File: mld_daggrmat_nosmth_bld.F90
!
!
subroutine mld_s_ptap(a_csr,desc_a,nlaggr,parms,ac,&
& coo_prol,desc_ac,coo_restr,info,desc_ax)
use psb_base_mod
use mld_s_inner_mod
use mld_s_base_aggregator_mod, mld_protect_name => mld_s_ptap
implicit none
! Arguments
type(psb_s_csr_sparse_mat), intent(inout) :: a_csr
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: nlaggr(:)
type(mld_sml_parms), intent(inout) :: parms
type(psb_s_coo_sparse_mat), intent(inout) :: coo_prol, coo_restr
type(psb_desc_type), intent(inout) :: desc_ac
type(psb_sspmat_type), intent(out) :: ac
integer(psb_ipk_), intent(out) :: info
type(psb_desc_type), intent(inout), optional :: desc_ax
! 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_s_csr_sparse_mat) :: acsr3, csr_prol, ac_csr, csr_restr
integer(psb_ipk_) :: debug_level, debug_unit, naggr
integer(psb_lpk_) :: nglob, ntaggr, naggrm1, naggrp1
integer(psb_ipk_) :: nrow, ncol, nrl, nzl, ip, nzt, i, k
integer(psb_lpk_) :: nrsave, ncsave, nzsave, nza
logical, parameter :: do_timings=.false., oldstyle=.false., debug=.false.
integer(psb_ipk_), save :: idx_spspmm=-1
name='mld_ptap'
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
!
! COO_PROL should arrive here with local numbering
!
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_ac%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_ac,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_ac%get_local_rows(),desc_ac%get_local_cols()
!
! Ok first product done.
if (present(desc_ax)) then
block
call coo_prol%cp_to_coo(coo_restr,info)
call coo_restr%set_ncols(desc_ac%get_local_cols())
call coo_restr%set_nrows(desc_a%get_local_rows())
call psb_s_coo_glob_transpose(coo_restr,desc_a,info,desc_c=desc_ac,desc_rx=desc_ax)
call coo_restr%set_nrows(desc_ac%get_local_rows())
call coo_restr%set_ncols(desc_ax%get_local_cols())
!!$ write(0,*) me,' ',trim(name),' check on glob_transpose 1: ',&
!!$ & desc_a%get_local_cols(),desc_ax%get_local_cols(),coo_restr%get_nzeros()
if (desc_a%get_local_cols()<desc_ax%get_local_cols()) then
write(0,*) me,' ',trim(name),' WARNING: GLOB_TRANSPOSE NEW INDICES '
end if
end block
call csr_restr%cp_from_coo(coo_restr,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'
if (debug) write(0,*) me,trim(name),' Product RESTRxAP ',&
& csr_restr%get_nrows(),csr_restr%get_ncols(), &
& desc_ac%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_ax,acsr3,ac_csr,desc_ac,info)
if (do_timings) call psb_toc(idx_spspmm)
call acsr3%free()
else
!
! 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%mv_to_coo(coo_restr,info)
!!$ write(0,*)me,' ',name,' new into transposition ',coo_restr%get_nrows(),&
!!$ & coo_restr%get_ncols(),coo_restr%get_nzeros()
if (debug) call check_coo(me,trim(name)//' Check 1 (before transp) on coo_restr:',coo_restr)
call coo_restr%transp()
nzl = coo_restr%get_nzeros()
nrl = desc_ac%get_local_rows()
i=0
!
! Only keep local rows
!
do k=1, nzl
if ((1 <= coo_restr%ia(k)) .and.(coo_restr%ia(k) <= nrl)) 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)
nzl = coo_restr%get_nzeros()
call coo_restr%set_nrows(desc_ac%get_local_rows())
call coo_restr%set_ncols(desc_a%get_local_cols())
if (debug) call check_coo(me,trim(name)//' Check 2 on coo_restr:',coo_restr)
call csr_restr%cp_from_coo(coo_restr,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'
if (debug) write(0,*) me,trim(name),' Product RESTRxAP ',&
& csr_restr%get_nrows(),csr_restr%get_ncols(), &
& desc_ac%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_ac,info)
if (do_timings) call psb_toc(idx_spspmm)
call acsr3%free()
end if
call psb_cdasb(desc_ac,info)
call ac_csr%set_nrows(desc_ac%get_local_rows())
call ac_csr%set_ncols(desc_ac%get_local_cols())
call ac%mv_from(ac_csr)
call ac%set_asb()
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()
call coo_prol%set_ncols(desc_ac%get_local_cols())
if (debug) call check_coo(me,trim(name)//' Check 3 on coo_restr:',coo_restr)
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done ptap '
call psb_erractionrestore(err_act)
return
9999 call psb_error_handler(err_act)
return
contains
subroutine check_coo(me,string,coo)
implicit none
integer(psb_ipk_) :: me
type(psb_s_coo_sparse_mat) :: coo
character(len=*) :: string
integer(psb_lpk_) :: nr,nc,nz
nr = coo%get_nrows()
nc = coo%get_ncols()
nz = coo%get_nzeros()
write(0,*) me,string,nr,nc,&
& minval(coo%ia(1:nz)),maxval(coo%ia(1:nz)),&
& minval(coo%ja(1:nz)),maxval(coo%ja(1:nz))
end subroutine check_coo
end subroutine mld_s_ptap
subroutine mld_s_ls_ptap(a_csr,desc_a,nlaggr,parms,ac,&
& coo_prol,desc_ac,coo_restr,info,desc_ax)
use psb_base_mod
use mld_s_inner_mod
use mld_s_base_aggregator_mod !, mld_protect_name => mld_s_ls_ptap
implicit none
! Arguments
type(psb_s_csr_sparse_mat), intent(inout) :: a_csr
type(psb_desc_type), intent(inout) :: 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_ac
type(psb_lsspmat_type), intent(out) :: ac
integer(psb_ipk_), intent(out) :: info
type(psb_desc_type), intent(inout), optional :: desc_ax
! 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_s_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, nrl, nzl, ip, &
& nzt, naggrm1, naggrp1, i, k
integer(psb_lpk_) :: nrsave, ncsave, nzsave, nza
logical, parameter :: do_timings=.false., oldstyle=.false., debug=.false.
integer(psb_ipk_), save :: idx_spspmm=-1
name='mld_ptap'
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
!
! COO_PROL should arrive here with local numbering
!
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_ifmt(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_ac%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_ac,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_ac%get_local_rows(),desc_ac%get_local_cols()
!
! Ok first product done.
if (present(desc_ax)) then
block
type(psb_s_coo_sparse_mat) :: icoo_restr
call coo_prol%cp_to_icoo(icoo_restr,info)
call icoo_restr%set_ncols(desc_ac%get_local_cols())
call icoo_restr%set_nrows(desc_a%get_local_rows())
call psb_s_coo_glob_transpose(icoo_restr,desc_a,info,desc_c=desc_ac,desc_rx=desc_ax)
call icoo_restr%set_nrows(desc_ac%get_local_rows())
call icoo_restr%set_ncols(desc_ax%get_local_cols())
write(0,*) me,' ',trim(name),' check on glob_transpose 1: ',&
& desc_a%get_local_cols(),desc_ax%get_local_cols(),icoo_restr%get_nzeros()
if (desc_a%get_local_cols()<desc_ax%get_local_cols()) then
write(0,*) me,' ',trim(name),' WARNING: GLOB_TRANSPOSE NEW INDICES '
end if
call coo_restr%cp_from_icoo(icoo_restr,info)
end block
call csr_restr%cp_from_lcoo(coo_restr,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'
if (debug) write(0,*) me,trim(name),' Product RESTRxAP ',&
& csr_restr%get_nrows(),csr_restr%get_ncols(), &
& desc_ac%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_ax,acsr3,ac_csr,desc_ac,info)
if (do_timings) call psb_toc(idx_spspmm)
call acsr3%free()
else
!
! 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%mv_to_lcoo(coo_restr,info)
!!$ write(0,*)me,' ',name,' new into transposition ',coo_restr%get_nrows(),&
!!$ & coo_restr%get_ncols(),coo_restr%get_nzeros()
if (debug) call check_coo(me,trim(name)//' Check 1 (before transp) on coo_restr:',coo_restr)
call coo_restr%transp()
nzl = coo_restr%get_nzeros()
nrl = desc_ac%get_local_rows()
i=0
!
! Only keep local rows
!
do k=1, nzl
if ((1 <= coo_restr%ia(k)) .and.(coo_restr%ia(k) <= nrl)) 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)
nzl = coo_restr%get_nzeros()
call coo_restr%set_nrows(desc_ac%get_local_rows())
call coo_restr%set_ncols(desc_a%get_local_cols())
if (debug) call check_coo(me,trim(name)//' Check 2 on coo_restr:',coo_restr)
call csr_restr%cp_from_lcoo(coo_restr,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'
if (debug) write(0,*) me,trim(name),' Product RESTRxAP ',&
& csr_restr%get_nrows(),csr_restr%get_ncols(), &
& desc_ac%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_ac,info)
if (do_timings) call psb_toc(idx_spspmm)
call acsr3%free()
end if
call psb_cdasb(desc_ac,info)
call ac_csr%set_nrows(desc_ac%get_local_rows())
call ac_csr%set_ncols(desc_ac%get_local_cols())
call ac%mv_from(ac_csr)
call ac%set_asb()
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()
call coo_prol%set_ncols(desc_ac%get_local_cols())
if (debug) call check_coo(me,trim(name)//' Check 3 on coo_restr:',coo_restr)
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done ptap '
call psb_erractionrestore(err_act)
return
9999 call psb_error_handler(err_act)
return
contains
subroutine check_coo(me,string,coo)
implicit none
integer(psb_ipk_) :: me
type(psb_ls_coo_sparse_mat) :: coo
character(len=*) :: string
integer(psb_lpk_) :: nr,nc,nz
nr = coo%get_nrows()
nc = coo%get_ncols()
nz = coo%get_nzeros()
write(0,*) me,string,nr,nc,&
& minval(coo%ia(1:nz)),maxval(coo%ia(1:nz)),&
& minval(coo%ja(1:nz)),maxval(coo%ja(1:nz))
end subroutine check_coo
end subroutine mld_s_ls_ptap
subroutine mld_ls_ptap(a_csr,desc_a,nlaggr,parms,ac,&
& coo_prol,desc_ac,coo_restr,info,desc_ax)
use psb_base_mod
use mld_s_inner_mod
use mld_s_base_aggregator_mod!, mld_protect_name => mld_ls_ptap
implicit none
! Arguments
type(psb_ls_csr_sparse_mat), intent(inout) :: a_csr
type(psb_desc_type), intent(inout) :: 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_ac
type(psb_lsspmat_type), intent(out) :: ac
integer(psb_ipk_), intent(out) :: info
type(psb_desc_type), intent(inout), optional :: desc_ax
! 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, nrl, nzl, ip, &
& nzt, naggrm1, naggrp1, i, k
integer(psb_lpk_) :: nrsave, ncsave, nzsave, nza
logical, parameter :: do_timings=.true., oldstyle=.false., debug=.false.
integer(psb_ipk_), save :: idx_spspmm=-1
name='mld_ptap'
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
!
! COO_PROL should arrive here with local numbering
!
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_ac%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_ac,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_ac%get_local_rows(),desc_ac%get_local_cols()
!
! Ok first product done.
if (present(desc_ax)) then
block
type(psb_s_coo_sparse_mat) :: icoo_restr
call coo_prol%cp_to_icoo(icoo_restr,info)
call icoo_restr%set_ncols(desc_ac%get_local_cols())
call icoo_restr%set_nrows(desc_a%get_local_rows())
call psb_s_coo_glob_transpose(icoo_restr,desc_a,info,desc_c=desc_ac,desc_rx=desc_ax)
call icoo_restr%set_nrows(desc_ac%get_local_rows())
call icoo_restr%set_ncols(desc_ax%get_local_cols())
write(0,*) me,' ',trim(name),' check on glob_transpose 1: ',&
& desc_a%get_local_cols(),desc_ax%get_local_cols(),icoo_restr%get_nzeros()
if (desc_a%get_local_cols()<desc_ax%get_local_cols()) then
write(0,*) me,' ',trim(name),' WARNING: GLOB_TRANSPOSE NEW INDICES '
end if
call coo_restr%cp_from_icoo(icoo_restr,info)
end block
call csr_restr%cp_from_coo(coo_restr,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'
if (debug) write(0,*) me,trim(name),' Product RESTRxAP ',&
& csr_restr%get_nrows(),csr_restr%get_ncols(), &
& desc_ac%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_ax,acsr3,ac_csr,desc_ac,info)
if (do_timings) call psb_toc(idx_spspmm)
call acsr3%free()
else
!
! 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%mv_to_coo(coo_restr,info)
!!$ write(0,*)me,' ',name,' new into transposition ',coo_restr%get_nrows(),&
!!$ & coo_restr%get_ncols(),coo_restr%get_nzeros()
if (debug) call check_coo(me,trim(name)//' Check 1 (before transp) on coo_restr:',coo_restr)
call coo_restr%transp()
nzl = coo_restr%get_nzeros()
nrl = desc_ac%get_local_rows()
i=0
!
! Only keep local rows
!
do k=1, nzl
if ((1 <= coo_restr%ia(k)) .and.(coo_restr%ia(k) <= nrl)) 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)
nzl = coo_restr%get_nzeros()
call coo_restr%set_nrows(desc_ac%get_local_rows())
call coo_restr%set_ncols(desc_a%get_local_cols())
if (debug) call check_coo(me,trim(name)//' Check 2 on coo_restr:',coo_restr)
call csr_restr%cp_from_coo(coo_restr,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'
if (debug) write(0,*) me,trim(name),' Product RESTRxAP ',&
& csr_restr%get_nrows(),csr_restr%get_ncols(), &
& desc_ac%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_ac,info)
if (do_timings) call psb_toc(idx_spspmm)
call acsr3%free()
end if
call psb_cdasb(desc_ac,info)
call ac_csr%set_nrows(desc_ac%get_local_rows())
call ac_csr%set_ncols(desc_ac%get_local_cols())
call ac%mv_from(ac_csr)
call ac%set_asb()
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()
call coo_prol%set_ncols(desc_ac%get_local_cols())
!call coo_restr%mv_from_ifmt(csr_restr,info)
!!$ call coo_restr%set_nrows(desc_ac%get_local_rows())
!!$ call coo_restr%set_ncols(desc_a%get_local_cols())
if (debug) call check_coo(me,trim(name)//' Check 3 on coo_restr:',coo_restr)
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done ptap '
call psb_erractionrestore(err_act)
return
9999 call psb_error_handler(err_act)
return
contains
subroutine check_coo(me,string,coo)
implicit none
integer(psb_ipk_) :: me
type(psb_ls_coo_sparse_mat) :: coo
character(len=*) :: string
integer(psb_lpk_) :: nr,nc,nz
nr = coo%get_nrows()
nc = coo%get_ncols()
nz = coo%get_nzeros()
write(0,*) me,string,nr,nc,&
& minval(coo%ia(1:nz)),maxval(coo%ia(1:nz)),&
& minval(coo%ja(1:nz)),maxval(coo%ja(1:nz))
end subroutine check_coo
end subroutine mld_ls_ptap

@ -1,390 +0,0 @@
!
!
! MLD2P4 Extensions
!
! (C) Copyright 2019
!
! Salvatore Filippone Cranfield University
! Pasqua D'Ambra IAC-CNR, Naples, IT
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the MLD2P4 group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE MLD2P4 GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
! File: mld_daggrmat_nosmth_bld.F90
!
!
subroutine mld_s_spmm_bld_inner(a_csr,desc_a,nlaggr,parms,ac,&
& coo_prol,desc_cprol,coo_restr,info)
use psb_base_mod
use mld_s_inner_mod
use mld_s_base_aggregator_mod, mld_protect_name => mld_s_spmm_bld_inner
implicit none
! Arguments
type(psb_s_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_s_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
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
!
! COO_PROL should arrive here with local numbering
!
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_ifmt(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_lcoo(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_lcoo(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 acsr3%free()
call ac_csr%mv_to_lcoo(ac_coo,info)
call ac_coo%fix(info)
nza = ac_coo%get_nzeros()
if (debug) write(0,*) me,trim(name),' Fixed ac ',&
& ac_coo%get_nrows(),ac_coo%get_ncols(), nza
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 spmm_bld_inner '
call psb_erractionrestore(err_act)
return
9999 call psb_error_handler(err_act)
return
end subroutine mld_s_spmm_bld_inner
subroutine mld_ls_spmm_bld_inner(a_csr,desc_a,nlaggr,parms,ac,&
& coo_prol,desc_cprol,coo_restr,info)
use psb_base_mod
use mld_s_inner_mod
use mld_s_base_aggregator_mod, mld_protect_name => mld_ls_spmm_bld_inner
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
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
!
! 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 spmm_bld_inner '
call psb_erractionrestore(err_act)
return
9999 call psb_error_handler(err_act)
return
end subroutine mld_ls_spmm_bld_inner

@ -1,300 +0,0 @@
!
!
! MLD2P4 version 2.2
! MultiLevel Domain Decomposition Parallel Preconditioners Package
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
!
! (C) Copyright 2008-2018
!
! Salvatore Filippone
! Pasqua D'Ambra
! Daniela di Serafino
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the MLD2P4 group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE MLD2P4 GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
! File: mld_saggrmat_biz_bld.F90
!
! Subroutine: mld_saggrmat_biz_bld
! Version: real
!
! This routine builds a coarse-level matrix A_C from a fine-level matrix A
! by using the Galerkin approach, i.e.
!
! A_C = P_C^T A P_C,
!
! where P_C is a prolongator from the coarse level to the fine one.
!
! This routine builds A_C according to a "bizarre" aggregation algorithm,
! using a "naive" prolongator proposed by the authors of MLD2P4. However, this
! prolongator still requires additional analysis and testing and its use is not
! recommended.
!
! The coarse-level matrix A_C is distributed among the parallel processes or
! replicated on each of them, according to the value of p%parms%coarse_mat,
! specified by the user through mld_sprecinit and mld_zprecset.
! On output from this routine the entries of AC, op_prol, op_restr
! are still in "global numbering" mode; this is fixed in the calling routine
! mld_s_lev_aggrmat_bld.
!
! Arguments:
! a - type(psb_sspmat_type), input.
! The sparse matrix structure containing the local part of
! the fine-level matrix.
! desc_a - type(psb_desc_type), input.
! The communication descriptor of the fine-level matrix.
! p - type(mld_s_onelev_type), input/output.
! The 'one-level' data structure that will contain the local
! part of the matrix to be built as well as the information
! concerning the prolongator and its transpose.
! ilaggr - integer, dimension(:), allocatable.
! The mapping between the row indices of the coarse-level
! matrix and the row indices of the fine-level matrix.
! ilaggr(i)=j means that node i in the adjacency graph
! of the fine-level matrix is mapped onto node j in the
! adjacency graph of the coarse-level matrix.
! nlaggr - integer, dimension(:), allocatable.
! nlaggr(i) contains the aggregates held by process i.
! info - integer, output.
! Error code.
!
subroutine mld_saggrmat_biz_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,info)
use psb_base_mod
use mld_base_prec_type
use mld_s_inner_mod, mld_protect_name => mld_saggrmat_biz_bld
use mld_s_base_aggregator_mod
implicit none
! Arguments
type(psb_sspmat_type), intent(in) :: a
type(psb_desc_type), intent(in) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(mld_sml_parms), intent(inout) :: parms
type(psb_lsspmat_type), intent(inout) :: op_prol
type(psb_lsspmat_type), intent(out) :: ac,op_restr
integer(psb_ipk_), intent(out) :: info
! Local variables
integer(psb_lpk_) :: nrow, nglob, ncol, ntaggr, ip, &
& naggr, nzl,naggrm1,naggrp1, i, j, k, jd, icolF, nrw
integer(psb_ipk_) :: inaggr, nzlp, inrow
integer(psb_ipk_) :: ictxt, np, me
character(len=20) :: name
type(psb_desc_type) :: tmp_desc
type(psb_s_coo_sparse_mat) :: icoo
type(psb_ls_coo_sparse_mat) :: coo_prol, coo_restr, tmpcoo
type(psb_ls_csr_sparse_mat) :: acsr1, acsrf, csr_prol, acsr
real(psb_spk_), allocatable :: adiag(:)
real(psb_spk_), allocatable :: arwsum(:)
integer(psb_ipk_) :: ierr(5)
logical :: filter_mat
integer(psb_ipk_) :: debug_level, debug_unit, err_act
integer(psb_ipk_), parameter :: ncmax=16
real(psb_spk_) :: anorm, omega, tmp, dg, theta
logical, parameter :: debug_new=.false.
character(len=80) :: filename
name='mld_aggrmat_biz_bld'
info=psb_success_
call psb_erractionsave(err_act)
if (psb_errstatus_fatal()) then
info = psb_err_internal_error_; goto 9999
end if
debug_unit = psb_get_debug_unit()
debug_level = psb_get_debug_level()
ictxt = desc_a%get_context()
call psb_info(ictxt, me, np)
nglob = desc_a%get_global_rows()
nrow = desc_a%get_local_rows()
ncol = desc_a%get_local_cols()
theta = parms%aggr_thresh
naggr = nlaggr(me+1)
ntaggr = sum(nlaggr)
naggrm1 = sum(nlaggr(1:me))
naggrp1 = sum(nlaggr(1:me+1))
filter_mat = (parms%aggr_filter == mld_filter_mat_)
!
! naggr: number of local aggregates
! nrow: local rows.
!
! Get the diagonal D
adiag = a%get_diag(info)
if (info == psb_success_) &
& call psb_realloc(ncol,adiag,info)
if (info == psb_success_) &
& call psb_halo(adiag,desc_a,info)
if (info == psb_success_) call a%csclip(icoo,info,jmax=a%get_nrows())
call icoo%mv_to_lfmt(acsr,info)
call op_prol%mv_to(coo_prol)
if(info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='sp_getdiag')
goto 9999
end if
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& ' Initial copies done.'
call acsr%cp_to_fmt(acsrf,info)
if (filter_mat) then
!
! Build the filtered matrix Af from A
!
do i=1, nrow
tmp = szero
jd = -1
do j=acsrf%irp(i),acsrf%irp(i+1)-1
if (acsrf%ja(j) == i) jd = j
if (abs(acsrf%val(j)) < theta*sqrt(abs(adiag(i)*adiag(acsrf%ja(j))))) then
tmp=tmp+acsrf%val(j)
acsrf%val(j)=szero
endif
enddo
if (jd == -1) then
write(0,*) 'Wrong input: we need the diagonal!!!!', i
else
acsrf%val(jd)=acsrf%val(jd)-tmp
end if
enddo
! Take out zeroed terms
call acsrf%clean_zeros(info)
end if
do i=1,size(adiag)
if (adiag(i) /= szero) then
adiag(i) = sone / adiag(i)
else
adiag(i) = sone
end if
end do
if (parms%aggr_omega_alg == mld_eig_est_) then
if (parms%aggr_eig == mld_max_norm_) then
allocate(arwsum(nrow))
call acsr%arwsum(arwsum)
anorm = maxval(abs(adiag(1:nrow)*arwsum(1:nrow)))
call psb_amx(ictxt,anorm)
omega = 4.d0/(3.d0*anorm)
parms%aggr_omega_val = omega
else
info = psb_err_internal_error_
call psb_errpush(info,name,a_err='invalid mld_aggr_eig_')
goto 9999
end if
else if (parms%aggr_omega_alg == mld_user_choice_) then
omega = parms%aggr_omega_val
else if (parms%aggr_omega_alg /= mld_user_choice_) then
info = psb_err_internal_error_
call psb_errpush(info,name,a_err='invalid mld_aggr_omega_alg_')
goto 9999
end if
call acsrf%scal(adiag,info)
if (info /= psb_success_) goto 9999
inaggr = naggr
call psb_cdall(ictxt,tmp_desc,info,nl=inaggr)
nzlp = coo_prol%get_nzeros()
call tmp_desc%indxmap%g2lip_ins(coo_prol%ja(1:nzlp),info)
call coo_prol%set_ncols(tmp_desc%get_local_cols())
call coo_prol%mv_to_fmt(csr_prol,info)
!
! Build the smoothed prolongator using either A or Af
! acsr1 = (I-w*D*A) Prol acsr1 = (I-w*D*Af) Prol
! This is always done through the variable acsrf which
! is a bit less readable, butsaves space and one extra matrix copy
!
call omega_smooth(omega,acsrf)
call psb_par_spspmm(acsrf,desc_a,csr_prol,acsr1,tmp_desc,info)
if(info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='spspmm 1')
goto 9999
end if
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done SPSPMM 1'
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)
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done smooth_aggregate '
call psb_erractionrestore(err_act)
return
9999 continue
call psb_errpush(info,name)
call psb_error_handler(err_act)
return
contains
subroutine omega_smooth(omega,acsr)
implicit none
real(psb_spk_),intent(in) :: omega
type(psb_ls_csr_sparse_mat), intent(inout) :: acsr
!
integer(psb_lpk_) :: i,j
do i=1,acsr%get_nrows()
do j=acsr%irp(i),acsr%irp(i+1)-1
if (acsr%ja(j) == i) then
acsr%val(j) = sone - omega*acsr%val(j)
else
acsr%val(j) = - omega*acsr%val(j)
end if
end do
end do
end subroutine omega_smooth
end subroutine mld_saggrmat_biz_bld

@ -104,7 +104,8 @@
! Error code.
!
!
subroutine mld_saggrmat_minnrg_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,info)
subroutine mld_saggrmat_minnrg_bld(a,desc_a,ilaggr,nlaggr,parms,&
& ac,desc_ac,op_prol,op_restr,info)
use psb_base_mod
use mld_base_prec_type
use mld_s_inner_mod, mld_protect_name => mld_saggrmat_minnrg_bld
@ -113,11 +114,12 @@ subroutine mld_saggrmat_minnrg_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_re
! Arguments
type(psb_sspmat_type), intent(in) :: a
type(psb_desc_type), intent(in) :: desc_a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(mld_sml_parms), intent(inout) :: parms
type(psb_lsspmat_type), intent(inout) :: op_prol
type(psb_lsspmat_type), intent(out) :: ac,op_restr
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
! Local variables

@ -96,7 +96,8 @@
! Error code.
!
!
subroutine mld_saggrmat_nosmth_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,info)
subroutine mld_saggrmat_nosmth_bld(a,desc_a,ilaggr,nlaggr,parms,&
& ac,desc_ac,op_prol,op_restr,t_prol,info)
use psb_base_mod
use mld_base_prec_type
use mld_s_inner_mod, mld_protect_name => mld_saggrmat_nosmth_bld
@ -105,26 +106,26 @@ subroutine mld_saggrmat_nosmth_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_re
! Arguments
type(psb_sspmat_type), intent(in) :: a
type(psb_desc_type), intent(in) :: desc_a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(mld_sml_parms), intent(inout) :: parms
type(psb_lsspmat_type), intent(inout) :: op_prol
type(psb_lsspmat_type), intent(out) :: ac,op_restr
type(psb_sspmat_type), intent(inout) :: op_prol,ac,op_restr
type(psb_lsspmat_type), intent(inout) :: t_prol
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
! Local variables
integer(psb_ipk_) :: err_act
integer(psb_ipk_) :: ictxt, np, me, icomm, minfo
character(len=20) :: name
integer(psb_ipk_) :: ierr(5)
type(psb_lsspmat_type) :: la
type(psb_ls_coo_sparse_mat) :: ac_coo, tmpcoo, coo_prol, coo_restr
type(psb_ls_csr_sparse_mat) :: acsr1, acsr2, acsr
type(psb_desc_type) :: tmp_desc
type(psb_ls_coo_sparse_mat) :: lcoo_prol
type(psb_s_coo_sparse_mat) :: coo_prol, coo_restr
type(psb_s_csr_sparse_mat) :: acsr
integer(psb_ipk_) :: debug_level, debug_unit
integer(psb_lpk_) :: nrow, nglob, ncol, ntaggr, nzl, ip, &
& naggr, nzt, naggrm1, naggrp1, i, k
integer(psb_ipk_) :: inaggr, nzlp
logical, parameter :: debug = .false.
name = 'mld_aggrmat_nosmth_bld'
info = psb_success_
@ -145,71 +146,32 @@ subroutine mld_saggrmat_nosmth_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_re
naggrm1 = sum(nlaggr(1:me))
naggrp1 = sum(nlaggr(1:me+1))
if (.false.) then
!
! If we ever want to switch to explicit product when building this..
!
call a%cp_to(acsr)
call op_prol%mv_to(coo_prol)
inaggr = naggr
call psb_cdall(ictxt,tmp_desc,info,nl=inaggr)
nzlp = coo_prol%get_nzeros()
call tmp_desc%indxmap%g2lip_ins(coo_prol%ja(1:nzlp),info)
call coo_prol%set_ncols(tmp_desc%get_local_cols())
call mld_spmm_bld_inner(acsr,desc_a,nlaggr,parms,ac,&
& coo_prol,tmp_desc,coo_restr,info)
call a%cp_to(acsr)
call t_prol%mv_to(lcoo_prol)
inaggr = naggr
call psb_cdall(ictxt,desc_ac,info,nl=inaggr)
nzlp = lcoo_prol%get_nzeros()
call desc_ac%indxmap%g2lip_ins(lcoo_prol%ja(1:nzlp),info)
call lcoo_prol%set_ncols(desc_ac%get_local_cols())
call lcoo_prol%cp_to_icoo(coo_prol,info)
if (debug) call check_coo(me,trim(name)//' Check 1 on coo_prol:',coo_prol)
call op_prol%mv_from(coo_prol)
call op_restr%mv_from(coo_restr)
call psb_cdasb(desc_ac,info)
call psb_cd_reinit(desc_ac,info)
call mld_ptap(acsr,desc_a,nlaggr,parms,ac,&
& coo_prol,desc_ac,coo_restr,info)
else
call a%cp_to(ac_coo)
nzt = ac_coo%get_nzeros()
k = 0
do i = 1, nzt
k = k + 1
ac_coo%ia(k) = ilaggr(ac_coo%ia(i))
ac_coo%ja(k) = ilaggr(ac_coo%ja(i))
ac_coo%val(k) = ac_coo%val(i)
! At this point, there may be negative entries,
! because that's how ILAGGR marks singletons
! If this is the case, roll back K
if ((ac_coo%ia(k)<=0).or.(ac_coo%ja(k)<=0)) k = k-1
enddo
call ac_coo%set_nrows(naggr)
call ac_coo%set_ncols(naggr)
call ac_coo%set_nzeros(k)
call ac_coo%set_dupl(psb_dupl_add_)
call ac_coo%fix(info)
call ac_coo%trim()
call ac%mv_from(ac_coo)
call coo_restr%set_nrows(desc_ac%get_local_rows())
call coo_restr%set_ncols(desc_a%get_local_cols())
call coo_prol%set_nrows(desc_a%get_local_rows())
call coo_prol%set_ncols(desc_ac%get_local_cols())
call op_prol%cp_to(tmpcoo)
if (debug) call check_coo(me,trim(name)//' Check 1 on coo_restr:',coo_restr)
call tmpcoo%transp()
!
! Now we have to fix this. The only rows of tmpcoo/op_restr that are correct
! are those corresponding to "local" aggregates, i.e. indices in ilaggr(:)
!
nzl = tmpcoo%get_nzeros()
i = 0
do k = 1, nzl
if ((naggrm1 < tmpcoo%ia(k)) .and.(tmpcoo%ia(k) <= naggrp1)) then
i = i+1
tmpcoo%val(i) = tmpcoo%val(k)
tmpcoo%ia(i) = tmpcoo%ia(k)
tmpcoo%ja(i) = tmpcoo%ja(k)
end if
end do
call tmpcoo%set_nzeros(i)
call tmpcoo%trim()
call op_restr%mv_from(tmpcoo)
if (info /= psb_success_) goto 9999
end if
call op_prol%mv_from(coo_prol)
call op_restr%mv_from(coo_restr)
call psb_erractionrestore(err_act)
return
@ -217,5 +179,20 @@ subroutine mld_saggrmat_nosmth_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_re
9999 call psb_error_handler(err_act)
return
contains
subroutine check_coo(me,string,coo)
implicit none
integer(psb_ipk_) :: me
type(psb_s_coo_sparse_mat) :: coo
character(len=*) :: string
integer(psb_lpk_) :: nr,nc,nz
nr = coo%get_nrows()
nc = coo%get_ncols()
nz = coo%get_nzeros()
write(0,*) me,string,nr,nc,&
& minval(coo%ia(1:nz)),maxval(coo%ia(1:nz)),&
& minval(coo%ja(1:nz)),maxval(coo%ja(1:nz))
end subroutine check_coo
end subroutine mld_saggrmat_nosmth_bld

@ -102,7 +102,8 @@
! info - integer, output.
! Error code.
!
subroutine mld_saggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,info)
subroutine mld_saggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,&
& ac,desc_ac,op_prol,op_restr,t_prol,info)
use psb_base_mod
use mld_base_prec_type
use mld_s_inner_mod, mld_protect_name => mld_saggrmat_smth_bld
@ -112,11 +113,12 @@ subroutine mld_saggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_rest
! Arguments
type(psb_sspmat_type), intent(in) :: a
type(psb_desc_type), intent(in) :: desc_a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(mld_sml_parms), intent(inout) :: parms
type(psb_lsspmat_type), intent(inout) :: op_prol
type(psb_lsspmat_type), intent(out) :: ac,op_restr
type(mld_sml_parms), intent(inout) :: parms
type(psb_sspmat_type), intent(out) :: op_prol,ac,op_restr
type(psb_lsspmat_type), intent(inout) :: t_prol
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
! Local variables
@ -125,9 +127,9 @@ subroutine mld_saggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_rest
integer(psb_ipk_) :: inaggr, nzlp
integer(psb_ipk_) :: ictxt, np, me
character(len=20) :: name
type(psb_desc_type) :: tmp_desc
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_coo_sparse_mat) :: tmpcoo
type(psb_s_coo_sparse_mat) :: coo_prol, coo_restr
type(psb_s_csr_sparse_mat) :: acsr1, acsrf, csr_prol, acsr
real(psb_spk_), allocatable :: adiag(:)
real(psb_spk_), allocatable :: arwsum(:)
integer(psb_ipk_) :: ierr(5)
@ -176,7 +178,6 @@ subroutine mld_saggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_rest
if (info == psb_success_) &
& call psb_halo(adiag,desc_a,info)
if (info == psb_success_) call a%cp_to(acsr)
call op_prol%mv_to(coo_prol)
if(info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='sp_getdiag')
@ -255,20 +256,24 @@ subroutine mld_saggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_rest
call acsrf%scal(adiag,info)
if (info /= psb_success_) goto 9999
call t_prol%mv_to(tmpcoo)
inaggr = naggr
call psb_cdall(ictxt,tmp_desc,info,nl=inaggr)
nzlp = coo_prol%get_nzeros()
call tmp_desc%indxmap%g2lip_ins(coo_prol%ja(1:nzlp),info)
call coo_prol%set_ncols(tmp_desc%get_local_cols())
call coo_prol%mv_to_fmt(csr_prol,info)
call psb_cdall(ictxt,desc_ac,info,nl=inaggr)
nzlp = tmpcoo%get_nzeros()
call desc_ac%indxmap%g2lip_ins(tmpcoo%ja(1:nzlp),info)
call tmpcoo%set_ncols(desc_ac%get_local_cols())
call tmpcoo%mv_to_ifmt(csr_prol,info)
call psb_cdasb(desc_ac,info)
call psb_cd_reinit(desc_ac,info)
!
! Build the smoothed prolongator using either A or Af
! acsr1 = (I-w*D*A) Prol acsr1 = (I-w*D*Af) Prol
! This is always done through the variable acsrf which
! is a bit less readable, butsaves space and one extra matrix copy
! is a bit less readable, but saves space and one matrix copy
!
call omega_smooth(omega,acsrf)
call psb_par_spspmm(acsrf,desc_a,csr_prol,acsr1,tmp_desc,info)
call psb_par_spspmm(acsrf,desc_a,csr_prol,acsr1,desc_ac,info)
if(info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='spspmm 1')
goto 9999
@ -281,9 +286,9 @@ subroutine mld_saggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_rest
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 mld_ptap(acsr,desc_a,nlaggr,parms,ac,&
& coo_prol,desc_ac,coo_restr,info)
call op_prol%mv_from(coo_prol)
call op_restr%mv_from(coo_restr)
@ -303,7 +308,7 @@ contains
subroutine omega_smooth(omega,acsr)
implicit none
real(psb_spk_),intent(in) :: omega
type(psb_ls_csr_sparse_mat), intent(inout) :: acsr
type(psb_s_csr_sparse_mat), intent(inout) :: acsr
!
integer(psb_lpk_) :: i,j
do i=1,acsr%get_nrows()

@ -83,7 +83,7 @@
! info - integer, output.
! Error code.
!
subroutine mld_z_dec_aggregator_mat_asb(ag,parms,a,desc_a,ilaggr,nlaggr,&
subroutine mld_z_dec_aggregator_mat_asb(ag,parms,a,desc_a,&
& ac,desc_ac, op_prol,op_restr,info)
use psb_base_mod
use mld_base_prec_type
@ -93,16 +93,13 @@ subroutine mld_z_dec_aggregator_mat_asb(ag,parms,a,desc_a,ilaggr,nlaggr,&
type(mld_dml_parms), intent(inout) :: parms
type(psb_zspmat_type), intent(in) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(psb_lzspmat_type), intent(inout) :: op_prol, ac,op_restr
type(psb_zspmat_type), intent(inout) :: op_prol, ac,op_restr
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
!
integer(psb_ipk_) :: ictxt, np, me
type(psb_lz_coo_sparse_mat) :: lacoo, lbcoo
type(psb_z_coo_sparse_mat) :: acoo
type(psb_lz_csr_sparse_mat) :: acsr1
type(psb_zspmat_type) :: tmp_ac
type(psb_lz_coo_sparse_mat) :: tmpcoo
type(psb_lzspmat_type) :: tmp_ac
integer(psb_ipk_) :: i_nr, i_nc, i_nl, nzl
integer(psb_lpk_) :: ntaggr
integer(psb_ipk_) :: err_act, debug_level, debug_unit
@ -117,70 +114,13 @@ subroutine mld_z_dec_aggregator_mat_asb(ag,parms,a,desc_a,ilaggr,nlaggr,&
ictxt = desc_a%get_context()
call psb_info(ictxt,me,np)
ntaggr = sum(nlaggr)
select case(parms%coarse_mat)
case(mld_distr_mat_)
call ac%mv_to(lbcoo)
nzl = lbcoo%get_nzeros()
i_nl = nlaggr(me+1)
if (info == psb_success_) call psb_cdall(ictxt,desc_ac,info,nl=i_nl)
if (info == psb_success_) call psb_cdins(nzl,lbcoo%ia,lbcoo%ja,desc_ac,info)
if (info == psb_success_) call psb_cdasb(desc_ac,info)
if (info == psb_success_) call psb_glob_to_loc(lbcoo%ia(1:nzl),desc_ac,info,iact='I')
if (info == psb_success_) call psb_glob_to_loc(lbcoo%ja(1:nzl),desc_ac,info,iact='I')
if (info /= psb_success_) then
call psb_errpush(psb_err_internal_error_,name,&
& a_err='Creating desc_ac and converting ac')
goto 9999
end if
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Assembld aux descr. distr.'
call ac%mv_from(lbcoo)
call ac%set_nrows(desc_ac%get_local_rows())
call ac%set_ncols(desc_ac%get_local_cols())
call ac%set_asb()
if (info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='psb_sp_free')
goto 9999
end if
if (np>1) then
call op_prol%mv_to(acsr1)
nzl = acsr1%get_nzeros()
call psb_glob_to_loc(acsr1%ja(1:nzl),desc_ac,info,'I')
if(info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='psb_glob_to_loc')
goto 9999
end if
call op_prol%mv_from(acsr1)
endif
call op_prol%set_ncols(desc_ac%get_local_cols())
if (np>1) then
!call op_restr%cscnv(info,type='coo',dupl=psb_dupl_add_)
call op_restr%mv_to(lacoo)
nzl = lacoo%get_nzeros()
if (info == psb_success_) call psb_glob_to_loc(lacoo%ia(1:nzl),desc_ac,info,'I')
call lacoo%set_dupl(psb_dupl_add_)
if (info == psb_success_) call op_restr%mv_from(lacoo)
if (info == psb_success_) call op_restr%cscnv(info,type='csr')
if(info /= psb_success_) then
call psb_errpush(psb_err_internal_error_,name,&
& a_err='Converting op_restr to local')
goto 9999
end if
end if
!
! Clip to local rows.
!
call op_restr%set_nrows(desc_ac%get_local_rows())
call ac%cscnv(info,type='csr')
call op_prol%cscnv(info,type='csr')
call op_restr%cscnv(info,type='csr')
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
@ -188,23 +128,39 @@ subroutine mld_z_dec_aggregator_mat_asb(ag,parms,a,desc_a,ilaggr,nlaggr,&
case(mld_repl_mat_)
!
! We are assuming here that an z matrix
! can hold all entries
!
! If we are here, it means we assume that an IPK version of the
! coarse matrix can hold all indices. User beware!
!
if (desc_ac%get_global_rows() < huge(1_psb_ipk_) ) then
ntaggr = desc_ac%get_global_rows()
i_nr = ntaggr
else
info = psb_err_internal_error_
call psb_errpush(info,name,a_err='invalid mld_coarse_mat_')
goto 9999
end if
call op_prol%mv_to(tmpcoo)
nzl = tmpcoo%get_nzeros()
call psb_loc_to_glob(tmpcoo%ja(1:nzl),desc_ac,info,'I')
call op_prol%mv_from(tmpcoo)
call op_restr%mv_to(tmpcoo)
nzl = tmpcoo%get_nzeros()
call psb_loc_to_glob(tmpcoo%ia(1:nzl),desc_ac,info,'I')
call op_restr%mv_from(tmpcoo)
call op_prol%set_ncols(i_nr)
call op_restr%set_nrows(i_nr)
call psb_gather(tmp_ac,ac,desc_ac,info,root=-ione,&
& dupl=psb_dupl_add_,keeploc=.false.)
call tmp_ac%mv_to(tmpcoo)
call ac%mv_from(tmpcoo)
!
! op_prol/op_restr come from par_spmm_bld with local sizes
! suitable for DIST option, fix relevant sizes
!
call op_prol%set_ncols(ntaggr)
call op_restr%set_nrows(ntaggr)
call psb_cdall(ictxt,desc_ac,info,mg=ntaggr,repl=.true.)
if (info == psb_success_) call psb_cdasb(desc_ac,info)
if (info == psb_success_) call ac%mv_to(acoo)
if (info == psb_success_) call tmp_ac%mv_from(acoo)
if (info == psb_success_) &
& call psb_gather(ac,tmp_ac,desc_ac,info,dupl=psb_dupl_add_,keeploc=.false.)
if (info /= psb_success_) goto 9999
case default
@ -221,4 +177,19 @@ subroutine mld_z_dec_aggregator_mat_asb(ag,parms,a,desc_a,ilaggr,nlaggr,&
return
contains
subroutine check_coo(me,string,coo)
implicit none
integer(psb_ipk_) :: me
type(psb_lz_coo_sparse_mat) :: coo
character(len=*) :: string
integer(psb_lpk_) :: nr,nc,nz
nr = coo%get_nrows()
nc = coo%get_ncols()
nz = coo%get_nzeros()
write(0,*) me,string,nr,nc,&
& minval(coo%ia(1:nz)),maxval(coo%ia(1:nz)),&
& minval(coo%ja(1:nz)),maxval(coo%ja(1:nz))
end subroutine check_coo
end subroutine mld_z_dec_aggregator_mat_asb

@ -133,7 +133,8 @@
! info - integer, output.
! Error code.
!
subroutine mld_z_dec_aggregator_mat_bld(ag,parms,a,desc_a,ilaggr,nlaggr,ac,op_prol,op_restr,info)
subroutine mld_z_dec_aggregator_mat_bld(ag,parms,a,desc_a,ilaggr,nlaggr,&
& ac,desc_ac,op_prol,op_restr,t_prol,info)
use psb_base_mod
use mld_z_prec_type, mld_protect_name => mld_z_dec_aggregator_mat_bld
use mld_z_inner_mod
@ -144,15 +145,14 @@ subroutine mld_z_dec_aggregator_mat_bld(ag,parms,a,desc_a,ilaggr,nlaggr,ac,op_p
type(psb_zspmat_type), intent(in) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(psb_lzspmat_type), intent(inout) :: op_prol
type(psb_lzspmat_type), intent(out) :: ac,op_restr
type(psb_lzspmat_type), intent(inout) :: t_prol
type(psb_zspmat_type), intent(out) :: op_prol,ac,op_restr
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
! Local variables
character(len=20) :: name
integer(psb_mpk_) :: ictxt, np, me
type(psb_lz_coo_sparse_mat) :: acoo, bcoo
type(psb_lz_csr_sparse_mat) :: acsr1
integer(psb_lpk_) :: nzl,ntaggr
integer(psb_ipk_) :: err_act
integer(psb_ipk_) :: debug_level, debug_unit
@ -177,22 +177,22 @@ subroutine mld_z_dec_aggregator_mat_bld(ag,parms,a,desc_a,ilaggr,nlaggr,ac,op_p
case (mld_no_smooth_)
call mld_zaggrmat_nosmth_bld(a,desc_a,ilaggr,nlaggr,&
& parms,ac,op_prol,op_restr,info)
& parms,ac,desc_ac,op_prol,op_restr,t_prol,info)
case(mld_smooth_prol_)
call mld_zaggrmat_smth_bld(a,desc_a,ilaggr,nlaggr, &
& parms,ac,op_prol,op_restr,info)
& parms,ac,desc_ac,op_prol,op_restr,t_prol,info)
case(mld_biz_prol_)
call mld_zaggrmat_biz_bld(a,desc_a,ilaggr,nlaggr, &
& parms,ac,op_prol,op_restr,info)
!!$ case(mld_biz_prol_)
!!$
!!$ call mld_zaggrmat_biz_bld(a,desc_a,ilaggr,nlaggr, &
!!$ & parms,ac,desc_ac,op_prol,op_restr,t_prol,info)
case(mld_min_energy_)
call mld_zaggrmat_minnrg_bld(a,desc_a,ilaggr,nlaggr, &
& parms,ac,op_prol,op_restr,info)
& parms,ac,desc_ac,op_prol,op_restr,t_prol,info)
case default
info = psb_err_internal_error_

@ -68,14 +68,14 @@
! overlap.
! nlaggr - integer, dimension(:), allocatable, output
! nlaggr(i) contains the aggregates held by process i.
! op_prol - type(psb_zspmat_type), output
! t_prol - type(psb_zspmat_type), output
! The tentative prolongator, based on ilaggr.
!
! info - integer, output.
! Error code.
!
subroutine mld_z_dec_aggregator_build_tprol(ag,parms,ag_data,&
& a,desc_a,ilaggr,nlaggr,op_prol,info)
& a,desc_a,ilaggr,nlaggr,t_prol,info)
use psb_base_mod
use mld_z_prec_type, mld_protect_name => mld_z_dec_aggregator_build_tprol
use mld_z_inner_mod
@ -86,7 +86,7 @@ subroutine mld_z_dec_aggregator_build_tprol(ag,parms,ag_data,&
type(psb_zspmat_type), intent(in) :: a
type(psb_desc_type), intent(in) :: desc_a
integer(psb_lpk_), allocatable, intent(out) :: ilaggr(:),nlaggr(:)
type(psb_lzspmat_type), intent(out) :: op_prol
type(psb_lzspmat_type), intent(out) :: t_prol
integer(psb_ipk_), intent(out) :: info
! Local variables
@ -123,7 +123,7 @@ subroutine mld_z_dec_aggregator_build_tprol(ag,parms,ag_data,&
clean_zeros = ag%do_clean_zeros
call ag%soc_map_bld(parms%aggr_ord,parms%aggr_thresh,clean_zeros,a,desc_a,nlaggr,ilaggr,info)
if (info==psb_success_) call mld_map_to_tprol(desc_a,ilaggr,nlaggr,op_prol,info)
if (info==psb_success_) call mld_map_to_tprol(desc_a,ilaggr,nlaggr,t_prol,info)
if (info /= psb_success_) then
info=psb_err_from_subroutine_
call psb_errpush(info,name,a_err='soc_map_bld/map_to_tprol')

@ -124,9 +124,9 @@ subroutine mld_z_map_to_tprol(desc_a,ilaggr,nlaggr,op_prol,info)
goto 9999
end if
call tmpcoo%allocate(ncol,ntaggr,ncol)
call tmpcoo%allocate(nrow,ntaggr,ncol)
k = 0
do i=1,ncol
do i=1,nrow
!
! Note: at this point, a value ilaggr(i)<=0
! tags a "singleton" row, and it has to be

@ -0,0 +1,689 @@
!
!
! MLD2P4 Extensions
!
! (C) Copyright 2019
!
! Salvatore Filippone Cranfield University
! Pasqua D'Ambra IAC-CNR, Naples, IT
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the MLD2P4 group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE MLD2P4 GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
! File: mld_daggrmat_nosmth_bld.F90
!
!
subroutine mld_z_ptap(a_csr,desc_a,nlaggr,parms,ac,&
& coo_prol,desc_ac,coo_restr,info,desc_ax)
use psb_base_mod
use mld_z_inner_mod
use mld_z_base_aggregator_mod, mld_protect_name => mld_z_ptap
implicit none
! Arguments
type(psb_z_csr_sparse_mat), intent(inout) :: a_csr
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: nlaggr(:)
type(mld_dml_parms), intent(inout) :: parms
type(psb_z_coo_sparse_mat), intent(inout) :: coo_prol, coo_restr
type(psb_desc_type), intent(inout) :: desc_ac
type(psb_zspmat_type), intent(out) :: ac
integer(psb_ipk_), intent(out) :: info
type(psb_desc_type), intent(inout), optional :: desc_ax
! 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_z_csr_sparse_mat) :: acsr3, csr_prol, ac_csr, csr_restr
integer(psb_ipk_) :: debug_level, debug_unit, naggr
integer(psb_lpk_) :: nglob, ntaggr, naggrm1, naggrp1
integer(psb_ipk_) :: nrow, ncol, nrl, nzl, ip, nzt, i, k
integer(psb_lpk_) :: nrsave, ncsave, nzsave, nza
logical, parameter :: do_timings=.false., oldstyle=.false., debug=.false.
integer(psb_ipk_), save :: idx_spspmm=-1
name='mld_ptap'
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
!
! COO_PROL should arrive here with local numbering
!
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_ac%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_ac,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_ac%get_local_rows(),desc_ac%get_local_cols()
!
! Ok first product done.
if (present(desc_ax)) then
block
call coo_prol%cp_to_coo(coo_restr,info)
call coo_restr%set_ncols(desc_ac%get_local_cols())
call coo_restr%set_nrows(desc_a%get_local_rows())
call psb_z_coo_glob_transpose(coo_restr,desc_a,info,desc_c=desc_ac,desc_rx=desc_ax)
call coo_restr%set_nrows(desc_ac%get_local_rows())
call coo_restr%set_ncols(desc_ax%get_local_cols())
!!$ write(0,*) me,' ',trim(name),' check on glob_transpose 1: ',&
!!$ & desc_a%get_local_cols(),desc_ax%get_local_cols(),coo_restr%get_nzeros()
if (desc_a%get_local_cols()<desc_ax%get_local_cols()) then
write(0,*) me,' ',trim(name),' WARNING: GLOB_TRANSPOSE NEW INDICES '
end if
end block
call csr_restr%cp_from_coo(coo_restr,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'
if (debug) write(0,*) me,trim(name),' Product RESTRxAP ',&
& csr_restr%get_nrows(),csr_restr%get_ncols(), &
& desc_ac%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_ax,acsr3,ac_csr,desc_ac,info)
if (do_timings) call psb_toc(idx_spspmm)
call acsr3%free()
else
!
! 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%mv_to_coo(coo_restr,info)
!!$ write(0,*)me,' ',name,' new into transposition ',coo_restr%get_nrows(),&
!!$ & coo_restr%get_ncols(),coo_restr%get_nzeros()
if (debug) call check_coo(me,trim(name)//' Check 1 (before transp) on coo_restr:',coo_restr)
call coo_restr%transp()
nzl = coo_restr%get_nzeros()
nrl = desc_ac%get_local_rows()
i=0
!
! Only keep local rows
!
do k=1, nzl
if ((1 <= coo_restr%ia(k)) .and.(coo_restr%ia(k) <= nrl)) 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)
nzl = coo_restr%get_nzeros()
call coo_restr%set_nrows(desc_ac%get_local_rows())
call coo_restr%set_ncols(desc_a%get_local_cols())
if (debug) call check_coo(me,trim(name)//' Check 2 on coo_restr:',coo_restr)
call csr_restr%cp_from_coo(coo_restr,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'
if (debug) write(0,*) me,trim(name),' Product RESTRxAP ',&
& csr_restr%get_nrows(),csr_restr%get_ncols(), &
& desc_ac%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_ac,info)
if (do_timings) call psb_toc(idx_spspmm)
call acsr3%free()
end if
call psb_cdasb(desc_ac,info)
call ac_csr%set_nrows(desc_ac%get_local_rows())
call ac_csr%set_ncols(desc_ac%get_local_cols())
call ac%mv_from(ac_csr)
call ac%set_asb()
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()
call coo_prol%set_ncols(desc_ac%get_local_cols())
if (debug) call check_coo(me,trim(name)//' Check 3 on coo_restr:',coo_restr)
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done ptap '
call psb_erractionrestore(err_act)
return
9999 call psb_error_handler(err_act)
return
contains
subroutine check_coo(me,string,coo)
implicit none
integer(psb_ipk_) :: me
type(psb_z_coo_sparse_mat) :: coo
character(len=*) :: string
integer(psb_lpk_) :: nr,nc,nz
nr = coo%get_nrows()
nc = coo%get_ncols()
nz = coo%get_nzeros()
write(0,*) me,string,nr,nc,&
& minval(coo%ia(1:nz)),maxval(coo%ia(1:nz)),&
& minval(coo%ja(1:nz)),maxval(coo%ja(1:nz))
end subroutine check_coo
end subroutine mld_z_ptap
subroutine mld_z_lz_ptap(a_csr,desc_a,nlaggr,parms,ac,&
& coo_prol,desc_ac,coo_restr,info,desc_ax)
use psb_base_mod
use mld_z_inner_mod
use mld_z_base_aggregator_mod !, mld_protect_name => mld_z_lz_ptap
implicit none
! Arguments
type(psb_z_csr_sparse_mat), intent(inout) :: a_csr
type(psb_desc_type), intent(inout) :: 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_ac
type(psb_lzspmat_type), intent(out) :: ac
integer(psb_ipk_), intent(out) :: info
type(psb_desc_type), intent(inout), optional :: desc_ax
! 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_z_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, nrl, nzl, ip, &
& nzt, naggrm1, naggrp1, i, k
integer(psb_lpk_) :: nrsave, ncsave, nzsave, nza
logical, parameter :: do_timings=.false., oldstyle=.false., debug=.false.
integer(psb_ipk_), save :: idx_spspmm=-1
name='mld_ptap'
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
!
! COO_PROL should arrive here with local numbering
!
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_ifmt(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_ac%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_ac,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_ac%get_local_rows(),desc_ac%get_local_cols()
!
! Ok first product done.
if (present(desc_ax)) then
block
type(psb_z_coo_sparse_mat) :: icoo_restr
call coo_prol%cp_to_icoo(icoo_restr,info)
call icoo_restr%set_ncols(desc_ac%get_local_cols())
call icoo_restr%set_nrows(desc_a%get_local_rows())
call psb_z_coo_glob_transpose(icoo_restr,desc_a,info,desc_c=desc_ac,desc_rx=desc_ax)
call icoo_restr%set_nrows(desc_ac%get_local_rows())
call icoo_restr%set_ncols(desc_ax%get_local_cols())
write(0,*) me,' ',trim(name),' check on glob_transpose 1: ',&
& desc_a%get_local_cols(),desc_ax%get_local_cols(),icoo_restr%get_nzeros()
if (desc_a%get_local_cols()<desc_ax%get_local_cols()) then
write(0,*) me,' ',trim(name),' WARNING: GLOB_TRANSPOSE NEW INDICES '
end if
call coo_restr%cp_from_icoo(icoo_restr,info)
end block
call csr_restr%cp_from_lcoo(coo_restr,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'
if (debug) write(0,*) me,trim(name),' Product RESTRxAP ',&
& csr_restr%get_nrows(),csr_restr%get_ncols(), &
& desc_ac%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_ax,acsr3,ac_csr,desc_ac,info)
if (do_timings) call psb_toc(idx_spspmm)
call acsr3%free()
else
!
! 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%mv_to_lcoo(coo_restr,info)
!!$ write(0,*)me,' ',name,' new into transposition ',coo_restr%get_nrows(),&
!!$ & coo_restr%get_ncols(),coo_restr%get_nzeros()
if (debug) call check_coo(me,trim(name)//' Check 1 (before transp) on coo_restr:',coo_restr)
call coo_restr%transp()
nzl = coo_restr%get_nzeros()
nrl = desc_ac%get_local_rows()
i=0
!
! Only keep local rows
!
do k=1, nzl
if ((1 <= coo_restr%ia(k)) .and.(coo_restr%ia(k) <= nrl)) 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)
nzl = coo_restr%get_nzeros()
call coo_restr%set_nrows(desc_ac%get_local_rows())
call coo_restr%set_ncols(desc_a%get_local_cols())
if (debug) call check_coo(me,trim(name)//' Check 2 on coo_restr:',coo_restr)
call csr_restr%cp_from_lcoo(coo_restr,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'
if (debug) write(0,*) me,trim(name),' Product RESTRxAP ',&
& csr_restr%get_nrows(),csr_restr%get_ncols(), &
& desc_ac%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_ac,info)
if (do_timings) call psb_toc(idx_spspmm)
call acsr3%free()
end if
call psb_cdasb(desc_ac,info)
call ac_csr%set_nrows(desc_ac%get_local_rows())
call ac_csr%set_ncols(desc_ac%get_local_cols())
call ac%mv_from(ac_csr)
call ac%set_asb()
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()
call coo_prol%set_ncols(desc_ac%get_local_cols())
if (debug) call check_coo(me,trim(name)//' Check 3 on coo_restr:',coo_restr)
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done ptap '
call psb_erractionrestore(err_act)
return
9999 call psb_error_handler(err_act)
return
contains
subroutine check_coo(me,string,coo)
implicit none
integer(psb_ipk_) :: me
type(psb_lz_coo_sparse_mat) :: coo
character(len=*) :: string
integer(psb_lpk_) :: nr,nc,nz
nr = coo%get_nrows()
nc = coo%get_ncols()
nz = coo%get_nzeros()
write(0,*) me,string,nr,nc,&
& minval(coo%ia(1:nz)),maxval(coo%ia(1:nz)),&
& minval(coo%ja(1:nz)),maxval(coo%ja(1:nz))
end subroutine check_coo
end subroutine mld_z_lz_ptap
subroutine mld_lz_ptap(a_csr,desc_a,nlaggr,parms,ac,&
& coo_prol,desc_ac,coo_restr,info,desc_ax)
use psb_base_mod
use mld_z_inner_mod
use mld_z_base_aggregator_mod!, mld_protect_name => mld_lz_ptap
implicit none
! Arguments
type(psb_lz_csr_sparse_mat), intent(inout) :: a_csr
type(psb_desc_type), intent(inout) :: 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_ac
type(psb_lzspmat_type), intent(out) :: ac
integer(psb_ipk_), intent(out) :: info
type(psb_desc_type), intent(inout), optional :: desc_ax
! 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, nrl, nzl, ip, &
& nzt, naggrm1, naggrp1, i, k
integer(psb_lpk_) :: nrsave, ncsave, nzsave, nza
logical, parameter :: do_timings=.true., oldstyle=.false., debug=.false.
integer(psb_ipk_), save :: idx_spspmm=-1
name='mld_ptap'
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
!
! COO_PROL should arrive here with local numbering
!
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_ac%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_ac,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_ac%get_local_rows(),desc_ac%get_local_cols()
!
! Ok first product done.
if (present(desc_ax)) then
block
type(psb_z_coo_sparse_mat) :: icoo_restr
call coo_prol%cp_to_icoo(icoo_restr,info)
call icoo_restr%set_ncols(desc_ac%get_local_cols())
call icoo_restr%set_nrows(desc_a%get_local_rows())
call psb_z_coo_glob_transpose(icoo_restr,desc_a,info,desc_c=desc_ac,desc_rx=desc_ax)
call icoo_restr%set_nrows(desc_ac%get_local_rows())
call icoo_restr%set_ncols(desc_ax%get_local_cols())
write(0,*) me,' ',trim(name),' check on glob_transpose 1: ',&
& desc_a%get_local_cols(),desc_ax%get_local_cols(),icoo_restr%get_nzeros()
if (desc_a%get_local_cols()<desc_ax%get_local_cols()) then
write(0,*) me,' ',trim(name),' WARNING: GLOB_TRANSPOSE NEW INDICES '
end if
call coo_restr%cp_from_icoo(icoo_restr,info)
end block
call csr_restr%cp_from_coo(coo_restr,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'
if (debug) write(0,*) me,trim(name),' Product RESTRxAP ',&
& csr_restr%get_nrows(),csr_restr%get_ncols(), &
& desc_ac%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_ax,acsr3,ac_csr,desc_ac,info)
if (do_timings) call psb_toc(idx_spspmm)
call acsr3%free()
else
!
! 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%mv_to_coo(coo_restr,info)
!!$ write(0,*)me,' ',name,' new into transposition ',coo_restr%get_nrows(),&
!!$ & coo_restr%get_ncols(),coo_restr%get_nzeros()
if (debug) call check_coo(me,trim(name)//' Check 1 (before transp) on coo_restr:',coo_restr)
call coo_restr%transp()
nzl = coo_restr%get_nzeros()
nrl = desc_ac%get_local_rows()
i=0
!
! Only keep local rows
!
do k=1, nzl
if ((1 <= coo_restr%ia(k)) .and.(coo_restr%ia(k) <= nrl)) 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)
nzl = coo_restr%get_nzeros()
call coo_restr%set_nrows(desc_ac%get_local_rows())
call coo_restr%set_ncols(desc_a%get_local_cols())
if (debug) call check_coo(me,trim(name)//' Check 2 on coo_restr:',coo_restr)
call csr_restr%cp_from_coo(coo_restr,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'
if (debug) write(0,*) me,trim(name),' Product RESTRxAP ',&
& csr_restr%get_nrows(),csr_restr%get_ncols(), &
& desc_ac%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_ac,info)
if (do_timings) call psb_toc(idx_spspmm)
call acsr3%free()
end if
call psb_cdasb(desc_ac,info)
call ac_csr%set_nrows(desc_ac%get_local_rows())
call ac_csr%set_ncols(desc_ac%get_local_cols())
call ac%mv_from(ac_csr)
call ac%set_asb()
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()
call coo_prol%set_ncols(desc_ac%get_local_cols())
!call coo_restr%mv_from_ifmt(csr_restr,info)
!!$ call coo_restr%set_nrows(desc_ac%get_local_rows())
!!$ call coo_restr%set_ncols(desc_a%get_local_cols())
if (debug) call check_coo(me,trim(name)//' Check 3 on coo_restr:',coo_restr)
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done ptap '
call psb_erractionrestore(err_act)
return
9999 call psb_error_handler(err_act)
return
contains
subroutine check_coo(me,string,coo)
implicit none
integer(psb_ipk_) :: me
type(psb_lz_coo_sparse_mat) :: coo
character(len=*) :: string
integer(psb_lpk_) :: nr,nc,nz
nr = coo%get_nrows()
nc = coo%get_ncols()
nz = coo%get_nzeros()
write(0,*) me,string,nr,nc,&
& minval(coo%ia(1:nz)),maxval(coo%ia(1:nz)),&
& minval(coo%ja(1:nz)),maxval(coo%ja(1:nz))
end subroutine check_coo
end subroutine mld_lz_ptap

@ -1,390 +0,0 @@
!
!
! MLD2P4 Extensions
!
! (C) Copyright 2019
!
! Salvatore Filippone Cranfield University
! Pasqua D'Ambra IAC-CNR, Naples, IT
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the MLD2P4 group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE MLD2P4 GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
! File: mld_daggrmat_nosmth_bld.F90
!
!
subroutine mld_z_spmm_bld_inner(a_csr,desc_a,nlaggr,parms,ac,&
& coo_prol,desc_cprol,coo_restr,info)
use psb_base_mod
use mld_z_inner_mod
use mld_z_base_aggregator_mod, mld_protect_name => mld_z_spmm_bld_inner
implicit none
! Arguments
type(psb_z_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_z_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
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
!
! COO_PROL should arrive here with local numbering
!
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_ifmt(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_lcoo(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_lcoo(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 acsr3%free()
call ac_csr%mv_to_lcoo(ac_coo,info)
call ac_coo%fix(info)
nza = ac_coo%get_nzeros()
if (debug) write(0,*) me,trim(name),' Fixed ac ',&
& ac_coo%get_nrows(),ac_coo%get_ncols(), nza
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 spmm_bld_inner '
call psb_erractionrestore(err_act)
return
9999 call psb_error_handler(err_act)
return
end subroutine mld_z_spmm_bld_inner
subroutine mld_lz_spmm_bld_inner(a_csr,desc_a,nlaggr,parms,ac,&
& coo_prol,desc_cprol,coo_restr,info)
use psb_base_mod
use mld_z_inner_mod
use mld_z_base_aggregator_mod, mld_protect_name => mld_lz_spmm_bld_inner
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
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
!
! 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 spmm_bld_inner '
call psb_erractionrestore(err_act)
return
9999 call psb_error_handler(err_act)
return
end subroutine mld_lz_spmm_bld_inner

@ -1,300 +0,0 @@
!
!
! MLD2P4 version 2.2
! MultiLevel Domain Decomposition Parallel Preconditioners Package
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
!
! (C) Copyright 2008-2018
!
! Salvatore Filippone
! Pasqua D'Ambra
! Daniela di Serafino
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the MLD2P4 group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE MLD2P4 GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
! File: mld_zaggrmat_biz_bld.F90
!
! Subroutine: mld_zaggrmat_biz_bld
! Version: complex
!
! This routine builds a coarse-level matrix A_C from a fine-level matrix A
! by using the Galerkin approach, i.e.
!
! A_C = P_C^T A P_C,
!
! where P_C is a prolongator from the coarse level to the fine one.
!
! This routine builds A_C according to a "bizarre" aggregation algorithm,
! using a "naive" prolongator proposed by the authors of MLD2P4. However, this
! prolongator still requires additional analysis and testing and its use is not
! recommended.
!
! The coarse-level matrix A_C is distributed among the parallel processes or
! replicated on each of them, according to the value of p%parms%coarse_mat,
! specified by the user through mld_zprecinit and mld_zprecset.
! On output from this routine the entries of AC, op_prol, op_restr
! are still in "global numbering" mode; this is fixed in the calling routine
! mld_z_lev_aggrmat_bld.
!
! Arguments:
! a - type(psb_zspmat_type), input.
! The sparse matrix structure containing the local part of
! the fine-level matrix.
! desc_a - type(psb_desc_type), input.
! The communication descriptor of the fine-level matrix.
! p - type(mld_z_onelev_type), input/output.
! The 'one-level' data structure that will contain the local
! part of the matrix to be built as well as the information
! concerning the prolongator and its transpose.
! ilaggr - integer, dimension(:), allocatable.
! The mapping between the row indices of the coarse-level
! matrix and the row indices of the fine-level matrix.
! ilaggr(i)=j means that node i in the adjacency graph
! of the fine-level matrix is mapped onto node j in the
! adjacency graph of the coarse-level matrix.
! nlaggr - integer, dimension(:), allocatable.
! nlaggr(i) contains the aggregates held by process i.
! info - integer, output.
! Error code.
!
subroutine mld_zaggrmat_biz_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,info)
use psb_base_mod
use mld_base_prec_type
use mld_z_inner_mod, mld_protect_name => mld_zaggrmat_biz_bld
use mld_z_base_aggregator_mod
implicit none
! Arguments
type(psb_zspmat_type), intent(in) :: a
type(psb_desc_type), intent(in) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(mld_dml_parms), intent(inout) :: parms
type(psb_lzspmat_type), intent(inout) :: op_prol
type(psb_lzspmat_type), intent(out) :: ac,op_restr
integer(psb_ipk_), intent(out) :: info
! Local variables
integer(psb_lpk_) :: nrow, nglob, ncol, ntaggr, ip, &
& naggr, nzl,naggrm1,naggrp1, i, j, k, jd, icolF, nrw
integer(psb_ipk_) :: inaggr, nzlp, inrow
integer(psb_ipk_) :: ictxt, np, me
character(len=20) :: name
type(psb_desc_type) :: tmp_desc
type(psb_z_coo_sparse_mat) :: icoo
type(psb_lz_coo_sparse_mat) :: coo_prol, coo_restr, tmpcoo
type(psb_lz_csr_sparse_mat) :: acsr1, acsrf, csr_prol, acsr
complex(psb_dpk_), allocatable :: adiag(:)
real(psb_dpk_), allocatable :: arwsum(:)
integer(psb_ipk_) :: ierr(5)
logical :: filter_mat
integer(psb_ipk_) :: debug_level, debug_unit, err_act
integer(psb_ipk_), parameter :: ncmax=16
real(psb_dpk_) :: anorm, omega, tmp, dg, theta
logical, parameter :: debug_new=.false.
character(len=80) :: filename
name='mld_aggrmat_biz_bld'
info=psb_success_
call psb_erractionsave(err_act)
if (psb_errstatus_fatal()) then
info = psb_err_internal_error_; goto 9999
end if
debug_unit = psb_get_debug_unit()
debug_level = psb_get_debug_level()
ictxt = desc_a%get_context()
call psb_info(ictxt, me, np)
nglob = desc_a%get_global_rows()
nrow = desc_a%get_local_rows()
ncol = desc_a%get_local_cols()
theta = parms%aggr_thresh
naggr = nlaggr(me+1)
ntaggr = sum(nlaggr)
naggrm1 = sum(nlaggr(1:me))
naggrp1 = sum(nlaggr(1:me+1))
filter_mat = (parms%aggr_filter == mld_filter_mat_)
!
! naggr: number of local aggregates
! nrow: local rows.
!
! Get the diagonal D
adiag = a%get_diag(info)
if (info == psb_success_) &
& call psb_realloc(ncol,adiag,info)
if (info == psb_success_) &
& call psb_halo(adiag,desc_a,info)
if (info == psb_success_) call a%csclip(icoo,info,jmax=a%get_nrows())
call icoo%mv_to_lfmt(acsr,info)
call op_prol%mv_to(coo_prol)
if(info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='sp_getdiag')
goto 9999
end if
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& ' Initial copies done.'
call acsr%cp_to_fmt(acsrf,info)
if (filter_mat) then
!
! Build the filtered matrix Af from A
!
do i=1, nrow
tmp = zzero
jd = -1
do j=acsrf%irp(i),acsrf%irp(i+1)-1
if (acsrf%ja(j) == i) jd = j
if (abs(acsrf%val(j)) < theta*sqrt(abs(adiag(i)*adiag(acsrf%ja(j))))) then
tmp=tmp+acsrf%val(j)
acsrf%val(j)=zzero
endif
enddo
if (jd == -1) then
write(0,*) 'Wrong input: we need the diagonal!!!!', i
else
acsrf%val(jd)=acsrf%val(jd)-tmp
end if
enddo
! Take out zeroed terms
call acsrf%clean_zeros(info)
end if
do i=1,size(adiag)
if (adiag(i) /= zzero) then
adiag(i) = zone / adiag(i)
else
adiag(i) = zone
end if
end do
if (parms%aggr_omega_alg == mld_eig_est_) then
if (parms%aggr_eig == mld_max_norm_) then
allocate(arwsum(nrow))
call acsr%arwsum(arwsum)
anorm = maxval(abs(adiag(1:nrow)*arwsum(1:nrow)))
call psb_amx(ictxt,anorm)
omega = 4.d0/(3.d0*anorm)
parms%aggr_omega_val = omega
else
info = psb_err_internal_error_
call psb_errpush(info,name,a_err='invalid mld_aggr_eig_')
goto 9999
end if
else if (parms%aggr_omega_alg == mld_user_choice_) then
omega = parms%aggr_omega_val
else if (parms%aggr_omega_alg /= mld_user_choice_) then
info = psb_err_internal_error_
call psb_errpush(info,name,a_err='invalid mld_aggr_omega_alg_')
goto 9999
end if
call acsrf%scal(adiag,info)
if (info /= psb_success_) goto 9999
inaggr = naggr
call psb_cdall(ictxt,tmp_desc,info,nl=inaggr)
nzlp = coo_prol%get_nzeros()
call tmp_desc%indxmap%g2lip_ins(coo_prol%ja(1:nzlp),info)
call coo_prol%set_ncols(tmp_desc%get_local_cols())
call coo_prol%mv_to_fmt(csr_prol,info)
!
! Build the smoothed prolongator using either A or Af
! acsr1 = (I-w*D*A) Prol acsr1 = (I-w*D*Af) Prol
! This is always done through the variable acsrf which
! is a bit less readable, butsaves space and one extra matrix copy
!
call omega_smooth(omega,acsrf)
call psb_par_spspmm(acsrf,desc_a,csr_prol,acsr1,tmp_desc,info)
if(info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='spspmm 1')
goto 9999
end if
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done SPSPMM 1'
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)
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),&
& 'Done smooth_aggregate '
call psb_erractionrestore(err_act)
return
9999 continue
call psb_errpush(info,name)
call psb_error_handler(err_act)
return
contains
subroutine omega_smooth(omega,acsr)
implicit none
real(psb_dpk_),intent(in) :: omega
type(psb_lz_csr_sparse_mat), intent(inout) :: acsr
!
integer(psb_lpk_) :: i,j
do i=1,acsr%get_nrows()
do j=acsr%irp(i),acsr%irp(i+1)-1
if (acsr%ja(j) == i) then
acsr%val(j) = zone - omega*acsr%val(j)
else
acsr%val(j) = - omega*acsr%val(j)
end if
end do
end do
end subroutine omega_smooth
end subroutine mld_zaggrmat_biz_bld

@ -104,7 +104,8 @@
! Error code.
!
!
subroutine mld_zaggrmat_minnrg_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,info)
subroutine mld_zaggrmat_minnrg_bld(a,desc_a,ilaggr,nlaggr,parms,&
& ac,desc_ac,op_prol,op_restr,info)
use psb_base_mod
use mld_base_prec_type
use mld_z_inner_mod, mld_protect_name => mld_zaggrmat_minnrg_bld
@ -113,11 +114,12 @@ subroutine mld_zaggrmat_minnrg_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_re
! Arguments
type(psb_zspmat_type), intent(in) :: a
type(psb_desc_type), intent(in) :: desc_a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(mld_dml_parms), intent(inout) :: parms
type(psb_lzspmat_type), intent(inout) :: op_prol
type(psb_lzspmat_type), intent(out) :: ac,op_restr
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
! Local variables

@ -96,7 +96,8 @@
! Error code.
!
!
subroutine mld_zaggrmat_nosmth_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,info)
subroutine mld_zaggrmat_nosmth_bld(a,desc_a,ilaggr,nlaggr,parms,&
& ac,desc_ac,op_prol,op_restr,t_prol,info)
use psb_base_mod
use mld_base_prec_type
use mld_z_inner_mod, mld_protect_name => mld_zaggrmat_nosmth_bld
@ -105,26 +106,26 @@ subroutine mld_zaggrmat_nosmth_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_re
! Arguments
type(psb_zspmat_type), intent(in) :: a
type(psb_desc_type), intent(in) :: desc_a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(mld_dml_parms), intent(inout) :: parms
type(psb_lzspmat_type), intent(inout) :: op_prol
type(psb_lzspmat_type), intent(out) :: ac,op_restr
type(psb_zspmat_type), intent(inout) :: op_prol,ac,op_restr
type(psb_lzspmat_type), intent(inout) :: t_prol
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
! Local variables
integer(psb_ipk_) :: err_act
integer(psb_ipk_) :: ictxt, np, me, icomm, minfo
character(len=20) :: name
integer(psb_ipk_) :: ierr(5)
type(psb_lzspmat_type) :: la
type(psb_lz_coo_sparse_mat) :: ac_coo, tmpcoo, coo_prol, coo_restr
type(psb_lz_csr_sparse_mat) :: acsr1, acsr2, acsr
type(psb_desc_type) :: tmp_desc
type(psb_lz_coo_sparse_mat) :: lcoo_prol
type(psb_z_coo_sparse_mat) :: coo_prol, coo_restr
type(psb_z_csr_sparse_mat) :: acsr
integer(psb_ipk_) :: debug_level, debug_unit
integer(psb_lpk_) :: nrow, nglob, ncol, ntaggr, nzl, ip, &
& naggr, nzt, naggrm1, naggrp1, i, k
integer(psb_ipk_) :: inaggr, nzlp
logical, parameter :: debug = .false.
name = 'mld_aggrmat_nosmth_bld'
info = psb_success_
@ -145,71 +146,32 @@ subroutine mld_zaggrmat_nosmth_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_re
naggrm1 = sum(nlaggr(1:me))
naggrp1 = sum(nlaggr(1:me+1))
if (.false.) then
!
! If we ever want to switch to explicit product when building this..
!
call a%cp_to(acsr)
call op_prol%mv_to(coo_prol)
inaggr = naggr
call psb_cdall(ictxt,tmp_desc,info,nl=inaggr)
nzlp = coo_prol%get_nzeros()
call tmp_desc%indxmap%g2lip_ins(coo_prol%ja(1:nzlp),info)
call coo_prol%set_ncols(tmp_desc%get_local_cols())
call mld_spmm_bld_inner(acsr,desc_a,nlaggr,parms,ac,&
& coo_prol,tmp_desc,coo_restr,info)
call a%cp_to(acsr)
call t_prol%mv_to(lcoo_prol)
inaggr = naggr
call psb_cdall(ictxt,desc_ac,info,nl=inaggr)
nzlp = lcoo_prol%get_nzeros()
call desc_ac%indxmap%g2lip_ins(lcoo_prol%ja(1:nzlp),info)
call lcoo_prol%set_ncols(desc_ac%get_local_cols())
call lcoo_prol%cp_to_icoo(coo_prol,info)
if (debug) call check_coo(me,trim(name)//' Check 1 on coo_prol:',coo_prol)
call op_prol%mv_from(coo_prol)
call op_restr%mv_from(coo_restr)
call psb_cdasb(desc_ac,info)
call psb_cd_reinit(desc_ac,info)
call mld_ptap(acsr,desc_a,nlaggr,parms,ac,&
& coo_prol,desc_ac,coo_restr,info)
else
call a%cp_to(ac_coo)
nzt = ac_coo%get_nzeros()
k = 0
do i = 1, nzt
k = k + 1
ac_coo%ia(k) = ilaggr(ac_coo%ia(i))
ac_coo%ja(k) = ilaggr(ac_coo%ja(i))
ac_coo%val(k) = ac_coo%val(i)
! At this point, there may be negative entries,
! because that's how ILAGGR marks singletons
! If this is the case, roll back K
if ((ac_coo%ia(k)<=0).or.(ac_coo%ja(k)<=0)) k = k-1
enddo
call ac_coo%set_nrows(naggr)
call ac_coo%set_ncols(naggr)
call ac_coo%set_nzeros(k)
call ac_coo%set_dupl(psb_dupl_add_)
call ac_coo%fix(info)
call ac_coo%trim()
call ac%mv_from(ac_coo)
call coo_restr%set_nrows(desc_ac%get_local_rows())
call coo_restr%set_ncols(desc_a%get_local_cols())
call coo_prol%set_nrows(desc_a%get_local_rows())
call coo_prol%set_ncols(desc_ac%get_local_cols())
call op_prol%cp_to(tmpcoo)
if (debug) call check_coo(me,trim(name)//' Check 1 on coo_restr:',coo_restr)
call tmpcoo%transp()
!
! Now we have to fix this. The only rows of tmpcoo/op_restr that are correct
! are those corresponding to "local" aggregates, i.e. indices in ilaggr(:)
!
nzl = tmpcoo%get_nzeros()
i = 0
do k = 1, nzl
if ((naggrm1 < tmpcoo%ia(k)) .and.(tmpcoo%ia(k) <= naggrp1)) then
i = i+1
tmpcoo%val(i) = tmpcoo%val(k)
tmpcoo%ia(i) = tmpcoo%ia(k)
tmpcoo%ja(i) = tmpcoo%ja(k)
end if
end do
call tmpcoo%set_nzeros(i)
call tmpcoo%trim()
call op_restr%mv_from(tmpcoo)
if (info /= psb_success_) goto 9999
end if
call op_prol%mv_from(coo_prol)
call op_restr%mv_from(coo_restr)
call psb_erractionrestore(err_act)
return
@ -217,5 +179,20 @@ subroutine mld_zaggrmat_nosmth_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_re
9999 call psb_error_handler(err_act)
return
contains
subroutine check_coo(me,string,coo)
implicit none
integer(psb_ipk_) :: me
type(psb_z_coo_sparse_mat) :: coo
character(len=*) :: string
integer(psb_lpk_) :: nr,nc,nz
nr = coo%get_nrows()
nc = coo%get_ncols()
nz = coo%get_nzeros()
write(0,*) me,string,nr,nc,&
& minval(coo%ia(1:nz)),maxval(coo%ia(1:nz)),&
& minval(coo%ja(1:nz)),maxval(coo%ja(1:nz))
end subroutine check_coo
end subroutine mld_zaggrmat_nosmth_bld

@ -102,7 +102,8 @@
! info - integer, output.
! Error code.
!
subroutine mld_zaggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,info)
subroutine mld_zaggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,&
& ac,desc_ac,op_prol,op_restr,t_prol,info)
use psb_base_mod
use mld_base_prec_type
use mld_z_inner_mod, mld_protect_name => mld_zaggrmat_smth_bld
@ -112,11 +113,12 @@ subroutine mld_zaggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_rest
! Arguments
type(psb_zspmat_type), intent(in) :: a
type(psb_desc_type), intent(in) :: desc_a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(mld_dml_parms), intent(inout) :: parms
type(psb_lzspmat_type), intent(inout) :: op_prol
type(psb_lzspmat_type), intent(out) :: ac,op_restr
type(mld_dml_parms), intent(inout) :: parms
type(psb_zspmat_type), intent(out) :: op_prol,ac,op_restr
type(psb_lzspmat_type), intent(inout) :: t_prol
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
! Local variables
@ -125,9 +127,9 @@ subroutine mld_zaggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_rest
integer(psb_ipk_) :: inaggr, nzlp
integer(psb_ipk_) :: ictxt, np, me
character(len=20) :: name
type(psb_desc_type) :: tmp_desc
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_coo_sparse_mat) :: tmpcoo
type(psb_z_coo_sparse_mat) :: coo_prol, coo_restr
type(psb_z_csr_sparse_mat) :: acsr1, acsrf, csr_prol, acsr
complex(psb_dpk_), allocatable :: adiag(:)
real(psb_dpk_), allocatable :: arwsum(:)
integer(psb_ipk_) :: ierr(5)
@ -176,7 +178,6 @@ subroutine mld_zaggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_rest
if (info == psb_success_) &
& call psb_halo(adiag,desc_a,info)
if (info == psb_success_) call a%cp_to(acsr)
call op_prol%mv_to(coo_prol)
if(info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='sp_getdiag')
@ -255,20 +256,24 @@ subroutine mld_zaggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_rest
call acsrf%scal(adiag,info)
if (info /= psb_success_) goto 9999
call t_prol%mv_to(tmpcoo)
inaggr = naggr
call psb_cdall(ictxt,tmp_desc,info,nl=inaggr)
nzlp = coo_prol%get_nzeros()
call tmp_desc%indxmap%g2lip_ins(coo_prol%ja(1:nzlp),info)
call coo_prol%set_ncols(tmp_desc%get_local_cols())
call coo_prol%mv_to_fmt(csr_prol,info)
call psb_cdall(ictxt,desc_ac,info,nl=inaggr)
nzlp = tmpcoo%get_nzeros()
call desc_ac%indxmap%g2lip_ins(tmpcoo%ja(1:nzlp),info)
call tmpcoo%set_ncols(desc_ac%get_local_cols())
call tmpcoo%mv_to_ifmt(csr_prol,info)
call psb_cdasb(desc_ac,info)
call psb_cd_reinit(desc_ac,info)
!
! Build the smoothed prolongator using either A or Af
! acsr1 = (I-w*D*A) Prol acsr1 = (I-w*D*Af) Prol
! This is always done through the variable acsrf which
! is a bit less readable, butsaves space and one extra matrix copy
! is a bit less readable, but saves space and one matrix copy
!
call omega_smooth(omega,acsrf)
call psb_par_spspmm(acsrf,desc_a,csr_prol,acsr1,tmp_desc,info)
call psb_par_spspmm(acsrf,desc_a,csr_prol,acsr1,desc_ac,info)
if(info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='spspmm 1')
goto 9999
@ -281,9 +286,9 @@ subroutine mld_zaggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_rest
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 mld_ptap(acsr,desc_a,nlaggr,parms,ac,&
& coo_prol,desc_ac,coo_restr,info)
call op_prol%mv_from(coo_prol)
call op_restr%mv_from(coo_restr)
@ -303,7 +308,7 @@ contains
subroutine omega_smooth(omega,acsr)
implicit none
real(psb_dpk_),intent(in) :: omega
type(psb_lz_csr_sparse_mat), intent(inout) :: acsr
type(psb_z_csr_sparse_mat), intent(inout) :: acsr
!
integer(psb_lpk_) :: i,j
do i=1,acsr%get_nrows()

@ -83,7 +83,7 @@
! info - integer, output.
! Error code.
!
subroutine mld_c_base_onelev_mat_asb(lv,a,desc_a,ilaggr,nlaggr,op_prol,info)
subroutine mld_c_base_onelev_mat_asb(lv,a,desc_a,ilaggr,nlaggr,t_prol,info)
use psb_base_mod
use mld_base_prec_type
@ -97,19 +97,16 @@ subroutine mld_c_base_onelev_mat_asb(lv,a,desc_a,ilaggr,nlaggr,op_prol,info)
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: nlaggr(:)
integer(psb_lpk_), intent(inout) :: ilaggr(:)
type(psb_lcspmat_type), intent(inout) :: op_prol
type(psb_lcspmat_type), intent(inout) :: t_prol
integer(psb_ipk_), intent(out) :: info
! Local variables
character(len=24) :: name
integer(psb_ipk_) :: ictxt, np, me
integer(psb_ipk_) :: err_act
type(psb_lcspmat_type) :: lac, op_restr
type(psb_cspmat_type) :: ac, iop_restr, iop_prol
type(psb_lc_coo_sparse_mat) :: acoo, bcoo
type(psb_lc_csr_sparse_mat) :: acsr1
integer(psb_ipk_) :: nzl, inl
character(len=24) :: name
integer(psb_ipk_) :: ictxt, np, me
integer(psb_ipk_) :: err_act
type(psb_cspmat_type) :: ac, op_restr, op_prol
integer(psb_ipk_) :: nzl, inl
integer(psb_ipk_) :: debug_level, debug_unit
name='mld_c_onelev_mat_asb'
@ -141,7 +138,8 @@ subroutine mld_c_base_onelev_mat_asb(lv,a,desc_a,ilaggr,nlaggr,op_prol,info)
! the mapping defined by mld_aggrmap_bld and applying the aggregation
! algorithm specified by lv%iprcparm(mld_aggr_prol_)
!
call lv%aggr%mat_bld(lv%parms,a,desc_a,ilaggr,nlaggr,lac,op_prol,op_restr,info)
call lv%aggr%mat_bld(lv%parms,a,desc_a,ilaggr,nlaggr,&
& lv%ac,lv%desc_ac,op_prol,op_restr,t_prol,info)
if(info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='mld_aggrmat_asb')
@ -153,10 +151,9 @@ subroutine mld_c_base_onelev_mat_asb(lv,a,desc_a,ilaggr,nlaggr,op_prol,info)
! ac, op_restr and op_prol
!
if (info == psb_success_) &
& call lv%aggr%mat_asb(lv%parms,a,desc_a,ilaggr,nlaggr,&
& lac,lv%desc_ac,op_prol,op_restr,info)
& call lv%aggr%mat_asb(lv%parms,a,desc_a,&
& lv%ac,lv%desc_ac,op_prol,op_restr,info)
call lv%ac%mv_from_l(lac)
if (info == psb_success_) call lv%ac%cscnv(info,type='csr',dupl=psb_dupl_add_)
if (info == psb_success_) call lv%aggr%bld_map(desc_a, lv%desc_ac,&

@ -83,7 +83,7 @@
! info - integer, output.
! Error code.
!
subroutine mld_d_base_onelev_mat_asb(lv,a,desc_a,ilaggr,nlaggr,op_prol,info)
subroutine mld_d_base_onelev_mat_asb(lv,a,desc_a,ilaggr,nlaggr,t_prol,info)
use psb_base_mod
use mld_base_prec_type
@ -97,19 +97,16 @@ subroutine mld_d_base_onelev_mat_asb(lv,a,desc_a,ilaggr,nlaggr,op_prol,info)
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: nlaggr(:)
integer(psb_lpk_), intent(inout) :: ilaggr(:)
type(psb_ldspmat_type), intent(inout) :: op_prol
type(psb_ldspmat_type), intent(inout) :: t_prol
integer(psb_ipk_), intent(out) :: info
! Local variables
character(len=24) :: name
integer(psb_ipk_) :: ictxt, np, me
integer(psb_ipk_) :: err_act
type(psb_ldspmat_type) :: lac, op_restr
type(psb_dspmat_type) :: ac, iop_restr, iop_prol
type(psb_ld_coo_sparse_mat) :: acoo, bcoo
type(psb_ld_csr_sparse_mat) :: acsr1
integer(psb_ipk_) :: nzl, inl
character(len=24) :: name
integer(psb_ipk_) :: ictxt, np, me
integer(psb_ipk_) :: err_act
type(psb_dspmat_type) :: ac, op_restr, op_prol
integer(psb_ipk_) :: nzl, inl
integer(psb_ipk_) :: debug_level, debug_unit
name='mld_d_onelev_mat_asb'
@ -141,7 +138,8 @@ subroutine mld_d_base_onelev_mat_asb(lv,a,desc_a,ilaggr,nlaggr,op_prol,info)
! the mapping defined by mld_aggrmap_bld and applying the aggregation
! algorithm specified by lv%iprcparm(mld_aggr_prol_)
!
call lv%aggr%mat_bld(lv%parms,a,desc_a,ilaggr,nlaggr,lac,op_prol,op_restr,info)
call lv%aggr%mat_bld(lv%parms,a,desc_a,ilaggr,nlaggr,&
& lv%ac,lv%desc_ac,op_prol,op_restr,t_prol,info)
if(info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='mld_aggrmat_asb')
@ -153,10 +151,9 @@ subroutine mld_d_base_onelev_mat_asb(lv,a,desc_a,ilaggr,nlaggr,op_prol,info)
! ac, op_restr and op_prol
!
if (info == psb_success_) &
& call lv%aggr%mat_asb(lv%parms,a,desc_a,ilaggr,nlaggr,&
& lac,lv%desc_ac,op_prol,op_restr,info)
& call lv%aggr%mat_asb(lv%parms,a,desc_a,&
& lv%ac,lv%desc_ac,op_prol,op_restr,info)
call lv%ac%mv_from_l(lac)
if (info == psb_success_) call lv%ac%cscnv(info,type='csr',dupl=psb_dupl_add_)
if (info == psb_success_) call lv%aggr%bld_map(desc_a, lv%desc_ac,&

@ -83,7 +83,7 @@
! info - integer, output.
! Error code.
!
subroutine mld_s_base_onelev_mat_asb(lv,a,desc_a,ilaggr,nlaggr,op_prol,info)
subroutine mld_s_base_onelev_mat_asb(lv,a,desc_a,ilaggr,nlaggr,t_prol,info)
use psb_base_mod
use mld_base_prec_type
@ -97,19 +97,16 @@ subroutine mld_s_base_onelev_mat_asb(lv,a,desc_a,ilaggr,nlaggr,op_prol,info)
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: nlaggr(:)
integer(psb_lpk_), intent(inout) :: ilaggr(:)
type(psb_lsspmat_type), intent(inout) :: op_prol
type(psb_lsspmat_type), intent(inout) :: t_prol
integer(psb_ipk_), intent(out) :: info
! Local variables
character(len=24) :: name
integer(psb_ipk_) :: ictxt, np, me
integer(psb_ipk_) :: err_act
type(psb_lsspmat_type) :: lac, op_restr
type(psb_sspmat_type) :: ac, iop_restr, iop_prol
type(psb_ls_coo_sparse_mat) :: acoo, bcoo
type(psb_ls_csr_sparse_mat) :: acsr1
integer(psb_ipk_) :: nzl, inl
character(len=24) :: name
integer(psb_ipk_) :: ictxt, np, me
integer(psb_ipk_) :: err_act
type(psb_sspmat_type) :: ac, op_restr, op_prol
integer(psb_ipk_) :: nzl, inl
integer(psb_ipk_) :: debug_level, debug_unit
name='mld_s_onelev_mat_asb'
@ -141,7 +138,8 @@ subroutine mld_s_base_onelev_mat_asb(lv,a,desc_a,ilaggr,nlaggr,op_prol,info)
! the mapping defined by mld_aggrmap_bld and applying the aggregation
! algorithm specified by lv%iprcparm(mld_aggr_prol_)
!
call lv%aggr%mat_bld(lv%parms,a,desc_a,ilaggr,nlaggr,lac,op_prol,op_restr,info)
call lv%aggr%mat_bld(lv%parms,a,desc_a,ilaggr,nlaggr,&
& lv%ac,lv%desc_ac,op_prol,op_restr,t_prol,info)
if(info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='mld_aggrmat_asb')
@ -153,10 +151,9 @@ subroutine mld_s_base_onelev_mat_asb(lv,a,desc_a,ilaggr,nlaggr,op_prol,info)
! ac, op_restr and op_prol
!
if (info == psb_success_) &
& call lv%aggr%mat_asb(lv%parms,a,desc_a,ilaggr,nlaggr,&
& lac,lv%desc_ac,op_prol,op_restr,info)
& call lv%aggr%mat_asb(lv%parms,a,desc_a,&
& lv%ac,lv%desc_ac,op_prol,op_restr,info)
call lv%ac%mv_from_l(lac)
if (info == psb_success_) call lv%ac%cscnv(info,type='csr',dupl=psb_dupl_add_)
if (info == psb_success_) call lv%aggr%bld_map(desc_a, lv%desc_ac,&

@ -83,7 +83,7 @@
! info - integer, output.
! Error code.
!
subroutine mld_z_base_onelev_mat_asb(lv,a,desc_a,ilaggr,nlaggr,op_prol,info)
subroutine mld_z_base_onelev_mat_asb(lv,a,desc_a,ilaggr,nlaggr,t_prol,info)
use psb_base_mod
use mld_base_prec_type
@ -97,19 +97,16 @@ subroutine mld_z_base_onelev_mat_asb(lv,a,desc_a,ilaggr,nlaggr,op_prol,info)
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: nlaggr(:)
integer(psb_lpk_), intent(inout) :: ilaggr(:)
type(psb_lzspmat_type), intent(inout) :: op_prol
type(psb_lzspmat_type), intent(inout) :: t_prol
integer(psb_ipk_), intent(out) :: info
! Local variables
character(len=24) :: name
integer(psb_ipk_) :: ictxt, np, me
integer(psb_ipk_) :: err_act
type(psb_lzspmat_type) :: lac, op_restr
type(psb_zspmat_type) :: ac, iop_restr, iop_prol
type(psb_lz_coo_sparse_mat) :: acoo, bcoo
type(psb_lz_csr_sparse_mat) :: acsr1
integer(psb_ipk_) :: nzl, inl
character(len=24) :: name
integer(psb_ipk_) :: ictxt, np, me
integer(psb_ipk_) :: err_act
type(psb_zspmat_type) :: ac, op_restr, op_prol
integer(psb_ipk_) :: nzl, inl
integer(psb_ipk_) :: debug_level, debug_unit
name='mld_z_onelev_mat_asb'
@ -141,7 +138,8 @@ subroutine mld_z_base_onelev_mat_asb(lv,a,desc_a,ilaggr,nlaggr,op_prol,info)
! the mapping defined by mld_aggrmap_bld and applying the aggregation
! algorithm specified by lv%iprcparm(mld_aggr_prol_)
!
call lv%aggr%mat_bld(lv%parms,a,desc_a,ilaggr,nlaggr,lac,op_prol,op_restr,info)
call lv%aggr%mat_bld(lv%parms,a,desc_a,ilaggr,nlaggr,&
& lv%ac,lv%desc_ac,op_prol,op_restr,t_prol,info)
if(info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='mld_aggrmat_asb')
@ -153,10 +151,9 @@ subroutine mld_z_base_onelev_mat_asb(lv,a,desc_a,ilaggr,nlaggr,op_prol,info)
! ac, op_restr and op_prol
!
if (info == psb_success_) &
& call lv%aggr%mat_asb(lv%parms,a,desc_a,ilaggr,nlaggr,&
& lac,lv%desc_ac,op_prol,op_restr,info)
& call lv%aggr%mat_asb(lv%parms,a,desc_a,&
& lv%ac,lv%desc_ac,op_prol,op_restr,info)
call lv%ac%mv_from_l(lac)
if (info == psb_success_) call lv%ac%cscnv(info,type='csr',dupl=psb_dupl_add_)
if (info == psb_success_) call lv%aggr%bld_map(desc_a, lv%desc_ac,&

@ -285,9 +285,8 @@ module mld_base_prec_type
integer(psb_ipk_), parameter :: mld_no_smooth_ = 0
integer(psb_ipk_), parameter :: mld_smooth_prol_ = 1
integer(psb_ipk_), parameter :: mld_min_energy_ = 2
integer(psb_ipk_), parameter :: mld_biz_prol_ = 3
! Disabling biz_prol for the time being.
integer(psb_ipk_), parameter :: mld_max_aggr_prol_=mld_min_energy_
! Disabling min_energy for the time being.
integer(psb_ipk_), parameter :: mld_max_aggr_prol_=mld_smooth_prol_
!
! Legal values for entry: mld_aggr_filter_
!

@ -119,36 +119,53 @@ module mld_c_base_aggregator_mod
end subroutine mld_c_soc_map_bld
end interface
interface mld_spmm_bld_inner
subroutine mld_c_spmm_bld_inner(a_csr,desc_a,nlaggr,parms,ac,&
& coo_prol,desc_cprol,coo_restr,info)
import :: psb_c_csr_sparse_mat, psb_lcspmat_type, psb_desc_type, &
& psb_lc_coo_sparse_mat, mld_sml_parms, psb_spk_, psb_ipk_, psb_lpk_
interface mld_ptap
subroutine mld_c_ptap(a_csr,desc_a,nlaggr,parms,ac,&
& coo_prol,desc_cprol,coo_restr,info,desc_ax)
import :: psb_c_csr_sparse_mat, psb_cspmat_type, psb_desc_type, &
& psb_c_coo_sparse_mat, mld_sml_parms, psb_spk_, psb_ipk_, psb_lpk_
implicit none
type(psb_c_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_c_coo_sparse_mat), intent(inout) :: coo_prol, coo_restr
type(psb_desc_type), intent(inout) :: desc_cprol
type(psb_lcspmat_type), intent(out) :: ac
type(psb_cspmat_type), intent(out) :: ac
integer(psb_ipk_), intent(out) :: info
end subroutine mld_c_spmm_bld_inner
subroutine mld_lc_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_lc_spmm_bld_inner
end interface mld_spmm_bld_inner
type(psb_desc_type), intent(inout), optional :: desc_ax
end subroutine mld_c_ptap
!!$ subroutine mld_c_lc_ptap(a_csr,desc_a,nlaggr,parms,ac,&
!!$ & coo_prol,desc_cprol,coo_restr,info,desc_ax)
!!$ import :: psb_c_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_c_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
!!$ type(psb_desc_type), intent(inout), optional :: desc_ax
!!$ end subroutine mld_c_lc_ptap
!!$ subroutine mld_lc_ptap(a_csr,desc_a,nlaggr,parms,ac,&
!!$ & coo_prol,desc_cprol,coo_restr,info,desc_ax)
!!$ 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
!!$ type(psb_desc_type), intent(inout), optional :: desc_ax
!!$ end subroutine mld_lc_ptap
end interface mld_ptap
contains
@ -320,7 +337,7 @@ contains
!!
!
subroutine mld_c_base_aggregator_build_tprol(ag,parms,ag_data,&
& a,desc_a,ilaggr,nlaggr,op_prol,info)
& a,desc_a,ilaggr,nlaggr,t_prol,info)
use psb_base_mod
implicit none
class(mld_c_base_aggregator_type), target, intent(inout) :: ag
@ -329,7 +346,7 @@ contains
type(psb_cspmat_type), intent(inout) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), allocatable, intent(out) :: ilaggr(:),nlaggr(:)
type(psb_lcspmat_type), intent(out) :: op_prol
type(psb_lcspmat_type), intent(out) :: t_prol
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_) :: err_act
@ -369,17 +386,18 @@ contains
!! in many cases it is the transpose of the prolongator.
!! \param info Return code
!!
subroutine mld_c_base_aggregator_mat_bld(ag,parms,a,desc_a,ilaggr,nlaggr,ac,&
& op_prol,op_restr,info)
subroutine mld_c_base_aggregator_mat_bld(ag,parms,a,desc_a,ilaggr,nlaggr,&
& ac,desc_ac,op_prol,op_restr,t_prol,info)
use psb_base_mod
implicit none
class(mld_c_base_aggregator_type), target, intent(inout) :: ag
type(mld_sml_parms), intent(inout) :: parms
type(psb_cspmat_type), intent(in) :: a
type(psb_desc_type), intent(inout) :: desc_a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(psb_lcspmat_type), intent(inout) :: op_prol
type(psb_lcspmat_type), intent(out) :: ac,op_restr
type(psb_lcspmat_type), intent(inout) :: t_prol
type(psb_cspmat_type), intent(out) :: op_prol, ac,op_restr
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_) :: err_act
character(len=20) :: name='c_base_aggregator_mat_bld'
@ -417,7 +435,7 @@ contains
!! in many cases it is the transpose of the prolongator.
!! \param info Return code
!!
subroutine mld_c_base_aggregator_mat_asb(ag,parms,a,desc_a,ilaggr,nlaggr,&
subroutine mld_c_base_aggregator_mat_asb(ag,parms,a,desc_a,&
& ac,desc_ac, op_prol,op_restr,info)
use psb_base_mod
implicit none
@ -425,8 +443,7 @@ contains
type(mld_sml_parms), intent(inout) :: parms
type(psb_cspmat_type), intent(in) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(psb_lcspmat_type), intent(inout) :: op_prol,ac,op_restr
type(psb_cspmat_type), intent(inout) :: op_prol,ac,op_restr
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_) :: err_act
@ -469,10 +486,9 @@ contains
class(mld_c_base_aggregator_type), target, intent(inout) :: ag
type(psb_desc_type), intent(in), target :: desc_a, desc_ac
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(psb_lcspmat_type), intent(inout) :: op_restr, op_prol
type(psb_cspmat_type), intent(inout) :: op_restr, op_prol
type(psb_clinmap_type), intent(out) :: map
integer(psb_ipk_), intent(out) :: info
type(psb_cspmat_type) :: iop_restr, iop_prol
integer(psb_ipk_) :: err_act
character(len=20) :: name='c_base_aggregator_bld_map'
@ -488,16 +504,8 @@ contains
! This default implementation reuses desc_a/desc_ac through
! pointers in the map structure.
!
call iop_restr%mv_from_l(op_restr)
call iop_prol%mv_from_l(op_prol)
map = psb_linmap(psb_map_aggr_,desc_a,&
& desc_ac,iop_restr,iop_prol,ilaggr,nlaggr)
if (info == psb_success_) call iop_prol%free()
if (info == psb_success_) call iop_restr%free()
if(info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='sp_Free')
goto 9999
end if
& desc_ac,op_restr,op_prol,ilaggr,nlaggr)
call psb_erractionrestore(err_act)
return

@ -93,7 +93,7 @@ module mld_c_dec_aggregator_mod
interface
subroutine mld_c_dec_aggregator_build_tprol(ag,parms,ag_data,&
& a,desc_a,ilaggr,nlaggr,op_prol,info)
& a,desc_a,ilaggr,nlaggr,t_prol,info)
import :: mld_c_dec_aggregator_type, psb_desc_type, psb_cspmat_type, psb_spk_, &
& psb_ipk_, psb_lpk_, psb_lcspmat_type, mld_sml_parms, mld_saggr_data
implicit none
@ -103,14 +103,14 @@ module mld_c_dec_aggregator_mod
type(psb_cspmat_type), intent(inout) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), allocatable, intent(out) :: ilaggr(:),nlaggr(:)
type(psb_lcspmat_type), intent(out) :: op_prol
type(psb_lcspmat_type), intent(out) :: t_prol
integer(psb_ipk_), intent(out) :: info
end subroutine mld_c_dec_aggregator_build_tprol
end interface
interface
subroutine mld_c_dec_aggregator_mat_bld(ag,parms,a,desc_a,ilaggr,nlaggr,ac,&
& op_prol,op_restr,info)
subroutine mld_c_dec_aggregator_mat_bld(ag,parms,a,desc_a,ilaggr,nlaggr,&
& ac,desc_ac,op_prol,op_restr,t_prol,info)
import :: mld_c_dec_aggregator_type, psb_desc_type, psb_cspmat_type, psb_spk_, &
& psb_ipk_, psb_lpk_, psb_lcspmat_type, mld_sml_parms
implicit none
@ -119,14 +119,15 @@ module mld_c_dec_aggregator_mod
type(psb_cspmat_type), intent(in) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(psb_lcspmat_type), intent(inout) :: op_prol
type(psb_lcspmat_type), intent(out) :: ac,op_restr
integer(psb_ipk_), intent(out) :: info
type(psb_lcspmat_type), intent(inout) :: t_prol
type(psb_cspmat_type), intent(out) :: op_prol, ac,op_restr
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
end subroutine mld_c_dec_aggregator_mat_bld
end interface
interface
subroutine mld_c_dec_aggregator_mat_asb(ag,parms,a,desc_a,ilaggr,nlaggr,&
subroutine mld_c_dec_aggregator_mat_asb(ag,parms,a,desc_a,&
& ac,desc_ac,op_prol,op_restr,info)
import :: mld_c_dec_aggregator_type, psb_desc_type, psb_cspmat_type, psb_spk_, &
& psb_ipk_, psb_lpk_, psb_lcspmat_type, mld_sml_parms
@ -135,8 +136,7 @@ module mld_c_dec_aggregator_mod
type(mld_sml_parms), intent(inout) :: parms
type(psb_cspmat_type), intent(in) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(psb_lcspmat_type), intent(inout) :: op_prol,ac,op_restr
type(psb_cspmat_type), intent(inout) :: op_prol,ac,op_restr
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
end subroutine mld_c_dec_aggregator_mat_asb

@ -109,22 +109,23 @@ module mld_c_inner_mod
end interface mld_map_to_tprol
abstract interface
subroutine mld_caggrmat_var_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,info)
subroutine mld_caggrmat_var_bld(a,desc_a,ilaggr,nlaggr,parms,&
& ac,desc_ac,op_prol,op_restr,t_prol,info)
import :: psb_cspmat_type, psb_desc_type, psb_spk_, psb_ipk_, psb_lpk_, psb_lcspmat_type
import :: mld_c_onelev_type, mld_sml_parms
implicit none
type(psb_cspmat_type), intent(in) :: a
type(psb_desc_type), intent(in) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(mld_sml_parms), intent(inout) :: parms
type(psb_lcspmat_type), intent(inout) :: op_prol
type(psb_lcspmat_type), intent(out) :: ac,op_restr
integer(psb_ipk_), intent(out) :: info
type(psb_cspmat_type), intent(in) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(mld_sml_parms), intent(inout) :: parms
type(psb_cspmat_type), intent(inout) :: op_prol,ac,op_restr
type(psb_lcspmat_type), intent(inout) :: t_prol
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
end subroutine mld_caggrmat_var_bld
end interface
procedure(mld_caggrmat_var_bld) :: mld_caggrmat_nosmth_bld, &
& mld_caggrmat_smth_bld, mld_caggrmat_minnrg_bld, &
& mld_caggrmat_biz_bld
& mld_caggrmat_smth_bld, mld_caggrmat_minnrg_bld
end module mld_c_inner_mod

@ -210,7 +210,7 @@ module mld_c_onelev_mod
& c_base_onelev_free_wrk
interface
subroutine mld_c_base_onelev_mat_asb(lv,a,desc_a,ilaggr,nlaggr,op_prol,info)
subroutine mld_c_base_onelev_mat_asb(lv,a,desc_a,ilaggr,nlaggr,t_prol,info)
import :: psb_cspmat_type, psb_desc_type, psb_spk_, psb_ipk_, psb_lcspmat_type, psb_lpk_
import :: mld_c_onelev_type
implicit none
@ -218,7 +218,7 @@ module mld_c_onelev_mod
type(psb_cspmat_type), intent(in) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:),nlaggr(:)
type(psb_lcspmat_type), intent(inout) :: op_prol
type(psb_lcspmat_type), intent(inout) :: t_prol
integer(psb_ipk_), intent(out) :: info
end subroutine mld_c_base_onelev_mat_asb
end interface
@ -488,17 +488,17 @@ contains
end subroutine c_base_onelev_default
subroutine c_base_onelev_bld_tprol(lv,a,desc_a,&
& ilaggr,nlaggr,op_prol,ag_data,info)
& ilaggr,nlaggr,t_prol,ag_data,info)
implicit none
class(mld_c_onelev_type), intent(inout), target :: lv
type(psb_cspmat_type), intent(inout) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), allocatable, intent(out) :: ilaggr(:),nlaggr(:)
type(psb_lcspmat_type), intent(out) :: op_prol
type(psb_lcspmat_type), intent(out) :: t_prol
type(mld_saggr_data), intent(in) :: ag_data
integer(psb_ipk_), intent(out) :: info
call lv%aggr%bld_tprol(lv%parms,ag_data,a,desc_a,ilaggr,nlaggr,op_prol,info)
call lv%aggr%bld_tprol(lv%parms,ag_data,a,desc_a,ilaggr,nlaggr,t_prol,info)
end subroutine c_base_onelev_bld_tprol

@ -63,7 +63,7 @@ module mld_c_symdec_aggregator_mod
interface
subroutine mld_c_symdec_aggregator_build_tprol(ag,parms,ag_data,&
& a,desc_a,ilaggr,nlaggr,op_prol,info)
& a,desc_a,ilaggr,nlaggr,t_prol,info)
import :: mld_c_symdec_aggregator_type, psb_desc_type, psb_cspmat_type, psb_spk_, &
& psb_ipk_, psb_lpk_, psb_lcspmat_type, mld_sml_parms, mld_saggr_data
implicit none
@ -73,7 +73,7 @@ module mld_c_symdec_aggregator_mod
type(psb_cspmat_type), intent(inout) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), allocatable, intent(out) :: ilaggr(:),nlaggr(:)
type(psb_lcspmat_type), intent(out) :: op_prol
type(psb_lcspmat_type), intent(out) :: t_prol
integer(psb_ipk_), intent(out) :: info
end subroutine mld_c_symdec_aggregator_build_tprol
end interface

@ -119,36 +119,53 @@ module mld_d_base_aggregator_mod
end subroutine mld_d_soc_map_bld
end interface
interface mld_spmm_bld_inner
subroutine mld_d_spmm_bld_inner(a_csr,desc_a,nlaggr,parms,ac,&
& coo_prol,desc_cprol,coo_restr,info)
import :: psb_d_csr_sparse_mat, psb_ldspmat_type, psb_desc_type, &
& psb_ld_coo_sparse_mat, mld_dml_parms, psb_dpk_, psb_ipk_, psb_lpk_
interface mld_ptap
subroutine mld_d_ptap(a_csr,desc_a,nlaggr,parms,ac,&
& coo_prol,desc_cprol,coo_restr,info,desc_ax)
import :: psb_d_csr_sparse_mat, psb_dspmat_type, psb_desc_type, &
& psb_d_coo_sparse_mat, mld_dml_parms, psb_dpk_, psb_ipk_, psb_lpk_
implicit none
type(psb_d_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_ld_coo_sparse_mat), intent(inout) :: coo_prol, coo_restr
type(psb_d_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_dspmat_type), intent(out) :: ac
integer(psb_ipk_), intent(out) :: info
end subroutine mld_d_spmm_bld_inner
subroutine mld_ld_spmm_bld_inner(a_csr,desc_a,nlaggr,parms,ac,&
& coo_prol,desc_cprol,coo_restr,info)
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_
implicit none
type(psb_ld_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_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
integer(psb_ipk_), intent(out) :: info
end subroutine mld_ld_spmm_bld_inner
end interface mld_spmm_bld_inner
type(psb_desc_type), intent(inout), optional :: desc_ax
end subroutine mld_d_ptap
!!$ subroutine mld_d_ld_ptap(a_csr,desc_a,nlaggr,parms,ac,&
!!$ & coo_prol,desc_cprol,coo_restr,info,desc_ax)
!!$ import :: psb_d_csr_sparse_mat, psb_ldspmat_type, psb_desc_type, &
!!$ & psb_ld_coo_sparse_mat, mld_dml_parms, psb_dpk_, psb_ipk_, psb_lpk_
!!$ implicit none
!!$ type(psb_d_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_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
!!$ integer(psb_ipk_), intent(out) :: info
!!$ type(psb_desc_type), intent(inout), optional :: desc_ax
!!$ end subroutine mld_d_ld_ptap
!!$ subroutine mld_ld_ptap(a_csr,desc_a,nlaggr,parms,ac,&
!!$ & coo_prol,desc_cprol,coo_restr,info,desc_ax)
!!$ 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_
!!$ implicit none
!!$ type(psb_ld_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_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
!!$ integer(psb_ipk_), intent(out) :: info
!!$ type(psb_desc_type), intent(inout), optional :: desc_ax
!!$ end subroutine mld_ld_ptap
end interface mld_ptap
contains
@ -320,7 +337,7 @@ contains
!!
!
subroutine mld_d_base_aggregator_build_tprol(ag,parms,ag_data,&
& a,desc_a,ilaggr,nlaggr,op_prol,info)
& a,desc_a,ilaggr,nlaggr,t_prol,info)
use psb_base_mod
implicit none
class(mld_d_base_aggregator_type), target, intent(inout) :: ag
@ -329,7 +346,7 @@ contains
type(psb_dspmat_type), intent(inout) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), allocatable, intent(out) :: ilaggr(:),nlaggr(:)
type(psb_ldspmat_type), intent(out) :: op_prol
type(psb_ldspmat_type), intent(out) :: t_prol
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_) :: err_act
@ -369,17 +386,18 @@ contains
!! in many cases it is the transpose of the prolongator.
!! \param info Return code
!!
subroutine mld_d_base_aggregator_mat_bld(ag,parms,a,desc_a,ilaggr,nlaggr,ac,&
& op_prol,op_restr,info)
subroutine mld_d_base_aggregator_mat_bld(ag,parms,a,desc_a,ilaggr,nlaggr,&
& ac,desc_ac,op_prol,op_restr,t_prol,info)
use psb_base_mod
implicit none
class(mld_d_base_aggregator_type), target, intent(inout) :: ag
type(mld_dml_parms), intent(inout) :: parms
type(psb_dspmat_type), intent(in) :: a
type(psb_desc_type), intent(inout) :: desc_a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(psb_ldspmat_type), intent(inout) :: op_prol
type(psb_ldspmat_type), intent(out) :: ac,op_restr
type(psb_ldspmat_type), intent(inout) :: t_prol
type(psb_dspmat_type), intent(out) :: op_prol, ac,op_restr
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_) :: err_act
character(len=20) :: name='d_base_aggregator_mat_bld'
@ -417,7 +435,7 @@ contains
!! in many cases it is the transpose of the prolongator.
!! \param info Return code
!!
subroutine mld_d_base_aggregator_mat_asb(ag,parms,a,desc_a,ilaggr,nlaggr,&
subroutine mld_d_base_aggregator_mat_asb(ag,parms,a,desc_a,&
& ac,desc_ac, op_prol,op_restr,info)
use psb_base_mod
implicit none
@ -425,8 +443,7 @@ contains
type(mld_dml_parms), intent(inout) :: parms
type(psb_dspmat_type), intent(in) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(psb_ldspmat_type), intent(inout) :: op_prol,ac,op_restr
type(psb_dspmat_type), intent(inout) :: op_prol,ac,op_restr
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_) :: err_act
@ -469,10 +486,9 @@ contains
class(mld_d_base_aggregator_type), target, intent(inout) :: ag
type(psb_desc_type), intent(in), target :: desc_a, desc_ac
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(psb_ldspmat_type), intent(inout) :: op_restr, op_prol
type(psb_dspmat_type), intent(inout) :: op_restr, op_prol
type(psb_dlinmap_type), intent(out) :: map
integer(psb_ipk_), intent(out) :: info
type(psb_dspmat_type) :: iop_restr, iop_prol
integer(psb_ipk_) :: err_act
character(len=20) :: name='d_base_aggregator_bld_map'
@ -488,16 +504,8 @@ contains
! This default implementation reuses desc_a/desc_ac through
! pointers in the map structure.
!
call iop_restr%mv_from_l(op_restr)
call iop_prol%mv_from_l(op_prol)
map = psb_linmap(psb_map_aggr_,desc_a,&
& desc_ac,iop_restr,iop_prol,ilaggr,nlaggr)
if (info == psb_success_) call iop_prol%free()
if (info == psb_success_) call iop_restr%free()
if(info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='sp_Free')
goto 9999
end if
& desc_ac,op_restr,op_prol,ilaggr,nlaggr)
call psb_erractionrestore(err_act)
return

@ -93,7 +93,7 @@ module mld_d_dec_aggregator_mod
interface
subroutine mld_d_dec_aggregator_build_tprol(ag,parms,ag_data,&
& a,desc_a,ilaggr,nlaggr,op_prol,info)
& a,desc_a,ilaggr,nlaggr,t_prol,info)
import :: mld_d_dec_aggregator_type, psb_desc_type, psb_dspmat_type, psb_dpk_, &
& psb_ipk_, psb_lpk_, psb_ldspmat_type, mld_dml_parms, mld_daggr_data
implicit none
@ -103,14 +103,14 @@ module mld_d_dec_aggregator_mod
type(psb_dspmat_type), intent(inout) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), allocatable, intent(out) :: ilaggr(:),nlaggr(:)
type(psb_ldspmat_type), intent(out) :: op_prol
type(psb_ldspmat_type), intent(out) :: t_prol
integer(psb_ipk_), intent(out) :: info
end subroutine mld_d_dec_aggregator_build_tprol
end interface
interface
subroutine mld_d_dec_aggregator_mat_bld(ag,parms,a,desc_a,ilaggr,nlaggr,ac,&
& op_prol,op_restr,info)
subroutine mld_d_dec_aggregator_mat_bld(ag,parms,a,desc_a,ilaggr,nlaggr,&
& ac,desc_ac,op_prol,op_restr,t_prol,info)
import :: mld_d_dec_aggregator_type, psb_desc_type, psb_dspmat_type, psb_dpk_, &
& psb_ipk_, psb_lpk_, psb_ldspmat_type, mld_dml_parms
implicit none
@ -119,14 +119,15 @@ module mld_d_dec_aggregator_mod
type(psb_dspmat_type), intent(in) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(psb_ldspmat_type), intent(inout) :: op_prol
type(psb_ldspmat_type), intent(out) :: ac,op_restr
integer(psb_ipk_), intent(out) :: info
type(psb_ldspmat_type), intent(inout) :: t_prol
type(psb_dspmat_type), intent(out) :: op_prol, ac,op_restr
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
end subroutine mld_d_dec_aggregator_mat_bld
end interface
interface
subroutine mld_d_dec_aggregator_mat_asb(ag,parms,a,desc_a,ilaggr,nlaggr,&
subroutine mld_d_dec_aggregator_mat_asb(ag,parms,a,desc_a,&
& ac,desc_ac,op_prol,op_restr,info)
import :: mld_d_dec_aggregator_type, psb_desc_type, psb_dspmat_type, psb_dpk_, &
& psb_ipk_, psb_lpk_, psb_ldspmat_type, mld_dml_parms
@ -135,8 +136,7 @@ module mld_d_dec_aggregator_mod
type(mld_dml_parms), intent(inout) :: parms
type(psb_dspmat_type), intent(in) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(psb_ldspmat_type), intent(inout) :: op_prol,ac,op_restr
type(psb_dspmat_type), intent(inout) :: op_prol,ac,op_restr
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
end subroutine mld_d_dec_aggregator_mat_asb

@ -109,22 +109,23 @@ module mld_d_inner_mod
end interface mld_map_to_tprol
abstract interface
subroutine mld_daggrmat_var_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,info)
subroutine mld_daggrmat_var_bld(a,desc_a,ilaggr,nlaggr,parms,&
& ac,desc_ac,op_prol,op_restr,t_prol,info)
import :: psb_dspmat_type, psb_desc_type, psb_dpk_, psb_ipk_, psb_lpk_, psb_ldspmat_type
import :: mld_d_onelev_type, mld_dml_parms
implicit none
type(psb_dspmat_type), intent(in) :: a
type(psb_desc_type), intent(in) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(mld_dml_parms), intent(inout) :: parms
type(psb_ldspmat_type), intent(inout) :: op_prol
type(psb_ldspmat_type), intent(out) :: ac,op_restr
integer(psb_ipk_), intent(out) :: info
type(psb_dspmat_type), intent(in) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(mld_dml_parms), intent(inout) :: parms
type(psb_dspmat_type), intent(inout) :: op_prol,ac,op_restr
type(psb_ldspmat_type), intent(inout) :: t_prol
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
end subroutine mld_daggrmat_var_bld
end interface
procedure(mld_daggrmat_var_bld) :: mld_daggrmat_nosmth_bld, &
& mld_daggrmat_smth_bld, mld_daggrmat_minnrg_bld, &
& mld_daggrmat_biz_bld
& mld_daggrmat_smth_bld, mld_daggrmat_minnrg_bld
end module mld_d_inner_mod

@ -210,7 +210,7 @@ module mld_d_onelev_mod
& d_base_onelev_free_wrk
interface
subroutine mld_d_base_onelev_mat_asb(lv,a,desc_a,ilaggr,nlaggr,op_prol,info)
subroutine mld_d_base_onelev_mat_asb(lv,a,desc_a,ilaggr,nlaggr,t_prol,info)
import :: psb_dspmat_type, psb_desc_type, psb_dpk_, psb_ipk_, psb_ldspmat_type, psb_lpk_
import :: mld_d_onelev_type
implicit none
@ -218,7 +218,7 @@ module mld_d_onelev_mod
type(psb_dspmat_type), intent(in) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:),nlaggr(:)
type(psb_ldspmat_type), intent(inout) :: op_prol
type(psb_ldspmat_type), intent(inout) :: t_prol
integer(psb_ipk_), intent(out) :: info
end subroutine mld_d_base_onelev_mat_asb
end interface
@ -488,17 +488,17 @@ contains
end subroutine d_base_onelev_default
subroutine d_base_onelev_bld_tprol(lv,a,desc_a,&
& ilaggr,nlaggr,op_prol,ag_data,info)
& ilaggr,nlaggr,t_prol,ag_data,info)
implicit none
class(mld_d_onelev_type), intent(inout), target :: lv
type(psb_dspmat_type), intent(inout) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), allocatable, intent(out) :: ilaggr(:),nlaggr(:)
type(psb_ldspmat_type), intent(out) :: op_prol
type(psb_ldspmat_type), intent(out) :: t_prol
type(mld_daggr_data), intent(in) :: ag_data
integer(psb_ipk_), intent(out) :: info
call lv%aggr%bld_tprol(lv%parms,ag_data,a,desc_a,ilaggr,nlaggr,op_prol,info)
call lv%aggr%bld_tprol(lv%parms,ag_data,a,desc_a,ilaggr,nlaggr,t_prol,info)
end subroutine d_base_onelev_bld_tprol

@ -63,7 +63,7 @@ module mld_d_symdec_aggregator_mod
interface
subroutine mld_d_symdec_aggregator_build_tprol(ag,parms,ag_data,&
& a,desc_a,ilaggr,nlaggr,op_prol,info)
& a,desc_a,ilaggr,nlaggr,t_prol,info)
import :: mld_d_symdec_aggregator_type, psb_desc_type, psb_dspmat_type, psb_dpk_, &
& psb_ipk_, psb_lpk_, psb_ldspmat_type, mld_dml_parms, mld_daggr_data
implicit none
@ -73,7 +73,7 @@ module mld_d_symdec_aggregator_mod
type(psb_dspmat_type), intent(inout) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), allocatable, intent(out) :: ilaggr(:),nlaggr(:)
type(psb_ldspmat_type), intent(out) :: op_prol
type(psb_ldspmat_type), intent(out) :: t_prol
integer(psb_ipk_), intent(out) :: info
end subroutine mld_d_symdec_aggregator_build_tprol
end interface

@ -119,36 +119,53 @@ module mld_s_base_aggregator_mod
end subroutine mld_s_soc_map_bld
end interface
interface mld_spmm_bld_inner
subroutine mld_s_spmm_bld_inner(a_csr,desc_a,nlaggr,parms,ac,&
& coo_prol,desc_cprol,coo_restr,info)
import :: psb_s_csr_sparse_mat, psb_lsspmat_type, psb_desc_type, &
& psb_ls_coo_sparse_mat, mld_sml_parms, psb_spk_, psb_ipk_, psb_lpk_
interface mld_ptap
subroutine mld_s_ptap(a_csr,desc_a,nlaggr,parms,ac,&
& coo_prol,desc_cprol,coo_restr,info,desc_ax)
import :: psb_s_csr_sparse_mat, psb_sspmat_type, psb_desc_type, &
& psb_s_coo_sparse_mat, mld_sml_parms, psb_spk_, psb_ipk_, psb_lpk_
implicit none
type(psb_s_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_s_coo_sparse_mat), intent(inout) :: coo_prol, coo_restr
type(psb_desc_type), intent(inout) :: desc_cprol
type(psb_lsspmat_type), intent(out) :: ac
type(psb_sspmat_type), intent(out) :: ac
integer(psb_ipk_), intent(out) :: info
end subroutine mld_s_spmm_bld_inner
subroutine mld_ls_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_ls_spmm_bld_inner
end interface mld_spmm_bld_inner
type(psb_desc_type), intent(inout), optional :: desc_ax
end subroutine mld_s_ptap
!!$ subroutine mld_s_ls_ptap(a_csr,desc_a,nlaggr,parms,ac,&
!!$ & coo_prol,desc_cprol,coo_restr,info,desc_ax)
!!$ import :: psb_s_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_s_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
!!$ type(psb_desc_type), intent(inout), optional :: desc_ax
!!$ end subroutine mld_s_ls_ptap
!!$ subroutine mld_ls_ptap(a_csr,desc_a,nlaggr,parms,ac,&
!!$ & coo_prol,desc_cprol,coo_restr,info,desc_ax)
!!$ 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
!!$ type(psb_desc_type), intent(inout), optional :: desc_ax
!!$ end subroutine mld_ls_ptap
end interface mld_ptap
contains
@ -320,7 +337,7 @@ contains
!!
!
subroutine mld_s_base_aggregator_build_tprol(ag,parms,ag_data,&
& a,desc_a,ilaggr,nlaggr,op_prol,info)
& a,desc_a,ilaggr,nlaggr,t_prol,info)
use psb_base_mod
implicit none
class(mld_s_base_aggregator_type), target, intent(inout) :: ag
@ -329,7 +346,7 @@ contains
type(psb_sspmat_type), intent(inout) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), allocatable, intent(out) :: ilaggr(:),nlaggr(:)
type(psb_lsspmat_type), intent(out) :: op_prol
type(psb_lsspmat_type), intent(out) :: t_prol
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_) :: err_act
@ -369,17 +386,18 @@ contains
!! in many cases it is the transpose of the prolongator.
!! \param info Return code
!!
subroutine mld_s_base_aggregator_mat_bld(ag,parms,a,desc_a,ilaggr,nlaggr,ac,&
& op_prol,op_restr,info)
subroutine mld_s_base_aggregator_mat_bld(ag,parms,a,desc_a,ilaggr,nlaggr,&
& ac,desc_ac,op_prol,op_restr,t_prol,info)
use psb_base_mod
implicit none
class(mld_s_base_aggregator_type), target, intent(inout) :: ag
type(mld_sml_parms), intent(inout) :: parms
type(psb_sspmat_type), intent(in) :: a
type(psb_desc_type), intent(inout) :: desc_a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(psb_lsspmat_type), intent(inout) :: op_prol
type(psb_lsspmat_type), intent(out) :: ac,op_restr
type(psb_lsspmat_type), intent(inout) :: t_prol
type(psb_sspmat_type), intent(out) :: op_prol, ac,op_restr
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_) :: err_act
character(len=20) :: name='s_base_aggregator_mat_bld'
@ -417,7 +435,7 @@ contains
!! in many cases it is the transpose of the prolongator.
!! \param info Return code
!!
subroutine mld_s_base_aggregator_mat_asb(ag,parms,a,desc_a,ilaggr,nlaggr,&
subroutine mld_s_base_aggregator_mat_asb(ag,parms,a,desc_a,&
& ac,desc_ac, op_prol,op_restr,info)
use psb_base_mod
implicit none
@ -425,8 +443,7 @@ contains
type(mld_sml_parms), intent(inout) :: parms
type(psb_sspmat_type), intent(in) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(psb_lsspmat_type), intent(inout) :: op_prol,ac,op_restr
type(psb_sspmat_type), intent(inout) :: op_prol,ac,op_restr
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_) :: err_act
@ -469,10 +486,9 @@ contains
class(mld_s_base_aggregator_type), target, intent(inout) :: ag
type(psb_desc_type), intent(in), target :: desc_a, desc_ac
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(psb_lsspmat_type), intent(inout) :: op_restr, op_prol
type(psb_sspmat_type), intent(inout) :: op_restr, op_prol
type(psb_slinmap_type), intent(out) :: map
integer(psb_ipk_), intent(out) :: info
type(psb_sspmat_type) :: iop_restr, iop_prol
integer(psb_ipk_) :: err_act
character(len=20) :: name='s_base_aggregator_bld_map'
@ -488,16 +504,8 @@ contains
! This default implementation reuses desc_a/desc_ac through
! pointers in the map structure.
!
call iop_restr%mv_from_l(op_restr)
call iop_prol%mv_from_l(op_prol)
map = psb_linmap(psb_map_aggr_,desc_a,&
& desc_ac,iop_restr,iop_prol,ilaggr,nlaggr)
if (info == psb_success_) call iop_prol%free()
if (info == psb_success_) call iop_restr%free()
if(info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='sp_Free')
goto 9999
end if
& desc_ac,op_restr,op_prol,ilaggr,nlaggr)
call psb_erractionrestore(err_act)
return

@ -93,7 +93,7 @@ module mld_s_dec_aggregator_mod
interface
subroutine mld_s_dec_aggregator_build_tprol(ag,parms,ag_data,&
& a,desc_a,ilaggr,nlaggr,op_prol,info)
& a,desc_a,ilaggr,nlaggr,t_prol,info)
import :: mld_s_dec_aggregator_type, psb_desc_type, psb_sspmat_type, psb_spk_, &
& psb_ipk_, psb_lpk_, psb_lsspmat_type, mld_sml_parms, mld_saggr_data
implicit none
@ -103,14 +103,14 @@ module mld_s_dec_aggregator_mod
type(psb_sspmat_type), intent(inout) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), allocatable, intent(out) :: ilaggr(:),nlaggr(:)
type(psb_lsspmat_type), intent(out) :: op_prol
type(psb_lsspmat_type), intent(out) :: t_prol
integer(psb_ipk_), intent(out) :: info
end subroutine mld_s_dec_aggregator_build_tprol
end interface
interface
subroutine mld_s_dec_aggregator_mat_bld(ag,parms,a,desc_a,ilaggr,nlaggr,ac,&
& op_prol,op_restr,info)
subroutine mld_s_dec_aggregator_mat_bld(ag,parms,a,desc_a,ilaggr,nlaggr,&
& ac,desc_ac,op_prol,op_restr,t_prol,info)
import :: mld_s_dec_aggregator_type, psb_desc_type, psb_sspmat_type, psb_spk_, &
& psb_ipk_, psb_lpk_, psb_lsspmat_type, mld_sml_parms
implicit none
@ -119,14 +119,15 @@ module mld_s_dec_aggregator_mod
type(psb_sspmat_type), intent(in) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(psb_lsspmat_type), intent(inout) :: op_prol
type(psb_lsspmat_type), intent(out) :: ac,op_restr
integer(psb_ipk_), intent(out) :: info
type(psb_lsspmat_type), intent(inout) :: t_prol
type(psb_sspmat_type), intent(out) :: op_prol, ac,op_restr
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
end subroutine mld_s_dec_aggregator_mat_bld
end interface
interface
subroutine mld_s_dec_aggregator_mat_asb(ag,parms,a,desc_a,ilaggr,nlaggr,&
subroutine mld_s_dec_aggregator_mat_asb(ag,parms,a,desc_a,&
& ac,desc_ac,op_prol,op_restr,info)
import :: mld_s_dec_aggregator_type, psb_desc_type, psb_sspmat_type, psb_spk_, &
& psb_ipk_, psb_lpk_, psb_lsspmat_type, mld_sml_parms
@ -135,8 +136,7 @@ module mld_s_dec_aggregator_mod
type(mld_sml_parms), intent(inout) :: parms
type(psb_sspmat_type), intent(in) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(psb_lsspmat_type), intent(inout) :: op_prol,ac,op_restr
type(psb_sspmat_type), intent(inout) :: op_prol,ac,op_restr
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
end subroutine mld_s_dec_aggregator_mat_asb

@ -109,22 +109,23 @@ module mld_s_inner_mod
end interface mld_map_to_tprol
abstract interface
subroutine mld_saggrmat_var_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,info)
subroutine mld_saggrmat_var_bld(a,desc_a,ilaggr,nlaggr,parms,&
& ac,desc_ac,op_prol,op_restr,t_prol,info)
import :: psb_sspmat_type, psb_desc_type, psb_spk_, psb_ipk_, psb_lpk_, psb_lsspmat_type
import :: mld_s_onelev_type, mld_sml_parms
implicit none
type(psb_sspmat_type), intent(in) :: a
type(psb_desc_type), intent(in) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(mld_sml_parms), intent(inout) :: parms
type(psb_lsspmat_type), intent(inout) :: op_prol
type(psb_lsspmat_type), intent(out) :: ac,op_restr
integer(psb_ipk_), intent(out) :: info
type(psb_sspmat_type), intent(in) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(mld_sml_parms), intent(inout) :: parms
type(psb_sspmat_type), intent(inout) :: op_prol,ac,op_restr
type(psb_lsspmat_type), intent(inout) :: t_prol
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
end subroutine mld_saggrmat_var_bld
end interface
procedure(mld_saggrmat_var_bld) :: mld_saggrmat_nosmth_bld, &
& mld_saggrmat_smth_bld, mld_saggrmat_minnrg_bld, &
& mld_saggrmat_biz_bld
& mld_saggrmat_smth_bld, mld_saggrmat_minnrg_bld
end module mld_s_inner_mod

@ -210,7 +210,7 @@ module mld_s_onelev_mod
& s_base_onelev_free_wrk
interface
subroutine mld_s_base_onelev_mat_asb(lv,a,desc_a,ilaggr,nlaggr,op_prol,info)
subroutine mld_s_base_onelev_mat_asb(lv,a,desc_a,ilaggr,nlaggr,t_prol,info)
import :: psb_sspmat_type, psb_desc_type, psb_spk_, psb_ipk_, psb_lsspmat_type, psb_lpk_
import :: mld_s_onelev_type
implicit none
@ -218,7 +218,7 @@ module mld_s_onelev_mod
type(psb_sspmat_type), intent(in) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:),nlaggr(:)
type(psb_lsspmat_type), intent(inout) :: op_prol
type(psb_lsspmat_type), intent(inout) :: t_prol
integer(psb_ipk_), intent(out) :: info
end subroutine mld_s_base_onelev_mat_asb
end interface
@ -488,17 +488,17 @@ contains
end subroutine s_base_onelev_default
subroutine s_base_onelev_bld_tprol(lv,a,desc_a,&
& ilaggr,nlaggr,op_prol,ag_data,info)
& ilaggr,nlaggr,t_prol,ag_data,info)
implicit none
class(mld_s_onelev_type), intent(inout), target :: lv
type(psb_sspmat_type), intent(inout) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), allocatable, intent(out) :: ilaggr(:),nlaggr(:)
type(psb_lsspmat_type), intent(out) :: op_prol
type(psb_lsspmat_type), intent(out) :: t_prol
type(mld_saggr_data), intent(in) :: ag_data
integer(psb_ipk_), intent(out) :: info
call lv%aggr%bld_tprol(lv%parms,ag_data,a,desc_a,ilaggr,nlaggr,op_prol,info)
call lv%aggr%bld_tprol(lv%parms,ag_data,a,desc_a,ilaggr,nlaggr,t_prol,info)
end subroutine s_base_onelev_bld_tprol

@ -63,7 +63,7 @@ module mld_s_symdec_aggregator_mod
interface
subroutine mld_s_symdec_aggregator_build_tprol(ag,parms,ag_data,&
& a,desc_a,ilaggr,nlaggr,op_prol,info)
& a,desc_a,ilaggr,nlaggr,t_prol,info)
import :: mld_s_symdec_aggregator_type, psb_desc_type, psb_sspmat_type, psb_spk_, &
& psb_ipk_, psb_lpk_, psb_lsspmat_type, mld_sml_parms, mld_saggr_data
implicit none
@ -73,7 +73,7 @@ module mld_s_symdec_aggregator_mod
type(psb_sspmat_type), intent(inout) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), allocatable, intent(out) :: ilaggr(:),nlaggr(:)
type(psb_lsspmat_type), intent(out) :: op_prol
type(psb_lsspmat_type), intent(out) :: t_prol
integer(psb_ipk_), intent(out) :: info
end subroutine mld_s_symdec_aggregator_build_tprol
end interface

@ -119,36 +119,53 @@ module mld_z_base_aggregator_mod
end subroutine mld_z_soc_map_bld
end interface
interface mld_spmm_bld_inner
subroutine mld_z_spmm_bld_inner(a_csr,desc_a,nlaggr,parms,ac,&
& coo_prol,desc_cprol,coo_restr,info)
import :: psb_z_csr_sparse_mat, psb_lzspmat_type, psb_desc_type, &
& psb_lz_coo_sparse_mat, mld_dml_parms, psb_dpk_, psb_ipk_, psb_lpk_
interface mld_ptap
subroutine mld_z_ptap(a_csr,desc_a,nlaggr,parms,ac,&
& coo_prol,desc_cprol,coo_restr,info,desc_ax)
import :: psb_z_csr_sparse_mat, psb_zspmat_type, psb_desc_type, &
& psb_z_coo_sparse_mat, mld_dml_parms, psb_dpk_, psb_ipk_, psb_lpk_
implicit none
type(psb_z_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_z_coo_sparse_mat), intent(inout) :: coo_prol, coo_restr
type(psb_desc_type), intent(inout) :: desc_cprol
type(psb_lzspmat_type), intent(out) :: ac
type(psb_zspmat_type), intent(out) :: ac
integer(psb_ipk_), intent(out) :: info
end subroutine mld_z_spmm_bld_inner
subroutine mld_lz_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_lz_spmm_bld_inner
end interface mld_spmm_bld_inner
type(psb_desc_type), intent(inout), optional :: desc_ax
end subroutine mld_z_ptap
!!$ subroutine mld_z_lz_ptap(a_csr,desc_a,nlaggr,parms,ac,&
!!$ & coo_prol,desc_cprol,coo_restr,info,desc_ax)
!!$ import :: psb_z_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_z_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
!!$ type(psb_desc_type), intent(inout), optional :: desc_ax
!!$ end subroutine mld_z_lz_ptap
!!$ subroutine mld_lz_ptap(a_csr,desc_a,nlaggr,parms,ac,&
!!$ & coo_prol,desc_cprol,coo_restr,info,desc_ax)
!!$ 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
!!$ type(psb_desc_type), intent(inout), optional :: desc_ax
!!$ end subroutine mld_lz_ptap
end interface mld_ptap
contains
@ -320,7 +337,7 @@ contains
!!
!
subroutine mld_z_base_aggregator_build_tprol(ag,parms,ag_data,&
& a,desc_a,ilaggr,nlaggr,op_prol,info)
& a,desc_a,ilaggr,nlaggr,t_prol,info)
use psb_base_mod
implicit none
class(mld_z_base_aggregator_type), target, intent(inout) :: ag
@ -329,7 +346,7 @@ contains
type(psb_zspmat_type), intent(inout) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), allocatable, intent(out) :: ilaggr(:),nlaggr(:)
type(psb_lzspmat_type), intent(out) :: op_prol
type(psb_lzspmat_type), intent(out) :: t_prol
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_) :: err_act
@ -369,17 +386,18 @@ contains
!! in many cases it is the transpose of the prolongator.
!! \param info Return code
!!
subroutine mld_z_base_aggregator_mat_bld(ag,parms,a,desc_a,ilaggr,nlaggr,ac,&
& op_prol,op_restr,info)
subroutine mld_z_base_aggregator_mat_bld(ag,parms,a,desc_a,ilaggr,nlaggr,&
& ac,desc_ac,op_prol,op_restr,t_prol,info)
use psb_base_mod
implicit none
class(mld_z_base_aggregator_type), target, intent(inout) :: ag
type(mld_dml_parms), intent(inout) :: parms
type(psb_zspmat_type), intent(in) :: a
type(psb_desc_type), intent(inout) :: desc_a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(psb_lzspmat_type), intent(inout) :: op_prol
type(psb_lzspmat_type), intent(out) :: ac,op_restr
type(psb_lzspmat_type), intent(inout) :: t_prol
type(psb_zspmat_type), intent(out) :: op_prol, ac,op_restr
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_) :: err_act
character(len=20) :: name='z_base_aggregator_mat_bld'
@ -417,7 +435,7 @@ contains
!! in many cases it is the transpose of the prolongator.
!! \param info Return code
!!
subroutine mld_z_base_aggregator_mat_asb(ag,parms,a,desc_a,ilaggr,nlaggr,&
subroutine mld_z_base_aggregator_mat_asb(ag,parms,a,desc_a,&
& ac,desc_ac, op_prol,op_restr,info)
use psb_base_mod
implicit none
@ -425,8 +443,7 @@ contains
type(mld_dml_parms), intent(inout) :: parms
type(psb_zspmat_type), intent(in) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(psb_lzspmat_type), intent(inout) :: op_prol,ac,op_restr
type(psb_zspmat_type), intent(inout) :: op_prol,ac,op_restr
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_) :: err_act
@ -469,10 +486,9 @@ contains
class(mld_z_base_aggregator_type), target, intent(inout) :: ag
type(psb_desc_type), intent(in), target :: desc_a, desc_ac
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(psb_lzspmat_type), intent(inout) :: op_restr, op_prol
type(psb_zspmat_type), intent(inout) :: op_restr, op_prol
type(psb_zlinmap_type), intent(out) :: map
integer(psb_ipk_), intent(out) :: info
type(psb_zspmat_type) :: iop_restr, iop_prol
integer(psb_ipk_) :: err_act
character(len=20) :: name='z_base_aggregator_bld_map'
@ -488,16 +504,8 @@ contains
! This default implementation reuses desc_a/desc_ac through
! pointers in the map structure.
!
call iop_restr%mv_from_l(op_restr)
call iop_prol%mv_from_l(op_prol)
map = psb_linmap(psb_map_aggr_,desc_a,&
& desc_ac,iop_restr,iop_prol,ilaggr,nlaggr)
if (info == psb_success_) call iop_prol%free()
if (info == psb_success_) call iop_restr%free()
if(info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='sp_Free')
goto 9999
end if
& desc_ac,op_restr,op_prol,ilaggr,nlaggr)
call psb_erractionrestore(err_act)
return

@ -93,7 +93,7 @@ module mld_z_dec_aggregator_mod
interface
subroutine mld_z_dec_aggregator_build_tprol(ag,parms,ag_data,&
& a,desc_a,ilaggr,nlaggr,op_prol,info)
& a,desc_a,ilaggr,nlaggr,t_prol,info)
import :: mld_z_dec_aggregator_type, psb_desc_type, psb_zspmat_type, psb_dpk_, &
& psb_ipk_, psb_lpk_, psb_lzspmat_type, mld_dml_parms, mld_daggr_data
implicit none
@ -103,14 +103,14 @@ module mld_z_dec_aggregator_mod
type(psb_zspmat_type), intent(inout) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), allocatable, intent(out) :: ilaggr(:),nlaggr(:)
type(psb_lzspmat_type), intent(out) :: op_prol
type(psb_lzspmat_type), intent(out) :: t_prol
integer(psb_ipk_), intent(out) :: info
end subroutine mld_z_dec_aggregator_build_tprol
end interface
interface
subroutine mld_z_dec_aggregator_mat_bld(ag,parms,a,desc_a,ilaggr,nlaggr,ac,&
& op_prol,op_restr,info)
subroutine mld_z_dec_aggregator_mat_bld(ag,parms,a,desc_a,ilaggr,nlaggr,&
& ac,desc_ac,op_prol,op_restr,t_prol,info)
import :: mld_z_dec_aggregator_type, psb_desc_type, psb_zspmat_type, psb_dpk_, &
& psb_ipk_, psb_lpk_, psb_lzspmat_type, mld_dml_parms
implicit none
@ -119,14 +119,15 @@ module mld_z_dec_aggregator_mod
type(psb_zspmat_type), intent(in) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(psb_lzspmat_type), intent(inout) :: op_prol
type(psb_lzspmat_type), intent(out) :: ac,op_restr
integer(psb_ipk_), intent(out) :: info
type(psb_lzspmat_type), intent(inout) :: t_prol
type(psb_zspmat_type), intent(out) :: op_prol, ac,op_restr
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
end subroutine mld_z_dec_aggregator_mat_bld
end interface
interface
subroutine mld_z_dec_aggregator_mat_asb(ag,parms,a,desc_a,ilaggr,nlaggr,&
subroutine mld_z_dec_aggregator_mat_asb(ag,parms,a,desc_a,&
& ac,desc_ac,op_prol,op_restr,info)
import :: mld_z_dec_aggregator_type, psb_desc_type, psb_zspmat_type, psb_dpk_, &
& psb_ipk_, psb_lpk_, psb_lzspmat_type, mld_dml_parms
@ -135,8 +136,7 @@ module mld_z_dec_aggregator_mod
type(mld_dml_parms), intent(inout) :: parms
type(psb_zspmat_type), intent(in) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(psb_lzspmat_type), intent(inout) :: op_prol,ac,op_restr
type(psb_zspmat_type), intent(inout) :: op_prol,ac,op_restr
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
end subroutine mld_z_dec_aggregator_mat_asb

@ -109,22 +109,23 @@ module mld_z_inner_mod
end interface mld_map_to_tprol
abstract interface
subroutine mld_zaggrmat_var_bld(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,info)
subroutine mld_zaggrmat_var_bld(a,desc_a,ilaggr,nlaggr,parms,&
& ac,desc_ac,op_prol,op_restr,t_prol,info)
import :: psb_zspmat_type, psb_desc_type, psb_dpk_, psb_ipk_, psb_lpk_, psb_lzspmat_type
import :: mld_z_onelev_type, mld_dml_parms
implicit none
type(psb_zspmat_type), intent(in) :: a
type(psb_desc_type), intent(in) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(mld_dml_parms), intent(inout) :: parms
type(psb_lzspmat_type), intent(inout) :: op_prol
type(psb_lzspmat_type), intent(out) :: ac,op_restr
integer(psb_ipk_), intent(out) :: info
type(psb_zspmat_type), intent(in) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
type(mld_dml_parms), intent(inout) :: parms
type(psb_zspmat_type), intent(inout) :: op_prol,ac,op_restr
type(psb_lzspmat_type), intent(inout) :: t_prol
type(psb_desc_type), intent(inout) :: desc_ac
integer(psb_ipk_), intent(out) :: info
end subroutine mld_zaggrmat_var_bld
end interface
procedure(mld_zaggrmat_var_bld) :: mld_zaggrmat_nosmth_bld, &
& mld_zaggrmat_smth_bld, mld_zaggrmat_minnrg_bld, &
& mld_zaggrmat_biz_bld
& mld_zaggrmat_smth_bld, mld_zaggrmat_minnrg_bld
end module mld_z_inner_mod

@ -210,7 +210,7 @@ module mld_z_onelev_mod
& z_base_onelev_free_wrk
interface
subroutine mld_z_base_onelev_mat_asb(lv,a,desc_a,ilaggr,nlaggr,op_prol,info)
subroutine mld_z_base_onelev_mat_asb(lv,a,desc_a,ilaggr,nlaggr,t_prol,info)
import :: psb_zspmat_type, psb_desc_type, psb_dpk_, psb_ipk_, psb_lzspmat_type, psb_lpk_
import :: mld_z_onelev_type
implicit none
@ -218,7 +218,7 @@ module mld_z_onelev_mod
type(psb_zspmat_type), intent(in) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), intent(inout) :: ilaggr(:),nlaggr(:)
type(psb_lzspmat_type), intent(inout) :: op_prol
type(psb_lzspmat_type), intent(inout) :: t_prol
integer(psb_ipk_), intent(out) :: info
end subroutine mld_z_base_onelev_mat_asb
end interface
@ -488,17 +488,17 @@ contains
end subroutine z_base_onelev_default
subroutine z_base_onelev_bld_tprol(lv,a,desc_a,&
& ilaggr,nlaggr,op_prol,ag_data,info)
& ilaggr,nlaggr,t_prol,ag_data,info)
implicit none
class(mld_z_onelev_type), intent(inout), target :: lv
type(psb_zspmat_type), intent(inout) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), allocatable, intent(out) :: ilaggr(:),nlaggr(:)
type(psb_lzspmat_type), intent(out) :: op_prol
type(psb_lzspmat_type), intent(out) :: t_prol
type(mld_daggr_data), intent(in) :: ag_data
integer(psb_ipk_), intent(out) :: info
call lv%aggr%bld_tprol(lv%parms,ag_data,a,desc_a,ilaggr,nlaggr,op_prol,info)
call lv%aggr%bld_tprol(lv%parms,ag_data,a,desc_a,ilaggr,nlaggr,t_prol,info)
end subroutine z_base_onelev_bld_tprol

@ -63,7 +63,7 @@ module mld_z_symdec_aggregator_mod
interface
subroutine mld_z_symdec_aggregator_build_tprol(ag,parms,ag_data,&
& a,desc_a,ilaggr,nlaggr,op_prol,info)
& a,desc_a,ilaggr,nlaggr,t_prol,info)
import :: mld_z_symdec_aggregator_type, psb_desc_type, psb_zspmat_type, psb_dpk_, &
& psb_ipk_, psb_lpk_, psb_lzspmat_type, mld_dml_parms, mld_daggr_data
implicit none
@ -73,7 +73,7 @@ module mld_z_symdec_aggregator_mod
type(psb_zspmat_type), intent(inout) :: a
type(psb_desc_type), intent(inout) :: desc_a
integer(psb_lpk_), allocatable, intent(out) :: ilaggr(:),nlaggr(:)
type(psb_lzspmat_type), intent(out) :: op_prol
type(psb_lzspmat_type), intent(out) :: t_prol
integer(psb_ipk_), intent(out) :: info
end subroutine mld_z_symdec_aggregator_build_tprol
end interface

Loading…
Cancel
Save