mld2p4-2:

tests/fileread/runs/cfs.inp
 tests/fileread/runs/dfs.inp
 tests/fileread/runs/sfs.inp
 tests/fileread/runs/zfs.inp
 tests/pdegen/data_input.f90
 tests/pdegen/mld_d_pde2d.f90
 tests/pdegen/mld_d_pde3d.f90
 tests/pdegen/mld_s_pde2d.f90
 tests/pdegen/mld_s_pde3d.f90
 tests/pdegen/runs/mld_pde2d.inp
 tests/pdegen/runs/mld_pde3d.inp

Fixes for new test programs.
stopcriterion
Salvatore Filippone 8 years ago
parent a29a7f5dcf
commit 1371fe19c0

@ -11,7 +11,7 @@ FCG ! Iterative method: BiCGSTAB BiCG CGS RGMRES BiCGSTA
1 ! ITRACE 1 ! ITRACE
30 ! IRST (restart for RGMRES and BiCGSTABL) 30 ! IRST (restart for RGMRES and BiCGSTABL)
1.d-6 ! EPS 1.d-6 ! EPS
ML-VCYCLE-FBGS-MUMPS ! Longer descriptive name for preconditioner (up to 20 chars) ML-VCYCLE-FBGS-SLU ! Longer descriptive name for preconditioner (up to 20 chars)
ML ! Preconditioner type: NONE JACOBI BJAC AS ML ML ! Preconditioner type: NONE JACOBI BJAC AS ML
VCYCLE ! Type of multilevel correction: ADD MULT VCYCLE ! Type of multilevel correction: ADD MULT
1 ! Number of outer sweeps 1 ! Number of outer sweeps

@ -11,7 +11,7 @@ FCG ! Iterative method: BiCGSTAB BiCG CGS RGMRES BiCGSTA
1 ! ITRACE 1 ! ITRACE
30 ! IRST (restart for RGMRES and BiCGSTABL) 30 ! IRST (restart for RGMRES and BiCGSTABL)
1.d-6 ! EPS 1.d-6 ! EPS
ML-VCYCLE-FBGS-MUMPS ! Longer descriptive name for preconditioner (up to 20 chars) ML-VCYCLE-FBGS-SLUD ! Longer descriptive name for preconditioner (up to 20 chars)
ML ! Preconditioner type: NONE JACOBI BJAC AS ML ML ! Preconditioner type: NONE JACOBI BJAC AS ML
VCYCLE ! Type of multilevel correction: ADD MULT VCYCLE ! Type of multilevel correction: ADD MULT
1 ! Number of outer sweeps 1 ! Number of outer sweeps

@ -11,7 +11,7 @@ FCG ! Iterative method: BiCGSTAB BiCG CGS RGMRES BiCGSTA
1 ! ITRACE 1 ! ITRACE
30 ! IRST (restart for RGMRES and BiCGSTABL) 30 ! IRST (restart for RGMRES and BiCGSTABL)
1.d-6 ! EPS 1.d-6 ! EPS
ML-VCYCLE-FBGS-MUMPS ! Longer descriptive name for preconditioner (up to 20 chars) ML-VCYCLE-FBGS-SLU ! Longer descriptive name for preconditioner (up to 20 chars)
ML ! Preconditioner type: NONE JACOBI BJAC AS ML ML ! Preconditioner type: NONE JACOBI BJAC AS ML
VCYCLE ! Type of multilevel correction: ADD MULT VCYCLE ! Type of multilevel correction: ADD MULT
1 ! Number of outer sweeps 1 ! Number of outer sweeps

@ -11,7 +11,7 @@ FCG ! Iterative method: BiCGSTAB BiCG CGS RGMRES BiCGSTA
1 ! ITRACE 1 ! ITRACE
30 ! IRST (restart for RGMRES and BiCGSTABL) 30 ! IRST (restart for RGMRES and BiCGSTABL)
1.d-6 ! EPS 1.d-6 ! EPS
ML-VCYCLE-FBGS-MUMPS ! Longer descriptive name for preconditioner (up to 20 chars) ML-VCYCLE-FBGS-SLUD ! Longer descriptive name for preconditioner (up to 20 chars)
ML ! Preconditioner type: NONE JACOBI BJAC AS ML ML ! Preconditioner type: NONE JACOBI BJAC AS ML
VCYCLE ! Type of multilevel correction: ADD MULT VCYCLE ! Type of multilevel correction: ADD MULT
1 ! Number of outer sweeps 1 ! Number of outer sweeps

@ -41,10 +41,12 @@ module data_input
use psb_base_mod, only : psb_spk_, psb_dpk_, psb_ipk_ use psb_base_mod, only : psb_spk_, psb_dpk_, psb_ipk_
interface read_data interface read_data
module procedure read_char, read_int,& module procedure read_char, read_int, read_int_array,&
& read_double, read_single, read_logical,& & read_double, read_double_array, &
& string_read_char, string_read_int,& & read_single, read_single_array, read_logical,&
& string_read_double, string_read_single, & & string_read_char, string_read_int, string_read_int_array,&
& string_read_double, string_read_double_array,&
& string_read_single, string_read_single_array, &
& string_read_logical & string_read_logical
end interface read_data end interface read_data
interface trim_string interface trim_string
@ -85,6 +87,17 @@ contains
call read_data(val,charbuf,marker) call read_data(val,charbuf,marker)
end subroutine read_int end subroutine read_int
subroutine read_int_array(val,file,marker)
integer(psb_ipk_), intent(out) :: val(:)
integer(psb_ipk_), intent(in) :: file
character(len=1), optional, intent(in) :: marker
read(file,'(a)')charbuf
call read_data(val,charbuf,marker)
end subroutine read_int_array
subroutine read_single(val,file,marker) subroutine read_single(val,file,marker)
real(psb_spk_), intent(out) :: val real(psb_spk_), intent(out) :: val
integer(psb_ipk_), intent(in) :: file integer(psb_ipk_), intent(in) :: file
@ -94,6 +107,17 @@ contains
call read_data(val,charbuf,marker) call read_data(val,charbuf,marker)
end subroutine read_single end subroutine read_single
subroutine read_single_array(val,file,marker)
real(psb_spk_), intent(out) :: val(:)
integer(psb_ipk_), intent(in) :: file
character(len=1), optional, intent(in) :: marker
read(file,'(a)')charbuf
call read_data(val,charbuf,marker)
end subroutine read_single_array
subroutine read_double(val,file,marker) subroutine read_double(val,file,marker)
real(psb_dpk_), intent(out) :: val real(psb_dpk_), intent(out) :: val
integer(psb_ipk_), intent(in) :: file integer(psb_ipk_), intent(in) :: file
@ -104,6 +128,16 @@ contains
end subroutine read_double end subroutine read_double
subroutine read_double_array(val,file,marker)
real(psb_dpk_), intent(out) :: val(:)
integer(psb_ipk_), intent(in) :: file
character(len=1), optional, intent(in) :: marker
read(file,'(a)')charbuf
call read_data(val,charbuf,marker)
end subroutine read_double_array
subroutine string_read_char(val,file,marker) subroutine string_read_char(val,file,marker)
character(len=*), intent(out) :: val character(len=*), intent(out) :: val
character(len=*), intent(in) :: file character(len=*), intent(in) :: file
@ -142,6 +176,25 @@ contains
read(charbuf(1:idx-1),*) val read(charbuf(1:idx-1),*) val
end subroutine string_read_int end subroutine string_read_int
subroutine string_read_int_array(val,file,marker)
integer(psb_ipk_), intent(out) :: val(:)
character(len=*), intent(in) :: file
character(len=1), optional, intent(in) :: marker
character(len=1) :: marker_
character(len=1024) :: charbuf
integer(psb_ipk_) :: idx
if (present(marker)) then
marker_ = marker
else
marker_ = def_marker
end if
read(file,'(a)')charbuf
charbuf = adjustl(charbuf)
idx=index(charbuf,marker_)
if (idx == 0) idx = len(charbuf)+1
read(charbuf(1:idx-1),*) val(:)
end subroutine string_read_int_array
subroutine string_read_single(val,file,marker) subroutine string_read_single(val,file,marker)
real(psb_spk_), intent(out) :: val real(psb_spk_), intent(out) :: val
character(len=*), intent(in) :: file character(len=*), intent(in) :: file
@ -161,6 +214,25 @@ contains
read(charbuf(1:idx-1),*) val read(charbuf(1:idx-1),*) val
end subroutine string_read_single end subroutine string_read_single
subroutine string_read_single_array(val,file,marker)
real(psb_spk_), intent(out) :: val(:)
character(len=*), intent(in) :: file
character(len=1), optional, intent(in) :: marker
character(len=1) :: marker_
character(len=1024) :: charbuf
integer(psb_ipk_) :: idx
if (present(marker)) then
marker_ = marker
else
marker_ = def_marker
end if
read(file,'(a)')charbuf
charbuf = adjustl(charbuf)
idx=index(charbuf,marker_)
if (idx == 0) idx = len(charbuf)+1
read(charbuf(1:idx-1),*) val(:)
end subroutine string_read_single_array
subroutine string_read_double(val,file,marker) subroutine string_read_double(val,file,marker)
real(psb_dpk_), intent(out) :: val real(psb_dpk_), intent(out) :: val
character(len=*), intent(in) :: file character(len=*), intent(in) :: file
@ -180,6 +252,25 @@ contains
read(charbuf(1:idx-1),*) val read(charbuf(1:idx-1),*) val
end subroutine string_read_double end subroutine string_read_double
subroutine string_read_double_array(val,file,marker)
real(psb_dpk_), intent(out) :: val(:)
character(len=*), intent(in) :: file
character(len=1), optional, intent(in) :: marker
character(len=1) :: marker_
character(len=1024) :: charbuf
integer(psb_ipk_) :: idx
if (present(marker)) then
marker_ = marker
else
marker_ = def_marker
end if
read(file,'(a)')charbuf
charbuf = adjustl(charbuf)
idx=index(charbuf,marker_)
if (idx == 0) idx = len(charbuf)+1
read(charbuf(1:idx-1),*) val(:)
end subroutine string_read_double_array
subroutine string_read_logical(val,file,marker) subroutine string_read_logical(val,file,marker)
logical, intent(out) :: val logical, intent(out) :: val
character(len=*), intent(in) :: file character(len=*), intent(in) :: file

@ -1,4 +1,4 @@
!!!$ !
! !
! MLD2P4 version 2.1 ! MLD2P4 version 2.1
! MultiLevel Domain Decomposition Parallel Preconditioners Package ! MultiLevel Domain Decomposition Parallel Preconditioners Package
@ -135,50 +135,91 @@ program mld_d_pde2d
! descriptor ! descriptor
type(psb_desc_type) :: desc_a type(psb_desc_type) :: desc_a
! dense vectors ! dense vectors
type(psb_d_vect_type) :: x,b type(psb_d_vect_type) :: x,b,r
! parallel environment ! parallel environment
integer(psb_ipk_) :: ictxt, iam, np integer(psb_ipk_) :: ictxt, iam, np
! solver parameters ! solver parameters
integer(psb_ipk_) :: iter, itmax,itrace, istopc, irst, nlv integer(psb_ipk_) :: iter, itmax,itrace, istopc, irst, nlv
integer(psb_long_int_k_) :: amatsize, precsize, descsize integer(psb_long_int_k_) :: amatsize, precsize, descsize
real(psb_dpk_) :: err, eps real(psb_dpk_) :: err, resmx, resmxp
! Krylov solver data
type solverdata
character(len=40) :: kmethd ! Krylov solver
integer(psb_ipk_) :: istopc ! stopping criterion
integer(psb_ipk_) :: itmax ! maximum number of iterations
integer(psb_ipk_) :: itrace ! tracing
integer(psb_ipk_) :: irst ! restart
real(psb_dpk_) :: eps ! stopping tolerance
end type solverdata
type(solverdata) :: s_choice
! preconditioner data
type precdata type precdata
character(len=20) :: descr ! verbose description of the prec
character(len=10) :: prec ! overall prectype ! preconditioner type
character(len=40) :: descr ! verbose description of the prec
character(len=10) :: ptype ! preconditioner type
! general AMG data
character(len=16) :: mltype ! AMG cycle type
integer(psb_ipk_) :: otr_sweeps ! number of AMG cycles
integer(psb_ipk_) :: maxlevs ! maximum number of levels in AMG preconditioner
! AMG aggregation
character(len=16) :: aggrkind ! aggregation type: SMOOTHED, NONSMOOTHED
character(len=16) :: aggr_alg ! parallel aggregation algorithm: DEC, SYMDEC
character(len=16) :: aggr_ord ! ordering for aggregation: NATURAL, DEGREE
character(len=16) :: aggr_filter ! filtering: FILTER, NO_FILTER
real(psb_dpk_) :: mnaggratio ! minimum aggregation ratio
real(psb_dpk_), allocatable :: athresv(:) ! smoothed aggregation threshold vector
integer(psb_ipk_) :: thrvsz ! size of threshold vector
real(psb_dpk_) :: athres ! smoothed aggregation threshold
real(psb_dpk_) :: ascale ! smoothed aggregation scale factor for threshold
character(len=16) :: aggr_omalg ! algorithm for estimating omega parameter
character(len=16) :: aggr_eig ! Eigenvalue estimation procedure
real(psb_dpk_) :: omega_val ! Eigenvalue estimate value
integer(psb_ipk_) :: csize ! minimum size of coarsest matrix
! AMG smoother or pre-smoother; also 1-lev preconditioner
character(len=16) :: smther ! (pre-)smoother type: BJAC, AS
integer(psb_ipk_) :: jsweeps ! (pre-)smoother / 1-lev prec. sweeps
integer(psb_ipk_) :: novr ! number of overlap layers integer(psb_ipk_) :: novr ! number of overlap layers
integer(psb_ipk_) :: jsweeps ! Jacobi/smoother sweeps character(len=16) :: restr ! restriction over application of AS
character(len=16) :: restr ! restriction over application of as character(len=16) :: prol ! prolongation over application of AS
character(len=16) :: prol ! prolongation over application of as character(len=16) :: solve ! local subsolver type: ILU, MILU, ILUT,
character(len=16) :: solve ! Solver type: ILU, SuperLU, UMFPACK. ! UMF, MUMPS, SLU, FWGS, BWGS, JAC
integer(psb_ipk_) :: fill1 ! Fill-in for factorization 1 integer(psb_ipk_) :: fill ! fill-in for incomplete LU factorization
integer(psb_ipk_) :: svsweeps ! Solver sweeps for GS real(psb_dpk_) :: thr ! threshold for ILUT factorization
real(psb_dpk_) :: thr1 ! Threshold for fact. 1 ILU(T)
character(len=16) :: smther ! Smoother ! AMG post-smoother; ignored by 1-lev preconditioner
integer(psb_ipk_) :: maxlevs ! Maximum number of levels in multilevel prec. character(len=16) :: smther2 ! post-smoother type: BJAC, AS
character(len=16) :: aggrprol ! smoothed/raw aggregatin integer(psb_ipk_) :: jsweeps2 ! post-smoother sweeps
character(len=16) :: par_aggr_alg ! decoupled aggregation integer(psb_ipk_) :: novr2 ! number of overlap layers
character(len=16) :: aggr_ord ! Ordering for aggregation character(len=16) :: restr2 ! restriction over application of AS
character(len=16) :: aggr_filter ! Use filtering? character(len=16) :: prol2 ! prolongation over application of AS
character(len=16) :: mltype ! additive or multiplicative 2nd level prec character(len=16) :: solve2 ! local subsolver type: ILU, MILU, ILUT,
character(len=16) :: smthpos ! side: pre, post, both smoothing ! UMF, MUMPS, SLU, FWGS, BWGS, JAC
integer(psb_ipk_) :: csize ! aggregation size at which to stop. integer(psb_ipk_) :: fill2 ! fill-in for incomplete LU factorization
character(len=16) :: cmat ! coarse mat real(psb_dpk_) :: thr2 ! threshold for ILUT factorization
character(len=16) :: csolve ! Coarse solver: bjac, umf, slu, sludist
character(len=16) :: csbsolve ! Coarse subsolver: ILU, ILU(T), SuperLU, UMFPACK. ! coarsest-level solver
integer(psb_ipk_) :: cfill ! Fill-in for factorization 1 character(len=16) :: cmat ! coarsest matrix layout: REPL, DIST
real(psb_dpk_) :: cthres ! Threshold for fact. 1 ILU(T) character(len=16) :: csolve ! coarsest-lev solver: BJAC, SLUDIST (distr.
integer(psb_ipk_) :: cjswp ! Jacobi sweeps ! mat.); UMF, MUMPS, SLU, ILU, ILUT, MILU
real(psb_dpk_) :: athres ! smoother aggregation threshold ! (repl. mat.)
real(psb_dpk_) :: mncrratio ! Minimum aggregation ratio character(len=16) :: csbsolve ! coarsest-lev local subsolver: ILU, ILUT,
! MILU, UMF, MUMPS, SLU
integer(psb_ipk_) :: cfill ! fill-in for incomplete LU factorization
real(psb_dpk_) :: cthres ! threshold for ILUT factorization
integer(psb_ipk_) :: cjswp ! sweeps for GS or JAC coarsest-lev subsolver
end type precdata end type precdata
type(precdata) :: prectype type(precdata) :: p_choice
type(psb_d_coo_sparse_mat) :: acoo
! other variables ! other variables
logical :: dump_prec integer(psb_ipk_) :: info, i, k
character(len=40) :: dump_prefix
integer(psb_ipk_) :: info, i
character(len=20) :: name,ch_err character(len=20) :: name,ch_err
info=psb_success_ info=psb_success_
@ -206,8 +247,7 @@ program mld_d_pde2d
! !
! get parameters ! get parameters
! !
call get_parms(ictxt,kmethd,prectype,afmt,idim,istopc,itmax,itrace,irst,eps,& call get_parms(ictxt,afmt,idim,s_choice,p_choice)
& dump_prec,dump_prefix)
! !
! allocate and fill in the coefficient matrix, rhs and initial guess ! allocate and fill in the coefficient matrix, rhs and initial guess
@ -230,108 +270,136 @@ program mld_d_pde2d
if (iam == psb_root_) & if (iam == psb_root_) &
& write(psb_out_unit,'(" ")') & write(psb_out_unit,'(" ")')
! !
! prepare the preconditioner. ! initialize the preconditioner
! !
if (psb_toupper(prectype%prec) == 'ML') then if (psb_toupper(p_choice%ptype) == 'ML') then
call prec%init(prectype%prec, info) ! multilevel preconditioner
if (prectype%csize>0)& call prec%init(p_choice%ptype,info)
& call prec%set('min_coarse_size', prectype%csize, info)
if (prectype%maxlevs>0)& call prec%set('ml_type', p_choice%mltype, info)
& call prec%set('max_levs', prectype%maxlevs, info) call prec%set('outer_sweeps', p_choice%otr_sweeps,info)
if (prectype%mncrratio>0)& if (p_choice%csize>0)&
& call prec%set('min_cr_ratio', prectype%mncrratio, info) & call prec%set('coarse_aggr_size', p_choice%csize, info)
if (prectype%athres >= dzero) & if (p_choice%mnaggratio>0)&
& call prec%set('aggr_thresh', prectype%athres, info) & call prec%set('min_aggr_ratio', p_choice%mnaggratio, info)
call prec%set('aggr_prol', prectype%aggrprol,info) if (p_choice%maxlevs>0)&
call prec%set('par_aggr_alg', prectype%par_aggr_alg,info) & call prec%set('max_prec_levs', p_choice%maxlevs, info)
call prec%set('aggr_ord', prectype%aggr_ord,info) if (p_choice%ascale > dzero) &
call prec%set('aggr_filter', prectype%aggr_filter, info) & call prec%set('aggr_scale', p_choice%ascale, info)
if (p_choice%athres >= dzero) &
& call prec%set('aggr_thresh', p_choice%athres, info)
if (p_choice%thrvsz>0) then
do k=1,min(p_choice%thrvsz,size(prec%precv)-1)
call prec%set('aggr_thresh', p_choice%athresv(k), info,ilev=(k+1))
end do
end if
call prec%set('aggr_kind', p_choice%aggrkind, info)
call prec%set('aggr_alg', p_choice%aggr_alg, info)
call prec%set('aggr_ord', p_choice%aggr_ord, info)
call prec%set('aggr_filter', p_choice%aggr_filter,info)
call prec%set('aggr_omega_alg', p_choice%aggr_omalg, info)
if (psb_toupper(p_choice%aggr_omalg) == 'EIG_EST') then
call prec%set('aggr_eig', p_choice%aggr_eig, info)
else if (psb_toupper(p_choice%aggr_omalg) == 'USER_CHOICE') then
call prec%set('aggr_omega_val', p_choice%omega_val, info)
end if
call prec%set('coarse_solve', p_choice%csolve, info)
if (psb_toupper(p_choice%csolve) == 'BJAC') &
& call prec%set('coarse_subsolve', p_choice%csbsolve, info)
call prec%set('coarse_mat', p_choice%cmat, info)
call prec%set('coarse_fillin', p_choice%cfill, info)
call prec%set('coarse_iluthrs', p_choice%cthres, info)
call prec%set('coarse_sweeps', p_choice%cjswp, info)
call prec%set('smoother_type', p_choice%smther, info)
call prec%set('smoother_sweeps', p_choice%jsweeps, info)
call prec%set('sub_ovr', p_choice%novr, info)
call prec%set('sub_restr', p_choice%restr, info)
call prec%set('sub_prol', p_choice%prol, info)
call prec%set('sub_solve', p_choice%solve, info)
call prec%set('sub_fillin', p_choice%fill, info)
call prec%set('sub_iluthrs', p_choice%thr, info)
if (psb_toupper(p_choice%smther2) /= 'NONE') then
call prec%set('smoother_type', p_choice%smther2, info,pos='post')
call prec%set('smoother_sweeps', p_choice%jsweeps2, info,pos='post')
call prec%set('sub_ovr', p_choice%novr2, info,pos='post')
call prec%set('sub_restr', p_choice%restr2, info,pos='post')
call prec%set('sub_prol', p_choice%prol2, info,pos='post')
call prec%set('sub_solve', p_choice%solve2, info,pos='post')
call prec%set('sub_fillin', p_choice%fill2, info,pos='post')
call prec%set('sub_iluthrs', p_choice%thr2, info,pos='post')
end if
! build the preconditioner
call psb_barrier(ictxt) call psb_barrier(ictxt)
t1 = psb_wtime() t1 = psb_wtime()
call prec%hierarchy_build(a,desc_a,info) call prec%hierarchy_build(a,desc_a,info)
if(info /= psb_success_) then thier = psb_wtime()-t1
info=psb_err_from_subroutine_ if (info /= psb_success_) then
ch_err='psb_precbld' call psb_errpush(psb_err_from_subroutine_,name,a_err='mld_hierarchy_bld')
call psb_errpush(info,name,a_err=ch_err)
goto 9999 goto 9999
end if end if
thier = psb_wtime()-t1
call prec%set('smoother_type', prectype%smther, info)
call prec%set('smoother_sweeps', prectype%jsweeps, info)
call prec%set('sub_ovr', prectype%novr, info)
call prec%set('sub_restr', prectype%restr, info)
call prec%set('sub_prol', prectype%prol, info)
call prec%set('sub_solve', prectype%solve, info)
call prec%set('sub_fillin', prectype%fill1, info)
call prec%set('solver_sweeps', prectype%svsweeps, info)
call prec%set('sub_iluthrs', prectype%thr1, info)
call prec%set('ml_type', prectype%mltype, info)
call prec%set('smoother_pos', prectype%smthpos, info)
call prec%set('coarse_solve', prectype%csolve, info)
call prec%set('coarse_subsolve', prectype%csbsolve,info)
call prec%set('coarse_mat', prectype%cmat, info)
call prec%set('coarse_fillin', prectype%cfill, info)
call prec%set('coarse_iluthrs', prectype%cthres, info)
call prec%set('coarse_sweeps', prectype%cjswp, info)
call psb_barrier(ictxt) call psb_barrier(ictxt)
t1 = psb_wtime() t1 = psb_wtime()
call prec%smoothers_build(a,desc_a,info) call prec%smoothers_build(a,desc_a,info)
if(info /= psb_success_) then tprec = psb_wtime()-t1
info=psb_err_from_subroutine_ if (info /= psb_success_) then
ch_err='psb_precbld' call psb_errpush(psb_err_from_subroutine_,name,a_err='mld_smoothers_bld')
call psb_errpush(info,name,a_err=ch_err)
goto 9999 goto 9999
end if end if
tprec = psb_wtime()-t1
else else
! 1-level preconditioner
nlv = 1 nlv = 1
call prec%init(prectype%prec, info) call prec%init(p_choice%ptype,info)
call prec%set('smoother_sweeps', prectype%jsweeps, info)
call prec%set('sub_ovr', prectype%novr, info) if (psb_toupper(p_choice%ptype) /= 'NONE') then
call prec%set('sub_restr', prectype%restr, info) call prec%set('smoother_sweeps', p_choice%jsweeps, info)
call prec%set('sub_prol', prectype%prol, info) call prec%set('sub_ovr', p_choice%novr, info)
call prec%set('sub_solve', prectype%solve, info) call prec%set('sub_restr', p_choice%restr, info)
call prec%set('sub_fillin', prectype%fill1, info) call prec%set('sub_prol', p_choice%prol, info)
call prec%set('solver_sweeps', prectype%svsweeps, info) call prec%set('sub_solve', p_choice%solve, info)
call prec%set('sub_iluthrs', prectype%thr1, info) call prec%set('sub_fillin', p_choice%fill, info)
call psb_barrier(ictxt) call prec%set('sub_iluthrs', p_choice%thr, info)
!!! call prec%set('solver_sweeps', p_choice%svsweeps, info)
end if
! build the preconditioner
thier = dzero thier = dzero
t1 = psb_wtime() t1 = psb_wtime()
call prec%build(a,desc_a,info) call prec%build(a,desc_a,info)
if(info /= psb_success_) then tprec = psb_wtime()-t1
info=psb_err_from_subroutine_ if (info /= psb_success_) then
ch_err='psb_precbld' call psb_errpush(psb_err_from_subroutine_,name,a_err='mld_precbld')
call psb_errpush(info,name,a_err=ch_err)
goto 9999 goto 9999
end if end if
tprec = psb_wtime()-t1
end if end if
!!$ call prec%dump(info,prefix='test-ml',ac=.true.,solver=.true.,smoother=.true.) call psb_amx(ictxt, thier)
call psb_amx(ictxt, tprec)
call psb_amx(ictxt,thier) if(iam == psb_root_) then
call psb_amx(ictxt,tprec) write(psb_out_unit,'(" ")')
write(psb_out_unit,'("Preconditioner: ",a)') trim(p_choice%descr)
if (iam == psb_root_) & write(psb_out_unit,'("Preconditioner time: ",es12.5)')thier+tprec
& write(psb_out_unit,'("Preconditioner time : ",es12.5)') tprec+thier write(psb_out_unit,'(" ")')
if (iam == psb_root_) call mld_precdescr(prec,info) end if
if (iam == psb_root_) &
& write(psb_out_unit,'(" ")')
! !
! iterative method parameters ! iterative method parameters
! !
if(iam == psb_root_) &
& write(psb_out_unit,'("Calling iterative method ",a)')kmethd
call psb_barrier(ictxt) call psb_barrier(ictxt)
t1 = psb_wtime() t1 = psb_wtime()
call psb_krylov(kmethd,a,prec,b,x,eps,desc_a,info,& call psb_krylov(s_choice%kmethd,a,prec,b,x,s_choice%eps,&
& itmax=itmax,iter=iter,err=err,itrace=itrace,istop=istopc,irst=irst) & desc_a,info,itmax=s_choice%itmax,iter=iter,err=err,itrace=s_choice%itrace,&
& istop=s_choice%istopc,irst=s_choice%irst)
call psb_barrier(ictxt)
tslv = psb_wtime() - t1
call psb_amx(ictxt,tslv)
if(info /= psb_success_) then if(info /= psb_success_) then
info=psb_err_from_subroutine_ info=psb_err_from_subroutine_
@ -344,33 +412,44 @@ program mld_d_pde2d
tslv = psb_wtime() - t1 tslv = psb_wtime() - t1
call psb_amx(ictxt,tslv) call psb_amx(ictxt,tslv)
! compute residual norms
call psb_geall(r,desc_a,info)
call r%zero()
call psb_geasb(r,desc_a,info)
call psb_geaxpby(done,b,dzero,r,desc_a,info)
call psb_spmm(-done,a,x,done,r,desc_a,info)
resmx = psb_genrm2(r,desc_a,info)
resmxp = psb_geamax(r,desc_a,info)
amatsize = a%sizeof() amatsize = a%sizeof()
descsize = desc_a%sizeof() descsize = desc_a%sizeof()
precsize = prec%sizeof() precsize = prec%sizeof()
call psb_sum(ictxt,amatsize) call psb_sum(ictxt,amatsize)
call psb_sum(ictxt,descsize) call psb_sum(ictxt,descsize)
call psb_sum(ictxt,precsize) call psb_sum(ictxt,precsize)
call prec%descr(info)
if (iam == psb_root_) then if (iam == psb_root_) then
write(psb_out_unit,'(" ")') write(psb_out_unit,'("Computed solution on ",i8," processors")') np
write(psb_out_unit,'("Numer of levels of aggr. hierarchy: ",i12)') prec%get_nlevs() write(psb_out_unit,'("Krylov method : ",a)') trim(s_choice%kmethd)
write(psb_out_unit,'("Time to build aggr. hierarchy : ",es12.5)') thier write(psb_out_unit,'("Preconditioner : ",a)') trim(p_choice%descr)
write(psb_out_unit,'("Time to build smoothers : ",es12.5)') tprec write(psb_out_unit,'("Iterations to convergence : ",i12)') iter
write(psb_out_unit,'("Total preconditioner time : ",es12.5)') tprec+thier write(psb_out_unit,'("Relative error estimate on exit : ",es12.5)') err
write(psb_out_unit,'("Time to solve system : ",es12.5)') tslv write(psb_out_unit,'("Number of levels in hierarchy : ",i12)') prec%get_nlevs()
write(psb_out_unit,'("Time per iteration : ",es12.5)') tslv/iter write(psb_out_unit,'("Time to build hierarchy : ",es12.5)') thier
write(psb_out_unit,'("Number of iterations : ",i0)') iter write(psb_out_unit,'("Time to build smoothers : ",es12.5)') tprec
write(psb_out_unit,'("Convergence indicator on exit : ",es12.5)') err write(psb_out_unit,'("Total time for preconditioner : ",es12.5)') tprec+thier
write(psb_out_unit,'("Info on exit : ",i0)') info write(psb_out_unit,'("Time to solve system : ",es12.5)') tslv
write(psb_out_unit,'("Total memory occupation for A: ",i12)') amatsize write(psb_out_unit,'("Time per iteration : ",es12.5)') tslv/iter
write(psb_out_unit,'("Storage format for A: ",a)') trim(a%get_fmt()) write(psb_out_unit,'("Total time : ",es12.5)') tslv+tprec+thier
write(psb_out_unit,'("Total memory occupation for DESC_A: ",i12)') descsize write(psb_out_unit,'("Residual 2-norm : ",es12.5)') resmx
write(psb_out_unit,'("Storage format for DESC_A: ",a)') trim(desc_a%get_fmt()) write(psb_out_unit,'("Residual inf-norm : ",es12.5)') resmxp
write(psb_out_unit,'("Total memory occupation for PREC: ",i12)') precsize write(psb_out_unit,'("Total memory occupation for A : ",i12)') amatsize
end if write(psb_out_unit,'("Total memory occupation for DESC_A : ",i12)') descsize
write(psb_out_unit,'("Total memory occupation for PREC : ",i12)') precsize
if (dump_prec) call prec%dump(info,prefix=trim(dump_prefix),& write(psb_out_unit,'("Storage format for A : ",a )') a%get_fmt()
& ac=.true.,solver=.true.,smoother=.true.,rp=.true.,global_num=.true.) write(psb_out_unit,'("Storage format for DESC_A : ",a )') desc_a%get_fmt()
end if
! !
! cleanup storage and exit ! cleanup storage and exit
@ -396,114 +475,153 @@ contains
! !
! get iteration parameters from standard input ! get iteration parameters from standard input
! !
subroutine get_parms(ictxt,kmethd,prectype,afmt,idim,istopc,itmax,itrace,irst,eps,& !
& dump_prec,dump_prefix) ! get iteration parameters from standard input
!
subroutine get_parms(icontxt,afmt,idim,solve,prec)
use psb_base_mod
implicit none
integer(psb_ipk_) :: ictxt integer(psb_ipk_) :: icontxt, idim
type(precdata) :: prectype character(len=*) :: afmt
character(len=*) :: kmethd, afmt type(solverdata) :: solve
integer(psb_ipk_) :: idim, istopc,itmax,itrace,irst type(precdata) :: prec
integer(psb_ipk_) :: np, iam, info integer(psb_ipk_) :: iam, nm, np
real(psb_dpk_) :: eps
logical :: dump_prec
character(len=*) :: dump_prefix
character(len=20) :: buffer
call psb_info(ictxt, iam, np) call psb_info(icontxt,iam,np)
if (iam == psb_root_) then if (iam == psb_root_) then
call read_data(kmethd,psb_inp_unit) ! read input data
call read_data(afmt,psb_inp_unit) !
call read_data(idim,psb_inp_unit) call read_data(afmt,psb_inp_unit) ! matrix storage format
call read_data(istopc,psb_inp_unit) call read_data(idim,psb_inp_unit) ! Discretization grid size
call read_data(itmax,psb_inp_unit) ! Krylov solver data
call read_data(itrace,psb_inp_unit) call read_data(solve%kmethd,psb_inp_unit) ! Krylov solver
call read_data(irst,psb_inp_unit) call read_data(solve%istopc,psb_inp_unit) ! stopping criterion
call read_data(eps,psb_inp_unit) call read_data(solve%itmax,psb_inp_unit) ! max num iterations
call read_data(dump_prec,psb_inp_unit) call read_data(solve%itrace,psb_inp_unit) ! tracing
call read_data(dump_prefix,psb_inp_unit) call read_data(solve%irst,psb_inp_unit) ! restart
call read_data(prectype%descr,psb_inp_unit) ! verbose description of the prec call read_data(solve%eps,psb_inp_unit) ! tolerance
call read_data(prectype%prec,psb_inp_unit) ! overall prectype ! preconditioner type
call read_data(prectype%csize,psb_inp_unit) ! coarse size call read_data(prec%descr,psb_inp_unit) ! verbose description of the prec
call read_data(prectype%mncrratio,psb_inp_unit) ! Minimum aggregation ratio call read_data(prec%ptype,psb_inp_unit) ! preconditioner type
call read_data(prectype%athres,psb_inp_unit) ! smoother aggr thresh ! general AMG data
call read_data(prectype%maxlevs,psb_inp_unit) ! Maximum number of levels call read_data(prec%mltype,psb_inp_unit) ! AMG cycle type
call read_data(prectype%aggrprol,psb_inp_unit) ! smoothed/nonsmoothed/minenergy aggregatin call read_data(prec%otr_sweeps,psb_inp_unit) ! number of AMG cycles
call read_data(prectype%par_aggr_alg,psb_inp_unit) ! decoupled or sym. decoupled aggregation call read_data(prec%maxlevs,psb_inp_unit) ! max number of levels in AMG prec
call read_data(prectype%aggr_ord,psb_inp_unit) ! aggregation ordering: natural, node degree call read_data(prec%csize,psb_inp_unit) ! min size coarsest mat
call read_data(prectype%aggr_filter,psb_inp_unit) ! aggregation filtering: filter, no_filter ! aggregation
call read_data(prectype%mltype,psb_inp_unit) ! additive or multiplicative 2nd level prec call read_data(prec%aggrkind,psb_inp_unit) ! aggregation type
call read_data(prectype%smthpos,psb_inp_unit) ! side: pre, post, both smoothing call read_data(prec%aggr_alg,psb_inp_unit) ! parallel aggregation alg
call read_data(prectype%jsweeps,psb_inp_unit) ! Smoother sweeps call read_data(prec%aggr_ord,psb_inp_unit) ! ordering for aggregation
call read_data(prectype%smther,psb_inp_unit) ! Smoother type. call read_data(prec%aggr_filter,psb_inp_unit) ! filtering
call read_data(prectype%novr,psb_inp_unit) ! number of overlap layers call read_data(prec%mnaggratio,psb_inp_unit) ! minimum aggregation ratio
call read_data(prectype%restr,psb_inp_unit) ! restriction over application of as call read_data(prec%thrvsz,psb_inp_unit) ! size of aggr thresh vector
call read_data(prectype%prol,psb_inp_unit) ! prolongation over application of as if (prec%thrvsz > 0) then
call read_data(prectype%solve,psb_inp_unit) ! Subdomain solver: DSCALE ILU MILU ILUT FWGS BWGS MUMPS UMF SLU call psb_realloc(prec%thrvsz,prec%athresv,info)
call read_data(prectype%svsweeps,psb_inp_unit) ! Solver sweeps (GS) call read_data(prec%athresv,psb_inp_unit) ! aggr thresh vector
call read_data(prectype%fill1,psb_inp_unit) ! Fill-in for factorization 1 else
call read_data(prectype%thr1,psb_inp_unit) ! Threshold for fact. 1 ILU(T) read(psb_inp_unit,*) ! dummy read to skip a record
call read_data(prectype%cmat,psb_inp_unit) ! coarse mat end if
call read_data(prectype%csolve,psb_inp_unit) ! Coarse solver: JACOBI BJAC UMF SLU SLUDIST MUMPS call read_data(prec%athres,psb_inp_unit) ! smoothed aggr thresh
call read_data(prectype%csbsolve,psb_inp_unit) ! subsolver: DSCALE GS BWGS ILU UMF SLU SLUDIST MUMPS call read_data(prec%aggr_omalg,psb_inp_unit) ! alg for estimating omega
call read_data(prectype%cfill,psb_inp_unit) ! Fill-in for factorization 1 call read_data(prec%aggr_eig,psb_inp_unit) ! alg for estimating omega
call read_data(prectype%cthres,psb_inp_unit) ! Threshold for fact. 1 ILU(T) call read_data(prec%omega_val,psb_inp_unit) ! alg for estimating omega
call read_data(prectype%cjswp,psb_inp_unit) ! Jacobi sweeps ! AMG smoother (or pre-smoother) / 1-lev preconditioner
call read_data(prec%smther,psb_inp_unit) ! smoother type
call read_data(prec%jsweeps,psb_inp_unit) ! (pre-)smoother / 1-lev prec sweeps
call read_data(prec%novr,psb_inp_unit) ! number of overlap layers
call read_data(prec%restr,psb_inp_unit) ! restriction over application of AS
call read_data(prec%prol,psb_inp_unit) ! prolongation over application of AS
call read_data(prec%solve,psb_inp_unit) ! local subsolver
call read_data(prec%fill,psb_inp_unit) ! fill-in for incomplete LU
call read_data(prec%thr,psb_inp_unit) ! threshold for ILUT
! AMG post-smoother
call read_data(prec%smther2,psb_inp_unit) ! smoother type
call read_data(prec%jsweeps2,psb_inp_unit) ! (post-)smoother sweeps
call read_data(prec%novr2,psb_inp_unit) ! number of overlap layers
call read_data(prec%restr2,psb_inp_unit) ! restriction over application of AS
call read_data(prec%prol2,psb_inp_unit) ! prolongation over application of AS
call read_data(prec%solve2,psb_inp_unit) ! local subsolver
call read_data(prec%fill2,psb_inp_unit) ! fill-in for incomplete LU
call read_data(prec%thr2,psb_inp_unit) ! threshold for ILUT
! coasest-level solver
call read_data(prec%csolve,psb_inp_unit) ! coarsest-lev solver
call read_data(prec%cmat,psb_inp_unit) ! coarsest mat layout
call read_data(prec%csbsolve,psb_inp_unit) ! coarsest-lev subsolver
call read_data(prec%cfill,psb_inp_unit) ! fill-in for incompl LU
call read_data(prec%cthres,psb_inp_unit) ! Threshold for ILUT
call read_data(prec%cjswp,psb_inp_unit) ! sweeps for GS/JAC subsolver
end if end if
! broadcast parameters to all processors call psb_bcast(icontxt,afmt)
call psb_bcast(ictxt,kmethd) call psb_bcast(icontxt,idim)
call psb_bcast(ictxt,afmt)
call psb_bcast(ictxt,idim) call psb_bcast(icontxt,solve%kmethd)
call psb_bcast(ictxt,istopc) call psb_bcast(icontxt,solve%istopc)
call psb_bcast(ictxt,itmax) call psb_bcast(icontxt,solve%itmax)
call psb_bcast(ictxt,itrace) call psb_bcast(icontxt,solve%itrace)
call psb_bcast(ictxt,irst) call psb_bcast(icontxt,solve%irst)
call psb_bcast(ictxt,eps) call psb_bcast(icontxt,solve%eps)
call psb_bcast(ictxt,dump_prec)
call psb_bcast(ictxt,dump_prefix) call psb_bcast(icontxt,prec%descr)
call psb_bcast(ictxt,prectype%descr) ! verbose description of the prec call psb_bcast(icontxt,prec%ptype)
call psb_bcast(ictxt,prectype%prec) ! overall prectype
call psb_bcast(ictxt,prectype%csize) ! coarse size ! broadcast first (pre-)smoother / 1-lev prec data
call psb_bcast(ictxt,prectype%mncrratio) ! Minimum aggregation ratio call psb_bcast(icontxt,prec%smther) ! actually not needed for 1-lev precs
call psb_bcast(ictxt,prectype%athres) ! smoother aggr thresh call psb_bcast(icontxt,prec%jsweeps)
call psb_bcast(ictxt,prectype%maxlevs) ! Maximum number of levels call psb_bcast(icontxt,prec%novr)
call psb_bcast(ictxt,prectype%aggrprol) ! smoothed/nonsmoothed/minenergy aggregatin call psb_bcast(icontxt,prec%restr)
call psb_bcast(ictxt,prectype%par_aggr_alg) ! decoupled or sym. decoupled aggregation call psb_bcast(icontxt,prec%prol)
call psb_bcast(ictxt,prectype%aggr_ord) ! aggregation ordering: natural, node degree call psb_bcast(icontxt,prec%solve)
call psb_bcast(ictxt,prectype%aggr_filter) ! aggregation filtering: filter, no_filter call psb_bcast(icontxt,prec%fill)
call psb_bcast(ictxt,prectype%mltype) ! additive or multiplicative 2nd level prec call psb_bcast(icontxt,prec%thr)
call psb_bcast(ictxt,prectype%smthpos) ! side: pre, post, both smoothing
call psb_bcast(ictxt,prectype%jsweeps) ! Smoother sweeps ! broadcast (other) AMG parameters
call psb_bcast(ictxt,prectype%smther) ! Smoother type. if (psb_toupper(prec%ptype) == 'ML') then
call psb_bcast(ictxt,prectype%novr) ! number of overlap layers
call psb_bcast(ictxt,prectype%restr) ! restriction over application of as call psb_bcast(icontxt,prec%mltype)
call psb_bcast(ictxt,prectype%prol) ! prolongation over application of as call psb_bcast(icontxt,prec%otr_sweeps)
call psb_bcast(ictxt,prectype%solve) ! Subdomain solver: DSCALE ILU MILU ILUT FWGS BWGS MUMPS UMF SLU call psb_bcast(icontxt,prec%maxlevs)
call psb_bcast(ictxt,prectype%svsweeps) ! Solver sweeps (GS)
call psb_bcast(ictxt,prectype%fill1) ! Fill-in for factorization 1 call psb_bcast(icontxt,prec%smther2)
call psb_bcast(ictxt,prectype%thr1) ! Threshold for fact. 1 ILU(T) call psb_bcast(icontxt,prec%jsweeps2)
call psb_bcast(ictxt,prectype%cmat) ! coarse mat call psb_bcast(icontxt,prec%novr2)
call psb_bcast(ictxt,prectype%csolve) ! Coarse solver: JACOBI BJAC UMF SLU SLUDIST MUMPS call psb_bcast(icontxt,prec%restr2)
call psb_bcast(ictxt,prectype%csbsolve) ! subsolver: DSCALE GS BWGS ILU UMF SLU SLUDIST MUMPS call psb_bcast(icontxt,prec%prol2)
call psb_bcast(ictxt,prectype%cfill) ! Fill-in for factorization 1 call psb_bcast(icontxt,prec%solve2)
call psb_bcast(ictxt,prectype%cthres) ! Threshold for fact. 1 ILU(T) call psb_bcast(icontxt,prec%fill2)
call psb_bcast(ictxt,prectype%cjswp) ! Jacobi sweeps call psb_bcast(icontxt,prec%thr2)
call psb_bcast(icontxt,prec%aggrkind)
call psb_bcast(icontxt,prec%aggr_alg)
call psb_bcast(icontxt,prec%aggr_ord)
call psb_bcast(icontxt,prec%aggr_filter)
call psb_bcast(icontxt,prec%mnaggratio)
call psb_bcast(ictxt,prec%thrvsz)
if (prec%thrvsz > 0) then
if (iam /= psb_root_) call psb_realloc(prec%thrvsz,prec%athresv,info)
call psb_bcast(ictxt,prec%athresv)
end if
call psb_bcast(ictxt,prec%athres)
call psb_bcast(ictxt,prec%ascale)
call psb_bcast(ictxt,prec%aggr_omalg)
call psb_bcast(ictxt,prec%aggr_eig)
call psb_bcast(ictxt,prec%omega_val)
call psb_bcast(icontxt,prec%csize)
call psb_bcast(icontxt,prec%cmat)
call psb_bcast(icontxt,prec%csolve)
call psb_bcast(icontxt,prec%csbsolve)
call psb_bcast(icontxt,prec%cfill)
call psb_bcast(icontxt,prec%cthres)
call psb_bcast(icontxt,prec%cjswp)
end if
if (iam == psb_root_) then
write(psb_out_unit,'("Solving matrix : ell1")')
write(psb_out_unit,'("Grid dimensions : ",i4,"x",i4)')idim,idim
write(psb_out_unit,'("Number of processors : ",i0)') np
write(psb_out_unit,'("Data distribution : BLOCK")')
write(psb_out_unit,'("Preconditioner : ",a)') prectype%descr
write(psb_out_unit,'("Iterative method : ",a)') kmethd
write(psb_out_unit,'(" ")')
endif
return
end subroutine get_parms end subroutine get_parms
! !
! print an error message ! print an error message
! !

@ -1,4 +1,5 @@
! !
!
! MLD2P4 version 2.1 ! MLD2P4 version 2.1
! MultiLevel Domain Decomposition Parallel Preconditioners Package ! MultiLevel Domain Decomposition Parallel Preconditioners Package
! based on PSBLAS (Parallel Sparse BLAS version 3.5) ! based on PSBLAS (Parallel Sparse BLAS version 3.5)
@ -146,50 +147,91 @@ program mld_d_pde3d
! descriptor ! descriptor
type(psb_desc_type) :: desc_a type(psb_desc_type) :: desc_a
! dense vectors ! dense vectors
type(psb_d_vect_type) :: x,b type(psb_d_vect_type) :: x,b,r
! parallel environment ! parallel environment
integer(psb_ipk_) :: ictxt, iam, np integer(psb_ipk_) :: ictxt, iam, np
! solver parameters ! solver parameters
integer(psb_ipk_) :: iter, itmax,itrace, istopc, irst, nlv integer(psb_ipk_) :: iter, itmax,itrace, istopc, irst, nlv
integer(psb_long_int_k_) :: amatsize, precsize, descsize integer(psb_long_int_k_) :: amatsize, precsize, descsize
real(psb_dpk_) :: err, eps real(psb_dpk_) :: err, resmx, resmxp
! Krylov solver data
type solverdata
character(len=40) :: kmethd ! Krylov solver
integer(psb_ipk_) :: istopc ! stopping criterion
integer(psb_ipk_) :: itmax ! maximum number of iterations
integer(psb_ipk_) :: itrace ! tracing
integer(psb_ipk_) :: irst ! restart
real(psb_dpk_) :: eps ! stopping tolerance
end type solverdata
type(solverdata) :: s_choice
! preconditioner data
type precdata type precdata
character(len=20) :: descr ! verbose description of the prec
character(len=10) :: prec ! overall prectype ! preconditioner type
character(len=40) :: descr ! verbose description of the prec
character(len=10) :: ptype ! preconditioner type
! general AMG data
character(len=16) :: mltype ! AMG cycle type
integer(psb_ipk_) :: otr_sweeps ! number of AMG cycles
integer(psb_ipk_) :: maxlevs ! maximum number of levels in AMG preconditioner
! AMG aggregation
character(len=16) :: aggrkind ! aggregation type: SMOOTHED, NONSMOOTHED
character(len=16) :: aggr_alg ! parallel aggregation algorithm: DEC, SYMDEC
character(len=16) :: aggr_ord ! ordering for aggregation: NATURAL, DEGREE
character(len=16) :: aggr_filter ! filtering: FILTER, NO_FILTER
real(psb_dpk_) :: mnaggratio ! minimum aggregation ratio
real(psb_dpk_), allocatable :: athresv(:) ! smoothed aggregation threshold vector
integer(psb_ipk_) :: thrvsz ! size of threshold vector
real(psb_dpk_) :: athres ! smoothed aggregation threshold
real(psb_dpk_) :: ascale ! smoothed aggregation scale factor for threshold
character(len=16) :: aggr_omalg ! algorithm for estimating omega parameter
character(len=16) :: aggr_eig ! Eigenvalue estimation procedure
real(psb_dpk_) :: omega_val ! Eigenvalue estimate value
integer(psb_ipk_) :: csize ! minimum size of coarsest matrix
! AMG smoother or pre-smoother; also 1-lev preconditioner
character(len=16) :: smther ! (pre-)smoother type: BJAC, AS
integer(psb_ipk_) :: jsweeps ! (pre-)smoother / 1-lev prec. sweeps
integer(psb_ipk_) :: novr ! number of overlap layers integer(psb_ipk_) :: novr ! number of overlap layers
integer(psb_ipk_) :: jsweeps ! Jacobi/smoother sweeps character(len=16) :: restr ! restriction over application of AS
character(len=16) :: restr ! restriction over application of as character(len=16) :: prol ! prolongation over application of AS
character(len=16) :: prol ! prolongation over application of as character(len=16) :: solve ! local subsolver type: ILU, MILU, ILUT,
character(len=16) :: solve ! Solver type: ILU, SuperLU, UMFPACK. ! UMF, MUMPS, SLU, FWGS, BWGS, JAC
integer(psb_ipk_) :: fill1 ! Fill-in for factorization 1 integer(psb_ipk_) :: fill ! fill-in for incomplete LU factorization
integer(psb_ipk_) :: svsweeps ! Solver sweeps for GS real(psb_dpk_) :: thr ! threshold for ILUT factorization
real(psb_dpk_) :: thr1 ! Threshold for fact. 1 ILU(T)
character(len=16) :: smther ! Smoother ! AMG post-smoother; ignored by 1-lev preconditioner
integer(psb_ipk_) :: maxlevs ! Maximum number of levels in multilevel prec. character(len=16) :: smther2 ! post-smoother type: BJAC, AS
character(len=16) :: aggrprol ! smoothed/raw aggregatin integer(psb_ipk_) :: jsweeps2 ! post-smoother sweeps
character(len=16) :: par_aggr_alg ! decoupled aggregation integer(psb_ipk_) :: novr2 ! number of overlap layers
character(len=16) :: aggr_ord ! Ordering for aggregation character(len=16) :: restr2 ! restriction over application of AS
character(len=16) :: aggr_filter ! Use filtering? character(len=16) :: prol2 ! prolongation over application of AS
character(len=16) :: mltype ! additive or multiplicative 2nd level prec character(len=16) :: solve2 ! local subsolver type: ILU, MILU, ILUT,
character(len=16) :: smthpos ! side: pre, post, both smoothing ! UMF, MUMPS, SLU, FWGS, BWGS, JAC
integer(psb_ipk_) :: csize ! aggregation size at which to stop. integer(psb_ipk_) :: fill2 ! fill-in for incomplete LU factorization
character(len=16) :: cmat ! coarse mat real(psb_dpk_) :: thr2 ! threshold for ILUT factorization
character(len=16) :: csolve ! Coarse solver: bjac, umf, slu, sludist
character(len=16) :: csbsolve ! Coarse subsolver: ILU, ILU(T), SuperLU, UMFPACK. ! coarsest-level solver
integer(psb_ipk_) :: cfill ! Fill-in for factorization 1 character(len=16) :: cmat ! coarsest matrix layout: REPL, DIST
real(psb_dpk_) :: cthres ! Threshold for fact. 1 ILU(T) character(len=16) :: csolve ! coarsest-lev solver: BJAC, SLUDIST (distr.
integer(psb_ipk_) :: cjswp ! Jacobi sweeps ! mat.); UMF, MUMPS, SLU, ILU, ILUT, MILU
real(psb_dpk_) :: athres ! smoother aggregation threshold ! (repl. mat.)
real(psb_dpk_) :: mncrratio ! Minimum aggregation ratio character(len=16) :: csbsolve ! coarsest-lev local subsolver: ILU, ILUT,
! MILU, UMF, MUMPS, SLU
integer(psb_ipk_) :: cfill ! fill-in for incomplete LU factorization
real(psb_dpk_) :: cthres ! threshold for ILUT factorization
integer(psb_ipk_) :: cjswp ! sweeps for GS or JAC coarsest-lev subsolver
end type precdata end type precdata
type(precdata) :: prectype type(precdata) :: p_choice
type(psb_d_coo_sparse_mat) :: acoo
! other variables ! other variables
logical :: dump_prec integer(psb_ipk_) :: info, i, k
character(len=40) :: dump_prefix
integer(psb_ipk_) :: info, i
character(len=20) :: name,ch_err character(len=20) :: name,ch_err
info=psb_success_ info=psb_success_
@ -217,8 +259,7 @@ program mld_d_pde3d
! !
! get parameters ! get parameters
! !
call get_parms(ictxt,kmethd,prectype,afmt,idim,istopc,itmax,itrace,irst,eps,& call get_parms(ictxt,afmt,idim,s_choice,p_choice)
&dump_prec,dump_prefix)
! !
! allocate and fill in the coefficient matrix, rhs and initial guess ! allocate and fill in the coefficient matrix, rhs and initial guess
@ -232,7 +273,7 @@ program mld_d_pde3d
t2 = psb_wtime() - t1 t2 = psb_wtime() - t1
if(info /= psb_success_) then if(info /= psb_success_) then
info=psb_err_from_subroutine_ info=psb_err_from_subroutine_
ch_err='create_matrix' ch_err='psb_gen_pdeed'
call psb_errpush(info,name,a_err=ch_err) call psb_errpush(info,name,a_err=ch_err)
goto 9999 goto 9999
end if end if
@ -242,108 +283,136 @@ program mld_d_pde3d
if (iam == psb_root_) & if (iam == psb_root_) &
& write(psb_out_unit,'(" ")') & write(psb_out_unit,'(" ")')
! !
! prepare the preconditioner. ! initialize the preconditioner
! !
if (psb_toupper(prectype%prec) == 'ML') then if (psb_toupper(p_choice%ptype) == 'ML') then
call prec%init(prectype%prec, info) ! multilevel preconditioner
if (prectype%csize>0)& call prec%init(p_choice%ptype,info)
& call prec%set('min_coarse_size', prectype%csize, info)
if (prectype%maxlevs>0)& call prec%set('ml_type', p_choice%mltype, info)
& call prec%set('max_levs', prectype%maxlevs, info) call prec%set('outer_sweeps', p_choice%otr_sweeps,info)
if (prectype%mncrratio>0)& if (p_choice%csize>0)&
& call prec%set('min_cr_ratio', prectype%mncrratio, info) & call prec%set('coarse_aggr_size', p_choice%csize, info)
if (prectype%athres >= dzero) & if (p_choice%mnaggratio>0)&
& call prec%set('aggr_thresh', prectype%athres, info) & call prec%set('min_aggr_ratio', p_choice%mnaggratio, info)
call prec%set('aggr_prol', prectype%aggrprol,info) if (p_choice%maxlevs>0)&
call prec%set('par_aggr_alg', prectype%par_aggr_alg,info) & call prec%set('max_prec_levs', p_choice%maxlevs, info)
call prec%set('aggr_ord', prectype%aggr_ord,info) if (p_choice%ascale > dzero) &
call prec%set('aggr_filter', prectype%aggr_filter, info) & call prec%set('aggr_scale', p_choice%ascale, info)
if (p_choice%athres >= dzero) &
& call prec%set('aggr_thresh', p_choice%athres, info)
if (p_choice%thrvsz>0) then
do k=1,min(p_choice%thrvsz,size(prec%precv)-1)
call prec%set('aggr_thresh', p_choice%athresv(k), info,ilev=(k+1))
end do
end if
call prec%set('aggr_kind', p_choice%aggrkind, info)
call prec%set('aggr_alg', p_choice%aggr_alg, info)
call prec%set('aggr_ord', p_choice%aggr_ord, info)
call prec%set('aggr_filter', p_choice%aggr_filter,info)
call prec%set('aggr_omega_alg', p_choice%aggr_omalg, info)
if (psb_toupper(p_choice%aggr_omalg) == 'EIG_EST') then
call prec%set('aggr_eig', p_choice%aggr_eig, info)
else if (psb_toupper(p_choice%aggr_omalg) == 'USER_CHOICE') then
call prec%set('aggr_omega_val', p_choice%omega_val, info)
end if
call prec%set('coarse_solve', p_choice%csolve, info)
if (psb_toupper(p_choice%csolve) == 'BJAC') &
& call prec%set('coarse_subsolve', p_choice%csbsolve, info)
call prec%set('coarse_mat', p_choice%cmat, info)
call prec%set('coarse_fillin', p_choice%cfill, info)
call prec%set('coarse_iluthrs', p_choice%cthres, info)
call prec%set('coarse_sweeps', p_choice%cjswp, info)
call prec%set('smoother_type', p_choice%smther, info)
call prec%set('smoother_sweeps', p_choice%jsweeps, info)
call prec%set('sub_ovr', p_choice%novr, info)
call prec%set('sub_restr', p_choice%restr, info)
call prec%set('sub_prol', p_choice%prol, info)
call prec%set('sub_solve', p_choice%solve, info)
call prec%set('sub_fillin', p_choice%fill, info)
call prec%set('sub_iluthrs', p_choice%thr, info)
if (psb_toupper(p_choice%smther2) /= 'NONE') then
call prec%set('smoother_type', p_choice%smther2, info,pos='post')
call prec%set('smoother_sweeps', p_choice%jsweeps2, info,pos='post')
call prec%set('sub_ovr', p_choice%novr2, info,pos='post')
call prec%set('sub_restr', p_choice%restr2, info,pos='post')
call prec%set('sub_prol', p_choice%prol2, info,pos='post')
call prec%set('sub_solve', p_choice%solve2, info,pos='post')
call prec%set('sub_fillin', p_choice%fill2, info,pos='post')
call prec%set('sub_iluthrs', p_choice%thr2, info,pos='post')
end if
! build the preconditioner
call psb_barrier(ictxt) call psb_barrier(ictxt)
t1 = psb_wtime() t1 = psb_wtime()
call prec%hierarchy_build(a,desc_a,info) call prec%hierarchy_build(a,desc_a,info)
if(info /= psb_success_) then thier = psb_wtime()-t1
info=psb_err_from_subroutine_ if (info /= psb_success_) then
ch_err='psb_precbld' call psb_errpush(psb_err_from_subroutine_,name,a_err='mld_hierarchy_bld')
call psb_errpush(info,name,a_err=ch_err)
goto 9999 goto 9999
end if end if
thier = psb_wtime()-t1
call prec%set('smoother_type', prectype%smther, info)
call prec%set('smoother_sweeps', prectype%jsweeps, info)
call prec%set('sub_ovr', prectype%novr, info)
call prec%set('sub_restr', prectype%restr, info)
call prec%set('sub_prol', prectype%prol, info)
call prec%set('sub_solve', prectype%solve, info)
call prec%set('sub_fillin', prectype%fill1, info)
call prec%set('solver_sweeps', prectype%svsweeps, info)
call prec%set('sub_iluthrs', prectype%thr1, info)
call prec%set('ml_type', prectype%mltype, info)
call prec%set('smoother_pos', prectype%smthpos, info)
call prec%set('coarse_solve', prectype%csolve, info)
call prec%set('coarse_subsolve', prectype%csbsolve,info)
call prec%set('coarse_mat', prectype%cmat, info)
call prec%set('coarse_fillin', prectype%cfill, info)
call prec%set('coarse_iluthrs', prectype%cthres, info)
call prec%set('coarse_sweeps', prectype%cjswp, info)
call psb_barrier(ictxt) call psb_barrier(ictxt)
t1 = psb_wtime() t1 = psb_wtime()
call prec%smoothers_build(a,desc_a,info) call prec%smoothers_build(a,desc_a,info)
if(info /= psb_success_) then tprec = psb_wtime()-t1
info=psb_err_from_subroutine_ if (info /= psb_success_) then
ch_err='psb_precbld' call psb_errpush(psb_err_from_subroutine_,name,a_err='mld_smoothers_bld')
call psb_errpush(info,name,a_err=ch_err)
goto 9999 goto 9999
end if end if
tprec = psb_wtime()-t1
else else
! 1-level preconditioner
nlv = 1 nlv = 1
call prec%init(prectype%prec, info) call prec%init(p_choice%ptype,info)
call prec%set('smoother_sweeps', prectype%jsweeps, info)
call prec%set('sub_ovr', prectype%novr, info) if (psb_toupper(p_choice%ptype) /= 'NONE') then
call prec%set('sub_restr', prectype%restr, info) call prec%set('smoother_sweeps', p_choice%jsweeps, info)
call prec%set('sub_prol', prectype%prol, info) call prec%set('sub_ovr', p_choice%novr, info)
call prec%set('sub_solve', prectype%solve, info) call prec%set('sub_restr', p_choice%restr, info)
call prec%set('sub_fillin', prectype%fill1, info) call prec%set('sub_prol', p_choice%prol, info)
call prec%set('solver_sweeps', prectype%svsweeps, info) call prec%set('sub_solve', p_choice%solve, info)
call prec%set('sub_iluthrs', prectype%thr1, info) call prec%set('sub_fillin', p_choice%fill, info)
call psb_barrier(ictxt) call prec%set('sub_iluthrs', p_choice%thr, info)
!!! call prec%set('solver_sweeps', p_choice%svsweeps, info)
end if
! build the preconditioner
thier = dzero thier = dzero
t1 = psb_wtime() t1 = psb_wtime()
call prec%build(a,desc_a,info) call prec%build(a,desc_a,info)
if(info /= psb_success_) then tprec = psb_wtime()-t1
info=psb_err_from_subroutine_ if (info /= psb_success_) then
ch_err='psb_precbld' call psb_errpush(psb_err_from_subroutine_,name,a_err='mld_precbld')
call psb_errpush(info,name,a_err=ch_err)
goto 9999 goto 9999
end if end if
tprec = psb_wtime()-t1
end if end if
!!$ call prec%dump(info,prefix='test-ml',ac=.true.,solver=.true.,smoother=.true.) call psb_amx(ictxt, thier)
call psb_amx(ictxt, tprec)
call psb_amx(ictxt,thier) if(iam == psb_root_) then
call psb_amx(ictxt,tprec) write(psb_out_unit,'(" ")')
write(psb_out_unit,'("Preconditioner: ",a)') trim(p_choice%descr)
if (iam == psb_root_) & write(psb_out_unit,'("Preconditioner time: ",es12.5)')thier+tprec
& write(psb_out_unit,'("Preconditioner time : ",es12.5)') tprec+thier write(psb_out_unit,'(" ")')
if (iam == psb_root_) call mld_precdescr(prec,info) end if
if (iam == psb_root_) &
& write(psb_out_unit,'(" ")')
! !
! iterative method parameters ! iterative method parameters
! !
if(iam == psb_root_) &
& write(psb_out_unit,'("Calling iterative method ",a)')kmethd
call psb_barrier(ictxt) call psb_barrier(ictxt)
t1 = psb_wtime() t1 = psb_wtime()
call psb_krylov(kmethd,a,prec,b,x,eps,desc_a,info,& call psb_krylov(s_choice%kmethd,a,prec,b,x,s_choice%eps,&
& itmax=itmax,iter=iter,err=err,itrace=itrace,istop=istopc,irst=irst) & desc_a,info,itmax=s_choice%itmax,iter=iter,err=err,itrace=s_choice%itrace,&
& istop=s_choice%istopc,irst=s_choice%irst)
call psb_barrier(ictxt)
tslv = psb_wtime() - t1
call psb_amx(ictxt,tslv)
if(info /= psb_success_) then if(info /= psb_success_) then
info=psb_err_from_subroutine_ info=psb_err_from_subroutine_
@ -356,33 +425,44 @@ program mld_d_pde3d
tslv = psb_wtime() - t1 tslv = psb_wtime() - t1
call psb_amx(ictxt,tslv) call psb_amx(ictxt,tslv)
! compute residual norms
call psb_geall(r,desc_a,info)
call r%zero()
call psb_geasb(r,desc_a,info)
call psb_geaxpby(done,b,dzero,r,desc_a,info)
call psb_spmm(-done,a,x,done,r,desc_a,info)
resmx = psb_genrm2(r,desc_a,info)
resmxp = psb_geamax(r,desc_a,info)
amatsize = a%sizeof() amatsize = a%sizeof()
descsize = desc_a%sizeof() descsize = desc_a%sizeof()
precsize = prec%sizeof() precsize = prec%sizeof()
call psb_sum(ictxt,amatsize) call psb_sum(ictxt,amatsize)
call psb_sum(ictxt,descsize) call psb_sum(ictxt,descsize)
call psb_sum(ictxt,precsize) call psb_sum(ictxt,precsize)
call prec%descr(info)
if (iam == psb_root_) then if (iam == psb_root_) then
write(psb_out_unit,'(" ")') write(psb_out_unit,'("Computed solution on ",i8," processors")') np
write(psb_out_unit,'("Numer of levels of aggr. hierarchy: ",i12)') prec%get_nlevs() write(psb_out_unit,'("Krylov method : ",a)') trim(s_choice%kmethd)
write(psb_out_unit,'("Time to build aggr. hierarchy : ",es12.5)') thier write(psb_out_unit,'("Preconditioner : ",a)') trim(p_choice%descr)
write(psb_out_unit,'("Time to build smoothers : ",es12.5)') tprec write(psb_out_unit,'("Iterations to convergence : ",i12)') iter
write(psb_out_unit,'("Total preconditioner time : ",es12.5)') tprec+thier write(psb_out_unit,'("Relative error estimate on exit : ",es12.5)') err
write(psb_out_unit,'("Time to solve system : ",es12.5)') tslv write(psb_out_unit,'("Number of levels in hierarchy : ",i12)') prec%get_nlevs()
write(psb_out_unit,'("Time per iteration : ",es12.5)') tslv/iter write(psb_out_unit,'("Time to build hierarchy : ",es12.5)') thier
write(psb_out_unit,'("Number of iterations : ",i0)') iter write(psb_out_unit,'("Time to build smoothers : ",es12.5)') tprec
write(psb_out_unit,'("Convergence indicator on exit : ",es12.5)') err write(psb_out_unit,'("Total time for preconditioner : ",es12.5)') tprec+thier
write(psb_out_unit,'("Info on exit : ",i0)') info write(psb_out_unit,'("Time to solve system : ",es12.5)') tslv
write(psb_out_unit,'("Total memory occupation for A: ",i12)') amatsize write(psb_out_unit,'("Time per iteration : ",es12.5)') tslv/iter
write(psb_out_unit,'("Storage format for A: ",a)') trim(a%get_fmt()) write(psb_out_unit,'("Total time : ",es12.5)') tslv+tprec+thier
write(psb_out_unit,'("Total memory occupation for DESC_A: ",i12)') descsize write(psb_out_unit,'("Residual 2-norm : ",es12.5)') resmx
write(psb_out_unit,'("Storage format for DESC_A: ",a)') trim(desc_a%get_fmt()) write(psb_out_unit,'("Residual inf-norm : ",es12.5)') resmxp
write(psb_out_unit,'("Total memory occupation for PREC: ",i12)') precsize write(psb_out_unit,'("Total memory occupation for A : ",i12)') amatsize
end if write(psb_out_unit,'("Total memory occupation for DESC_A : ",i12)') descsize
write(psb_out_unit,'("Total memory occupation for PREC : ",i12)') precsize
if (dump_prec) call prec%dump(info,prefix=trim(dump_prefix),& write(psb_out_unit,'("Storage format for A : ",a )') a%get_fmt()
& ac=.true.,solver=.true.,smoother=.true.,rp=.true.,global_num=.true.) write(psb_out_unit,'("Storage format for DESC_A : ",a )') desc_a%get_fmt()
end if
! !
! cleanup storage and exit ! cleanup storage and exit
@ -408,114 +488,153 @@ contains
! !
! get iteration parameters from standard input ! get iteration parameters from standard input
! !
subroutine get_parms(ictxt,kmethd,prectype,afmt,idim,istopc,itmax,itrace,irst,eps,& !
& dump_prec,dump_prefix) ! get iteration parameters from standard input
!
subroutine get_parms(icontxt,afmt,idim,solve,prec)
use psb_base_mod
implicit none
integer(psb_ipk_) :: ictxt integer(psb_ipk_) :: icontxt, idim
type(precdata) :: prectype character(len=*) :: afmt
character(len=*) :: kmethd, afmt type(solverdata) :: solve
integer(psb_ipk_) :: idim, istopc,itmax,itrace,irst type(precdata) :: prec
integer(psb_ipk_) :: np, iam, info integer(psb_ipk_) :: iam, nm, np
real(psb_dpk_) :: eps
logical :: dump_prec
character(len=*) :: dump_prefix
character(len=20) :: buffer
call psb_info(ictxt, iam, np) call psb_info(icontxt,iam,np)
if (iam == psb_root_) then if (iam == psb_root_) then
call read_data(kmethd,psb_inp_unit) ! read input data
call read_data(afmt,psb_inp_unit) !
call read_data(idim,psb_inp_unit) call read_data(afmt,psb_inp_unit) ! matrix storage format
call read_data(istopc,psb_inp_unit) call read_data(idim,psb_inp_unit) ! Discretization grid size
call read_data(itmax,psb_inp_unit) ! Krylov solver data
call read_data(itrace,psb_inp_unit) call read_data(solve%kmethd,psb_inp_unit) ! Krylov solver
call read_data(irst,psb_inp_unit) call read_data(solve%istopc,psb_inp_unit) ! stopping criterion
call read_data(eps,psb_inp_unit) call read_data(solve%itmax,psb_inp_unit) ! max num iterations
call read_data(dump_prec,psb_inp_unit) call read_data(solve%itrace,psb_inp_unit) ! tracing
call read_data(dump_prefix,psb_inp_unit) call read_data(solve%irst,psb_inp_unit) ! restart
call read_data(prectype%descr,psb_inp_unit) ! verbose description of the prec call read_data(solve%eps,psb_inp_unit) ! tolerance
call read_data(prectype%prec,psb_inp_unit) ! overall prectype ! preconditioner type
call read_data(prectype%csize,psb_inp_unit) ! coarse size call read_data(prec%descr,psb_inp_unit) ! verbose description of the prec
call read_data(prectype%mncrratio,psb_inp_unit) ! Minimum aggregation ratio call read_data(prec%ptype,psb_inp_unit) ! preconditioner type
call read_data(prectype%athres,psb_inp_unit) ! smoother aggr thresh ! general AMG data
call read_data(prectype%maxlevs,psb_inp_unit) ! Maximum number of levels call read_data(prec%mltype,psb_inp_unit) ! AMG cycle type
call read_data(prectype%aggrprol,psb_inp_unit) ! smoothed/nonsmoothed/minenergy aggregatin call read_data(prec%otr_sweeps,psb_inp_unit) ! number of AMG cycles
call read_data(prectype%par_aggr_alg,psb_inp_unit) ! decoupled or sym. decoupled aggregation call read_data(prec%maxlevs,psb_inp_unit) ! max number of levels in AMG prec
call read_data(prectype%aggr_ord,psb_inp_unit) ! aggregation ordering: natural, node degree call read_data(prec%csize,psb_inp_unit) ! min size coarsest mat
call read_data(prectype%aggr_filter,psb_inp_unit) ! aggregation filtering: filter, no_filter ! aggregation
call read_data(prectype%mltype,psb_inp_unit) ! additive or multiplicative 2nd level prec call read_data(prec%aggrkind,psb_inp_unit) ! aggregation type
call read_data(prectype%smthpos,psb_inp_unit) ! side: pre, post, both smoothing call read_data(prec%aggr_alg,psb_inp_unit) ! parallel aggregation alg
call read_data(prectype%jsweeps,psb_inp_unit) ! Smoother sweeps call read_data(prec%aggr_ord,psb_inp_unit) ! ordering for aggregation
call read_data(prectype%smther,psb_inp_unit) ! Smoother type. call read_data(prec%aggr_filter,psb_inp_unit) ! filtering
call read_data(prectype%novr,psb_inp_unit) ! number of overlap layers call read_data(prec%mnaggratio,psb_inp_unit) ! minimum aggregation ratio
call read_data(prectype%restr,psb_inp_unit) ! restriction over application of as call read_data(prec%thrvsz,psb_inp_unit) ! size of aggr thresh vector
call read_data(prectype%prol,psb_inp_unit) ! prolongation over application of as if (prec%thrvsz > 0) then
call read_data(prectype%solve,psb_inp_unit) ! Subdomain solver: DSCALE ILU MILU ILUT FWGS BWGS MUMPS UMF SLU call psb_realloc(prec%thrvsz,prec%athresv,info)
call read_data(prectype%svsweeps,psb_inp_unit) ! Solver sweeps (GS) call read_data(prec%athresv,psb_inp_unit) ! aggr thresh vector
call read_data(prectype%fill1,psb_inp_unit) ! Fill-in for factorization 1 else
call read_data(prectype%thr1,psb_inp_unit) ! Threshold for fact. 1 ILU(T) read(psb_inp_unit,*) ! dummy read to skip a record
call read_data(prectype%cmat,psb_inp_unit) ! coarse mat end if
call read_data(prectype%csolve,psb_inp_unit) ! Coarse solver: JACOBI BJAC UMF SLU SLUDIST MUMPS call read_data(prec%athres,psb_inp_unit) ! smoothed aggr thresh
call read_data(prectype%csbsolve,psb_inp_unit) ! subsolver: DSCALE GS BWGS ILU UMF SLU SLUDIST MUMPS call read_data(prec%aggr_omalg,psb_inp_unit) ! alg for estimating omega
call read_data(prectype%cfill,psb_inp_unit) ! Fill-in for factorization 1 call read_data(prec%aggr_eig,psb_inp_unit) ! alg for estimating omega
call read_data(prectype%cthres,psb_inp_unit) ! Threshold for fact. 1 ILU(T) call read_data(prec%omega_val,psb_inp_unit) ! alg for estimating omega
call read_data(prectype%cjswp,psb_inp_unit) ! Jacobi sweeps ! AMG smoother (or pre-smoother) / 1-lev preconditioner
call read_data(prec%smther,psb_inp_unit) ! smoother type
call read_data(prec%jsweeps,psb_inp_unit) ! (pre-)smoother / 1-lev prec sweeps
call read_data(prec%novr,psb_inp_unit) ! number of overlap layers
call read_data(prec%restr,psb_inp_unit) ! restriction over application of AS
call read_data(prec%prol,psb_inp_unit) ! prolongation over application of AS
call read_data(prec%solve,psb_inp_unit) ! local subsolver
call read_data(prec%fill,psb_inp_unit) ! fill-in for incomplete LU
call read_data(prec%thr,psb_inp_unit) ! threshold for ILUT
! AMG post-smoother
call read_data(prec%smther2,psb_inp_unit) ! smoother type
call read_data(prec%jsweeps2,psb_inp_unit) ! (post-)smoother sweeps
call read_data(prec%novr2,psb_inp_unit) ! number of overlap layers
call read_data(prec%restr2,psb_inp_unit) ! restriction over application of AS
call read_data(prec%prol2,psb_inp_unit) ! prolongation over application of AS
call read_data(prec%solve2,psb_inp_unit) ! local subsolver
call read_data(prec%fill2,psb_inp_unit) ! fill-in for incomplete LU
call read_data(prec%thr2,psb_inp_unit) ! threshold for ILUT
! coasest-level solver
call read_data(prec%csolve,psb_inp_unit) ! coarsest-lev solver
call read_data(prec%cmat,psb_inp_unit) ! coarsest mat layout
call read_data(prec%csbsolve,psb_inp_unit) ! coarsest-lev subsolver
call read_data(prec%cfill,psb_inp_unit) ! fill-in for incompl LU
call read_data(prec%cthres,psb_inp_unit) ! Threshold for ILUT
call read_data(prec%cjswp,psb_inp_unit) ! sweeps for GS/JAC subsolver
end if end if
! broadcast parameters to all processors call psb_bcast(icontxt,afmt)
call psb_bcast(ictxt,kmethd) call psb_bcast(icontxt,idim)
call psb_bcast(ictxt,afmt)
call psb_bcast(ictxt,idim) call psb_bcast(icontxt,solve%kmethd)
call psb_bcast(ictxt,istopc) call psb_bcast(icontxt,solve%istopc)
call psb_bcast(ictxt,itmax) call psb_bcast(icontxt,solve%itmax)
call psb_bcast(ictxt,itrace) call psb_bcast(icontxt,solve%itrace)
call psb_bcast(ictxt,irst) call psb_bcast(icontxt,solve%irst)
call psb_bcast(ictxt,eps) call psb_bcast(icontxt,solve%eps)
call psb_bcast(ictxt,dump_prec)
call psb_bcast(ictxt,dump_prefix) call psb_bcast(icontxt,prec%descr)
call psb_bcast(ictxt,prectype%descr) ! verbose description of the prec call psb_bcast(icontxt,prec%ptype)
call psb_bcast(ictxt,prectype%prec) ! overall prectype
call psb_bcast(ictxt,prectype%csize) ! coarse size ! broadcast first (pre-)smoother / 1-lev prec data
call psb_bcast(ictxt,prectype%mncrratio) ! Minimum aggregation ratio call psb_bcast(icontxt,prec%smther) ! actually not needed for 1-lev precs
call psb_bcast(ictxt,prectype%athres) ! smoother aggr thresh call psb_bcast(icontxt,prec%jsweeps)
call psb_bcast(ictxt,prectype%maxlevs) ! Maximum number of levels call psb_bcast(icontxt,prec%novr)
call psb_bcast(ictxt,prectype%aggrprol) ! smoothed/nonsmoothed/minenergy aggregatin call psb_bcast(icontxt,prec%restr)
call psb_bcast(ictxt,prectype%par_aggr_alg) ! decoupled or sym. decoupled aggregation call psb_bcast(icontxt,prec%prol)
call psb_bcast(ictxt,prectype%aggr_ord) ! aggregation ordering: natural, node degree call psb_bcast(icontxt,prec%solve)
call psb_bcast(ictxt,prectype%aggr_filter) ! aggregation filtering: filter, no_filter call psb_bcast(icontxt,prec%fill)
call psb_bcast(ictxt,prectype%mltype) ! additive or multiplicative 2nd level prec call psb_bcast(icontxt,prec%thr)
call psb_bcast(ictxt,prectype%smthpos) ! side: pre, post, both smoothing
call psb_bcast(ictxt,prectype%jsweeps) ! Smoother sweeps ! broadcast (other) AMG parameters
call psb_bcast(ictxt,prectype%smther) ! Smoother type. if (psb_toupper(prec%ptype) == 'ML') then
call psb_bcast(ictxt,prectype%novr) ! number of overlap layers
call psb_bcast(ictxt,prectype%restr) ! restriction over application of as call psb_bcast(icontxt,prec%mltype)
call psb_bcast(ictxt,prectype%prol) ! prolongation over application of as call psb_bcast(icontxt,prec%otr_sweeps)
call psb_bcast(ictxt,prectype%solve) ! Subdomain solver: DSCALE ILU MILU ILUT FWGS BWGS MUMPS UMF SLU call psb_bcast(icontxt,prec%maxlevs)
call psb_bcast(ictxt,prectype%svsweeps) ! Solver sweeps (GS)
call psb_bcast(ictxt,prectype%fill1) ! Fill-in for factorization 1 call psb_bcast(icontxt,prec%smther2)
call psb_bcast(ictxt,prectype%thr1) ! Threshold for fact. 1 ILU(T) call psb_bcast(icontxt,prec%jsweeps2)
call psb_bcast(ictxt,prectype%cmat) ! coarse mat call psb_bcast(icontxt,prec%novr2)
call psb_bcast(ictxt,prectype%csolve) ! Coarse solver: JACOBI BJAC UMF SLU SLUDIST MUMPS call psb_bcast(icontxt,prec%restr2)
call psb_bcast(ictxt,prectype%csbsolve) ! subsolver: DSCALE GS BWGS ILU UMF SLU SLUDIST MUMPS call psb_bcast(icontxt,prec%prol2)
call psb_bcast(ictxt,prectype%cfill) ! Fill-in for factorization 1 call psb_bcast(icontxt,prec%solve2)
call psb_bcast(ictxt,prectype%cthres) ! Threshold for fact. 1 ILU(T) call psb_bcast(icontxt,prec%fill2)
call psb_bcast(ictxt,prectype%cjswp) ! Jacobi sweeps call psb_bcast(icontxt,prec%thr2)
call psb_bcast(icontxt,prec%aggrkind)
call psb_bcast(icontxt,prec%aggr_alg)
call psb_bcast(icontxt,prec%aggr_ord)
call psb_bcast(icontxt,prec%aggr_filter)
call psb_bcast(icontxt,prec%mnaggratio)
call psb_bcast(ictxt,prec%thrvsz)
if (prec%thrvsz > 0) then
if (iam /= psb_root_) call psb_realloc(prec%thrvsz,prec%athresv,info)
call psb_bcast(ictxt,prec%athresv)
end if
call psb_bcast(ictxt,prec%athres)
call psb_bcast(ictxt,prec%ascale)
call psb_bcast(ictxt,prec%aggr_omalg)
call psb_bcast(ictxt,prec%aggr_eig)
call psb_bcast(ictxt,prec%omega_val)
call psb_bcast(icontxt,prec%csize)
call psb_bcast(icontxt,prec%cmat)
call psb_bcast(icontxt,prec%csolve)
call psb_bcast(icontxt,prec%csbsolve)
call psb_bcast(icontxt,prec%cfill)
call psb_bcast(icontxt,prec%cthres)
call psb_bcast(icontxt,prec%cjswp)
end if
if (iam == psb_root_) then
write(psb_out_unit,'("Solving matrix : ell1")')
write(psb_out_unit,'("Grid dimensions : ",i4,"x",i4,"x",i4)')idim,idim,idim
write(psb_out_unit,'("Number of processors : ",i0)') np
write(psb_out_unit,'("Data distribution : BLOCK")')
write(psb_out_unit,'("Preconditioner : ",a)') prectype%descr
write(psb_out_unit,'("Iterative method : ",a)') kmethd
write(psb_out_unit,'(" ")')
endif
return
end subroutine get_parms end subroutine get_parms
! !
! print an error message ! print an error message
! !

@ -1,4 +1,4 @@
!!!$ !
! !
! MLD2P4 version 2.1 ! MLD2P4 version 2.1
! MultiLevel Domain Decomposition Parallel Preconditioners Package ! MultiLevel Domain Decomposition Parallel Preconditioners Package
@ -135,50 +135,91 @@ program mld_s_pde2d
! descriptor ! descriptor
type(psb_desc_type) :: desc_a type(psb_desc_type) :: desc_a
! dense vectors ! dense vectors
type(psb_s_vect_type) :: x,b type(psb_s_vect_type) :: x,b,r
! parallel environment ! parallel environment
integer(psb_ipk_) :: ictxt, iam, np integer(psb_ipk_) :: ictxt, iam, np
! solver parameters ! solver parameters
integer(psb_ipk_) :: iter, itmax,itrace, istopc, irst, nlv integer(psb_ipk_) :: iter, itmax,itrace, istopc, irst, nlv
integer(psb_long_int_k_) :: amatsize, precsize, descsize integer(psb_long_int_k_) :: amatsize, precsize, descsize
real(psb_spk_) :: err, eps real(psb_spk_) :: err, resmx, resmxp
! Krylov solver data
type solverdata
character(len=40) :: kmethd ! Krylov solver
integer(psb_ipk_) :: istopc ! stopping criterion
integer(psb_ipk_) :: itmax ! maximum number of iterations
integer(psb_ipk_) :: itrace ! tracing
integer(psb_ipk_) :: irst ! restart
real(psb_spk_) :: eps ! stopping tolerance
end type solverdata
type(solverdata) :: s_choice
! preconditioner data
type precdata type precdata
character(len=20) :: descr ! verbose description of the prec
character(len=10) :: prec ! overall prectype ! preconditioner type
character(len=40) :: descr ! verbose description of the prec
character(len=10) :: ptype ! preconditioner type
! general AMG data
character(len=16) :: mltype ! AMG cycle type
integer(psb_ipk_) :: otr_sweeps ! number of AMG cycles
integer(psb_ipk_) :: maxlevs ! maximum number of levels in AMG preconditioner
! AMG aggregation
character(len=16) :: aggrkind ! aggregation type: SMOOTHED, NONSMOOTHED
character(len=16) :: aggr_alg ! parallel aggregation algorithm: DEC, SYMDEC
character(len=16) :: aggr_ord ! ordering for aggregation: NATURAL, DEGREE
character(len=16) :: aggr_filter ! filtering: FILTER, NO_FILTER
real(psb_spk_) :: mnaggratio ! minimum aggregation ratio
real(psb_spk_), allocatable :: athresv(:) ! smoothed aggregation threshold vector
integer(psb_ipk_) :: thrvsz ! size of threshold vector
real(psb_spk_) :: athres ! smoothed aggregation threshold
real(psb_spk_) :: ascale ! smoothed aggregation scale factor for threshold
character(len=16) :: aggr_omalg ! algorithm for estimating omega parameter
character(len=16) :: aggr_eig ! Eigenvalue estimation procedure
real(psb_spk_) :: omega_val ! Eigenvalue estimate value
integer(psb_ipk_) :: csize ! minimum size of coarsest matrix
! AMG smoother or pre-smoother; also 1-lev preconditioner
character(len=16) :: smther ! (pre-)smoother type: BJAC, AS
integer(psb_ipk_) :: jsweeps ! (pre-)smoother / 1-lev prec. sweeps
integer(psb_ipk_) :: novr ! number of overlap layers integer(psb_ipk_) :: novr ! number of overlap layers
integer(psb_ipk_) :: jsweeps ! Jacobi/smoother sweeps character(len=16) :: restr ! restriction over application of AS
character(len=16) :: restr ! restriction over application of as character(len=16) :: prol ! prolongation over application of AS
character(len=16) :: prol ! prolongation over application of as character(len=16) :: solve ! local subsolver type: ILU, MILU, ILUT,
character(len=16) :: solve ! Solver type: ILU, SuperLU, UMFPACK. ! UMF, MUMPS, SLU, FWGS, BWGS, JAC
integer(psb_ipk_) :: fill1 ! Fill-in for factorization 1 integer(psb_ipk_) :: fill ! fill-in for incomplete LU factorization
integer(psb_ipk_) :: svsweeps ! Solver sweeps for GS real(psb_spk_) :: thr ! threshold for ILUT factorization
real(psb_spk_) :: thr1 ! Threshold for fact. 1 ILU(T)
character(len=16) :: smther ! Smoother ! AMG post-smoother; ignored by 1-lev preconditioner
integer(psb_ipk_) :: maxlevs ! Maximum number of levels in multilevel prec. character(len=16) :: smther2 ! post-smoother type: BJAC, AS
character(len=16) :: aggrprol ! smoothed/raw aggregatin integer(psb_ipk_) :: jsweeps2 ! post-smoother sweeps
character(len=16) :: par_aggr_alg ! decoupled aggregation integer(psb_ipk_) :: novr2 ! number of overlap layers
character(len=16) :: aggr_ord ! Ordering for aggregation character(len=16) :: restr2 ! restriction over application of AS
character(len=16) :: aggr_filter ! Use filtering? character(len=16) :: prol2 ! prolongation over application of AS
character(len=16) :: mltype ! additive or multiplicative 2nd level prec character(len=16) :: solve2 ! local subsolver type: ILU, MILU, ILUT,
character(len=16) :: smthpos ! side: pre, post, both smoothing ! UMF, MUMPS, SLU, FWGS, BWGS, JAC
integer(psb_ipk_) :: csize ! aggregation size at which to stop. integer(psb_ipk_) :: fill2 ! fill-in for incomplete LU factorization
character(len=16) :: cmat ! coarse mat real(psb_spk_) :: thr2 ! threshold for ILUT factorization
character(len=16) :: csolve ! Coarse solver: bjac, umf, slu, sludist
character(len=16) :: csbsolve ! Coarse subsolver: ILU, ILU(T), SuperLU, UMFPACK. ! coarsest-level solver
integer(psb_ipk_) :: cfill ! Fill-in for factorization 1 character(len=16) :: cmat ! coarsest matrix layout: REPL, DIST
real(psb_spk_) :: cthres ! Threshold for fact. 1 ILU(T) character(len=16) :: csolve ! coarsest-lev solver: BJAC, SLUDIST (distr.
integer(psb_ipk_) :: cjswp ! Jacobi sweeps ! mat.); UMF, MUMPS, SLU, ILU, ILUT, MILU
real(psb_spk_) :: athres ! smoother aggregation threshold ! (repl. mat.)
real(psb_spk_) :: mncrratio ! Minimum aggregation ratio character(len=16) :: csbsolve ! coarsest-lev local subsolver: ILU, ILUT,
! MILU, UMF, MUMPS, SLU
integer(psb_ipk_) :: cfill ! fill-in for incomplete LU factorization
real(psb_spk_) :: cthres ! threshold for ILUT factorization
integer(psb_ipk_) :: cjswp ! sweeps for GS or JAC coarsest-lev subsolver
end type precdata end type precdata
type(precdata) :: prectype type(precdata) :: p_choice
type(psb_s_coo_sparse_mat) :: acoo
! other variables ! other variables
logical :: dump_prec integer(psb_ipk_) :: info, i, k
character(len=40) :: dump_prefix
integer(psb_ipk_) :: info, i
character(len=20) :: name,ch_err character(len=20) :: name,ch_err
info=psb_success_ info=psb_success_
@ -206,8 +247,7 @@ program mld_s_pde2d
! !
! get parameters ! get parameters
! !
call get_parms(ictxt,kmethd,prectype,afmt,idim,istopc,itmax,itrace,irst,eps,& call get_parms(ictxt,afmt,idim,s_choice,p_choice)
& dump_prec,dump_prefix)
! !
! allocate and fill in the coefficient matrix, rhs and initial guess ! allocate and fill in the coefficient matrix, rhs and initial guess
@ -230,108 +270,136 @@ program mld_s_pde2d
if (iam == psb_root_) & if (iam == psb_root_) &
& write(psb_out_unit,'(" ")') & write(psb_out_unit,'(" ")')
! !
! prepare the preconditioner. ! initialize the preconditioner
! !
if (psb_toupper(prectype%prec) == 'ML') then if (psb_toupper(p_choice%ptype) == 'ML') then
call prec%init(prectype%prec, info) ! multilevel preconditioner
if (prectype%csize>0)& call prec%init(p_choice%ptype,info)
& call prec%set('min_coarse_size', prectype%csize, info)
if (prectype%maxlevs>0)& call prec%set('ml_type', p_choice%mltype, info)
& call prec%set('max_levs', prectype%maxlevs, info) call prec%set('outer_sweeps', p_choice%otr_sweeps,info)
if (prectype%mncrratio>0)& if (p_choice%csize>0)&
& call prec%set('min_cr_ratio', prectype%mncrratio, info) & call prec%set('coarse_aggr_size', p_choice%csize, info)
if (prectype%athres >= szero) & if (p_choice%mnaggratio>0)&
& call prec%set('aggr_thresh', prectype%athres, info) & call prec%set('min_aggr_ratio', p_choice%mnaggratio, info)
call prec%set('aggr_prol', prectype%aggrprol,info) if (p_choice%maxlevs>0)&
call prec%set('par_aggr_alg', prectype%par_aggr_alg,info) & call prec%set('max_prec_levs', p_choice%maxlevs, info)
call prec%set('aggr_ord', prectype%aggr_ord,info) if (p_choice%ascale > dzero) &
call prec%set('aggr_filter', prectype%aggr_filter, info) & call prec%set('aggr_scale', p_choice%ascale, info)
if (p_choice%athres >= dzero) &
& call prec%set('aggr_thresh', p_choice%athres, info)
if (p_choice%thrvsz>0) then
do k=1,min(p_choice%thrvsz,size(prec%precv)-1)
call prec%set('aggr_thresh', p_choice%athresv(k), info,ilev=(k+1))
end do
end if
call prec%set('aggr_kind', p_choice%aggrkind, info)
call prec%set('aggr_alg', p_choice%aggr_alg, info)
call prec%set('aggr_ord', p_choice%aggr_ord, info)
call prec%set('aggr_filter', p_choice%aggr_filter,info)
call prec%set('aggr_omega_alg', p_choice%aggr_omalg, info)
if (psb_toupper(p_choice%aggr_omalg) == 'EIG_EST') then
call prec%set('aggr_eig', p_choice%aggr_eig, info)
else if (psb_toupper(p_choice%aggr_omalg) == 'USER_CHOICE') then
call prec%set('aggr_omega_val', p_choice%omega_val, info)
end if
call prec%set('coarse_solve', p_choice%csolve, info)
if (psb_toupper(p_choice%csolve) == 'BJAC') &
& call prec%set('coarse_subsolve', p_choice%csbsolve, info)
call prec%set('coarse_mat', p_choice%cmat, info)
call prec%set('coarse_fillin', p_choice%cfill, info)
call prec%set('coarse_iluthrs', p_choice%cthres, info)
call prec%set('coarse_sweeps', p_choice%cjswp, info)
call prec%set('smoother_type', p_choice%smther, info)
call prec%set('smoother_sweeps', p_choice%jsweeps, info)
call prec%set('sub_ovr', p_choice%novr, info)
call prec%set('sub_restr', p_choice%restr, info)
call prec%set('sub_prol', p_choice%prol, info)
call prec%set('sub_solve', p_choice%solve, info)
call prec%set('sub_fillin', p_choice%fill, info)
call prec%set('sub_iluthrs', p_choice%thr, info)
if (psb_toupper(p_choice%smther2) /= 'NONE') then
call prec%set('smoother_type', p_choice%smther2, info,pos='post')
call prec%set('smoother_sweeps', p_choice%jsweeps2, info,pos='post')
call prec%set('sub_ovr', p_choice%novr2, info,pos='post')
call prec%set('sub_restr', p_choice%restr2, info,pos='post')
call prec%set('sub_prol', p_choice%prol2, info,pos='post')
call prec%set('sub_solve', p_choice%solve2, info,pos='post')
call prec%set('sub_fillin', p_choice%fill2, info,pos='post')
call prec%set('sub_iluthrs', p_choice%thr2, info,pos='post')
end if
! build the preconditioner
call psb_barrier(ictxt) call psb_barrier(ictxt)
t1 = psb_wtime() t1 = psb_wtime()
call prec%hierarchy_build(a,desc_a,info) call prec%hierarchy_build(a,desc_a,info)
if(info /= psb_success_) then thier = psb_wtime()-t1
info=psb_err_from_subroutine_ if (info /= psb_success_) then
ch_err='psb_precbld' call psb_errpush(psb_err_from_subroutine_,name,a_err='mld_hierarchy_bld')
call psb_errpush(info,name,a_err=ch_err)
goto 9999 goto 9999
end if end if
thier = psb_wtime()-t1
call prec%set('smoother_type', prectype%smther, info)
call prec%set('smoother_sweeps', prectype%jsweeps, info)
call prec%set('sub_ovr', prectype%novr, info)
call prec%set('sub_restr', prectype%restr, info)
call prec%set('sub_prol', prectype%prol, info)
call prec%set('sub_solve', prectype%solve, info)
call prec%set('sub_fillin', prectype%fill1, info)
call prec%set('solver_sweeps', prectype%svsweeps, info)
call prec%set('sub_iluthrs', prectype%thr1, info)
call prec%set('ml_type', prectype%mltype, info)
call prec%set('smoother_pos', prectype%smthpos, info)
call prec%set('coarse_solve', prectype%csolve, info)
call prec%set('coarse_subsolve', prectype%csbsolve,info)
call prec%set('coarse_mat', prectype%cmat, info)
call prec%set('coarse_fillin', prectype%cfill, info)
call prec%set('coarse_iluthrs', prectype%cthres, info)
call prec%set('coarse_sweeps', prectype%cjswp, info)
call psb_barrier(ictxt) call psb_barrier(ictxt)
t1 = psb_wtime() t1 = psb_wtime()
call prec%smoothers_build(a,desc_a,info) call prec%smoothers_build(a,desc_a,info)
if(info /= psb_success_) then tprec = psb_wtime()-t1
info=psb_err_from_subroutine_ if (info /= psb_success_) then
ch_err='psb_precbld' call psb_errpush(psb_err_from_subroutine_,name,a_err='mld_smoothers_bld')
call psb_errpush(info,name,a_err=ch_err)
goto 9999 goto 9999
end if end if
tprec = psb_wtime()-t1
else else
! 1-level preconditioner
nlv = 1 nlv = 1
call prec%init(prectype%prec, info) call prec%init(p_choice%ptype,info)
call prec%set('smoother_sweeps', prectype%jsweeps, info)
call prec%set('sub_ovr', prectype%novr, info) if (psb_toupper(p_choice%ptype) /= 'NONE') then
call prec%set('sub_restr', prectype%restr, info) call prec%set('smoother_sweeps', p_choice%jsweeps, info)
call prec%set('sub_prol', prectype%prol, info) call prec%set('sub_ovr', p_choice%novr, info)
call prec%set('sub_solve', prectype%solve, info) call prec%set('sub_restr', p_choice%restr, info)
call prec%set('sub_fillin', prectype%fill1, info) call prec%set('sub_prol', p_choice%prol, info)
call prec%set('solver_sweeps', prectype%svsweeps, info) call prec%set('sub_solve', p_choice%solve, info)
call prec%set('sub_iluthrs', prectype%thr1, info) call prec%set('sub_fillin', p_choice%fill, info)
call psb_barrier(ictxt) call prec%set('sub_iluthrs', p_choice%thr, info)
thier = szero !!! call prec%set('solver_sweeps', p_choice%svsweeps, info)
end if
! build the preconditioner
thier = dzero
t1 = psb_wtime() t1 = psb_wtime()
call prec%build(a,desc_a,info) call prec%build(a,desc_a,info)
if(info /= psb_success_) then tprec = psb_wtime()-t1
info=psb_err_from_subroutine_ if (info /= psb_success_) then
ch_err='psb_precbld' call psb_errpush(psb_err_from_subroutine_,name,a_err='mld_precbld')
call psb_errpush(info,name,a_err=ch_err)
goto 9999 goto 9999
end if end if
tprec = psb_wtime()-t1
end if end if
!!$ call prec%dump(info,prefix='test-ml',ac=.true.,solver=.true.,smoother=.true.) call psb_amx(ictxt, thier)
call psb_amx(ictxt, tprec)
call psb_amx(ictxt,thier) if(iam == psb_root_) then
call psb_amx(ictxt,tprec) write(psb_out_unit,'(" ")')
write(psb_out_unit,'("Preconditioner: ",a)') trim(p_choice%descr)
if (iam == psb_root_) & write(psb_out_unit,'("Preconditioner time: ",es12.5)')thier+tprec
& write(psb_out_unit,'("Preconditioner time : ",es12.5)') tprec+thier write(psb_out_unit,'(" ")')
if (iam == psb_root_) call mld_precdescr(prec,info) end if
if (iam == psb_root_) &
& write(psb_out_unit,'(" ")')
! !
! iterative method parameters ! iterative method parameters
! !
if(iam == psb_root_) &
& write(psb_out_unit,'("Calling iterative method ",a)')kmethd
call psb_barrier(ictxt) call psb_barrier(ictxt)
t1 = psb_wtime() t1 = psb_wtime()
call psb_krylov(kmethd,a,prec,b,x,eps,desc_a,info,& call psb_krylov(s_choice%kmethd,a,prec,b,x,s_choice%eps,&
& itmax=itmax,iter=iter,err=err,itrace=itrace,istop=istopc,irst=irst) & desc_a,info,itmax=s_choice%itmax,iter=iter,err=err,itrace=s_choice%itrace,&
& istop=s_choice%istopc,irst=s_choice%irst)
call psb_barrier(ictxt)
tslv = psb_wtime() - t1
call psb_amx(ictxt,tslv)
if(info /= psb_success_) then if(info /= psb_success_) then
info=psb_err_from_subroutine_ info=psb_err_from_subroutine_
@ -344,33 +412,44 @@ program mld_s_pde2d
tslv = psb_wtime() - t1 tslv = psb_wtime() - t1
call psb_amx(ictxt,tslv) call psb_amx(ictxt,tslv)
! compute residual norms
call psb_geall(r,desc_a,info)
call r%zero()
call psb_geasb(r,desc_a,info)
call psb_geaxpby(sone,b,szero,r,desc_a,info)
call psb_spmm(-sone,a,x,sone,r,desc_a,info)
resmx = psb_genrm2(r,desc_a,info)
resmxp = psb_geamax(r,desc_a,info)
amatsize = a%sizeof() amatsize = a%sizeof()
descsize = desc_a%sizeof() descsize = desc_a%sizeof()
precsize = prec%sizeof() precsize = prec%sizeof()
call psb_sum(ictxt,amatsize) call psb_sum(ictxt,amatsize)
call psb_sum(ictxt,descsize) call psb_sum(ictxt,descsize)
call psb_sum(ictxt,precsize) call psb_sum(ictxt,precsize)
call prec%descr(info)
if (iam == psb_root_) then if (iam == psb_root_) then
write(psb_out_unit,'(" ")') write(psb_out_unit,'("Computed solution on ",i8," processors")') np
write(psb_out_unit,'("Numer of levels of aggr. hierarchy: ",i12)') prec%get_nlevs() write(psb_out_unit,'("Krylov method : ",a)') trim(s_choice%kmethd)
write(psb_out_unit,'("Time to build aggr. hierarchy : ",es12.5)') thier write(psb_out_unit,'("Preconditioner : ",a)') trim(p_choice%descr)
write(psb_out_unit,'("Time to build smoothers : ",es12.5)') tprec write(psb_out_unit,'("Iterations to convergence : ",i12)') iter
write(psb_out_unit,'("Total preconditioner time : ",es12.5)') tprec+thier write(psb_out_unit,'("Relative error estimate on exit : ",es12.5)') err
write(psb_out_unit,'("Time to solve system : ",es12.5)') tslv write(psb_out_unit,'("Number of levels in hierarchy : ",i12)') prec%get_nlevs()
write(psb_out_unit,'("Time per iteration : ",es12.5)') tslv/iter write(psb_out_unit,'("Time to build hierarchy : ",es12.5)') thier
write(psb_out_unit,'("Number of iterations : ",i0)') iter write(psb_out_unit,'("Time to build smoothers : ",es12.5)') tprec
write(psb_out_unit,'("Convergence indicator on exit : ",es12.5)') err write(psb_out_unit,'("Total time for preconditioner : ",es12.5)') tprec+thier
write(psb_out_unit,'("Info on exit : ",i0)') info write(psb_out_unit,'("Time to solve system : ",es12.5)') tslv
write(psb_out_unit,'("Total memory occupation for A: ",i12)') amatsize write(psb_out_unit,'("Time per iteration : ",es12.5)') tslv/iter
write(psb_out_unit,'("Storage format for A: ",a)') trim(a%get_fmt()) write(psb_out_unit,'("Total time : ",es12.5)') tslv+tprec+thier
write(psb_out_unit,'("Total memory occupation for DESC_A: ",i12)') descsize write(psb_out_unit,'("Residual 2-norm : ",es12.5)') resmx
write(psb_out_unit,'("Storage format for DESC_A: ",a)') trim(desc_a%get_fmt()) write(psb_out_unit,'("Residual inf-norm : ",es12.5)') resmxp
write(psb_out_unit,'("Total memory occupation for PREC: ",i12)') precsize write(psb_out_unit,'("Total memory occupation for A : ",i12)') amatsize
end if write(psb_out_unit,'("Total memory occupation for DESC_A : ",i12)') descsize
write(psb_out_unit,'("Total memory occupation for PREC : ",i12)') precsize
if (dump_prec) call prec%dump(info,prefix=trim(dump_prefix),& write(psb_out_unit,'("Storage format for A : ",a )') a%get_fmt()
& ac=.true.,solver=.true.,smoother=.true.,rp=.true.,global_num=.true.) write(psb_out_unit,'("Storage format for DESC_A : ",a )') desc_a%get_fmt()
end if
! !
! cleanup storage and exit ! cleanup storage and exit
@ -396,114 +475,153 @@ contains
! !
! get iteration parameters from standard input ! get iteration parameters from standard input
! !
subroutine get_parms(ictxt,kmethd,prectype,afmt,idim,istopc,itmax,itrace,irst,eps,& !
& dump_prec,dump_prefix) ! get iteration parameters from standard input
!
subroutine get_parms(icontxt,afmt,idim,solve,prec)
use psb_base_mod
implicit none
integer(psb_ipk_) :: ictxt integer(psb_ipk_) :: icontxt, idim
type(precdata) :: prectype character(len=*) :: afmt
character(len=*) :: kmethd, afmt type(solverdata) :: solve
integer(psb_ipk_) :: idim, istopc,itmax,itrace,irst type(precdata) :: prec
integer(psb_ipk_) :: np, iam, info integer(psb_ipk_) :: iam, nm, np
real(psb_spk_) :: eps
logical :: dump_prec
character(len=*) :: dump_prefix
character(len=20) :: buffer
call psb_info(ictxt, iam, np) call psb_info(icontxt,iam,np)
if (iam == psb_root_) then if (iam == psb_root_) then
call read_data(kmethd,psb_inp_unit) ! read input data
call read_data(afmt,psb_inp_unit) !
call read_data(idim,psb_inp_unit) call read_data(afmt,psb_inp_unit) ! matrix storage format
call read_data(istopc,psb_inp_unit) call read_data(idim,psb_inp_unit) ! Discretization grid size
call read_data(itmax,psb_inp_unit) ! Krylov solver data
call read_data(itrace,psb_inp_unit) call read_data(solve%kmethd,psb_inp_unit) ! Krylov solver
call read_data(irst,psb_inp_unit) call read_data(solve%istopc,psb_inp_unit) ! stopping criterion
call read_data(eps,psb_inp_unit) call read_data(solve%itmax,psb_inp_unit) ! max num iterations
call read_data(dump_prec,psb_inp_unit) call read_data(solve%itrace,psb_inp_unit) ! tracing
call read_data(dump_prefix,psb_inp_unit) call read_data(solve%irst,psb_inp_unit) ! restart
call read_data(prectype%descr,psb_inp_unit) ! verbose description of the prec call read_data(solve%eps,psb_inp_unit) ! tolerance
call read_data(prectype%prec,psb_inp_unit) ! overall prectype ! preconditioner type
call read_data(prectype%csize,psb_inp_unit) ! coarse size call read_data(prec%descr,psb_inp_unit) ! verbose description of the prec
call read_data(prectype%mncrratio,psb_inp_unit) ! Minimum aggregation ratio call read_data(prec%ptype,psb_inp_unit) ! preconditioner type
call read_data(prectype%athres,psb_inp_unit) ! smoother aggr thresh ! general AMG data
call read_data(prectype%maxlevs,psb_inp_unit) ! Maximum number of levels call read_data(prec%mltype,psb_inp_unit) ! AMG cycle type
call read_data(prectype%aggrprol,psb_inp_unit) ! smoothed/nonsmoothed/minenergy aggregatin call read_data(prec%otr_sweeps,psb_inp_unit) ! number of AMG cycles
call read_data(prectype%par_aggr_alg,psb_inp_unit) ! decoupled or sym. decoupled aggregation call read_data(prec%maxlevs,psb_inp_unit) ! max number of levels in AMG prec
call read_data(prectype%aggr_ord,psb_inp_unit) ! aggregation ordering: natural, node degree call read_data(prec%csize,psb_inp_unit) ! min size coarsest mat
call read_data(prectype%aggr_filter,psb_inp_unit) ! aggregation filtering: filter, no_filter ! aggregation
call read_data(prectype%mltype,psb_inp_unit) ! additive or multiplicative 2nd level prec call read_data(prec%aggrkind,psb_inp_unit) ! aggregation type
call read_data(prectype%smthpos,psb_inp_unit) ! side: pre, post, both smoothing call read_data(prec%aggr_alg,psb_inp_unit) ! parallel aggregation alg
call read_data(prectype%jsweeps,psb_inp_unit) ! Smoother sweeps call read_data(prec%aggr_ord,psb_inp_unit) ! ordering for aggregation
call read_data(prectype%smther,psb_inp_unit) ! Smoother type. call read_data(prec%aggr_filter,psb_inp_unit) ! filtering
call read_data(prectype%novr,psb_inp_unit) ! number of overlap layers call read_data(prec%mnaggratio,psb_inp_unit) ! minimum aggregation ratio
call read_data(prectype%restr,psb_inp_unit) ! restriction over application of as call read_data(prec%thrvsz,psb_inp_unit) ! size of aggr thresh vector
call read_data(prectype%prol,psb_inp_unit) ! prolongation over application of as if (prec%thrvsz > 0) then
call read_data(prectype%solve,psb_inp_unit) ! Subdomain solver: DSCALE ILU MILU ILUT FWGS BWGS MUMPS UMF SLU call psb_realloc(prec%thrvsz,prec%athresv,info)
call read_data(prectype%svsweeps,psb_inp_unit) ! Solver sweeps (GS) call read_data(prec%athresv,psb_inp_unit) ! aggr thresh vector
call read_data(prectype%fill1,psb_inp_unit) ! Fill-in for factorization 1 else
call read_data(prectype%thr1,psb_inp_unit) ! Threshold for fact. 1 ILU(T) read(psb_inp_unit,*) ! dummy read to skip a record
call read_data(prectype%cmat,psb_inp_unit) ! coarse mat end if
call read_data(prectype%csolve,psb_inp_unit) ! Coarse solver: JACOBI BJAC UMF SLU SLUDIST MUMPS call read_data(prec%athres,psb_inp_unit) ! smoothed aggr thresh
call read_data(prectype%csbsolve,psb_inp_unit) ! subsolver: DSCALE GS BWGS ILU UMF SLU SLUDIST MUMPS call read_data(prec%aggr_omalg,psb_inp_unit) ! alg for estimating omega
call read_data(prectype%cfill,psb_inp_unit) ! Fill-in for factorization 1 call read_data(prec%aggr_eig,psb_inp_unit) ! alg for estimating omega
call read_data(prectype%cthres,psb_inp_unit) ! Threshold for fact. 1 ILU(T) call read_data(prec%omega_val,psb_inp_unit) ! alg for estimating omega
call read_data(prectype%cjswp,psb_inp_unit) ! Jacobi sweeps ! AMG smoother (or pre-smoother) / 1-lev preconditioner
call read_data(prec%smther,psb_inp_unit) ! smoother type
call read_data(prec%jsweeps,psb_inp_unit) ! (pre-)smoother / 1-lev prec sweeps
call read_data(prec%novr,psb_inp_unit) ! number of overlap layers
call read_data(prec%restr,psb_inp_unit) ! restriction over application of AS
call read_data(prec%prol,psb_inp_unit) ! prolongation over application of AS
call read_data(prec%solve,psb_inp_unit) ! local subsolver
call read_data(prec%fill,psb_inp_unit) ! fill-in for incomplete LU
call read_data(prec%thr,psb_inp_unit) ! threshold for ILUT
! AMG post-smoother
call read_data(prec%smther2,psb_inp_unit) ! smoother type
call read_data(prec%jsweeps2,psb_inp_unit) ! (post-)smoother sweeps
call read_data(prec%novr2,psb_inp_unit) ! number of overlap layers
call read_data(prec%restr2,psb_inp_unit) ! restriction over application of AS
call read_data(prec%prol2,psb_inp_unit) ! prolongation over application of AS
call read_data(prec%solve2,psb_inp_unit) ! local subsolver
call read_data(prec%fill2,psb_inp_unit) ! fill-in for incomplete LU
call read_data(prec%thr2,psb_inp_unit) ! threshold for ILUT
! coasest-level solver
call read_data(prec%csolve,psb_inp_unit) ! coarsest-lev solver
call read_data(prec%cmat,psb_inp_unit) ! coarsest mat layout
call read_data(prec%csbsolve,psb_inp_unit) ! coarsest-lev subsolver
call read_data(prec%cfill,psb_inp_unit) ! fill-in for incompl LU
call read_data(prec%cthres,psb_inp_unit) ! Threshold for ILUT
call read_data(prec%cjswp,psb_inp_unit) ! sweeps for GS/JAC subsolver
end if end if
! broadcast parameters to all processors call psb_bcast(icontxt,afmt)
call psb_bcast(ictxt,kmethd) call psb_bcast(icontxt,idim)
call psb_bcast(ictxt,afmt)
call psb_bcast(ictxt,idim) call psb_bcast(icontxt,solve%kmethd)
call psb_bcast(ictxt,istopc) call psb_bcast(icontxt,solve%istopc)
call psb_bcast(ictxt,itmax) call psb_bcast(icontxt,solve%itmax)
call psb_bcast(ictxt,itrace) call psb_bcast(icontxt,solve%itrace)
call psb_bcast(ictxt,irst) call psb_bcast(icontxt,solve%irst)
call psb_bcast(ictxt,eps) call psb_bcast(icontxt,solve%eps)
call psb_bcast(ictxt,dump_prec)
call psb_bcast(ictxt,dump_prefix) call psb_bcast(icontxt,prec%descr)
call psb_bcast(ictxt,prectype%descr) ! verbose description of the prec call psb_bcast(icontxt,prec%ptype)
call psb_bcast(ictxt,prectype%prec) ! overall prectype
call psb_bcast(ictxt,prectype%csize) ! coarse size ! broadcast first (pre-)smoother / 1-lev prec data
call psb_bcast(ictxt,prectype%mncrratio) ! Minimum aggregation ratio call psb_bcast(icontxt,prec%smther) ! actually not needed for 1-lev precs
call psb_bcast(ictxt,prectype%athres) ! smoother aggr thresh call psb_bcast(icontxt,prec%jsweeps)
call psb_bcast(ictxt,prectype%maxlevs) ! Maximum number of levels call psb_bcast(icontxt,prec%novr)
call psb_bcast(ictxt,prectype%aggrprol) ! smoothed/nonsmoothed/minenergy aggregatin call psb_bcast(icontxt,prec%restr)
call psb_bcast(ictxt,prectype%par_aggr_alg) ! decoupled or sym. decoupled aggregation call psb_bcast(icontxt,prec%prol)
call psb_bcast(ictxt,prectype%aggr_ord) ! aggregation ordering: natural, node degree call psb_bcast(icontxt,prec%solve)
call psb_bcast(ictxt,prectype%aggr_filter) ! aggregation filtering: filter, no_filter call psb_bcast(icontxt,prec%fill)
call psb_bcast(ictxt,prectype%mltype) ! additive or multiplicative 2nd level prec call psb_bcast(icontxt,prec%thr)
call psb_bcast(ictxt,prectype%smthpos) ! side: pre, post, both smoothing
call psb_bcast(ictxt,prectype%jsweeps) ! Smoother sweeps ! broadcast (other) AMG parameters
call psb_bcast(ictxt,prectype%smther) ! Smoother type. if (psb_toupper(prec%ptype) == 'ML') then
call psb_bcast(ictxt,prectype%novr) ! number of overlap layers
call psb_bcast(ictxt,prectype%restr) ! restriction over application of as call psb_bcast(icontxt,prec%mltype)
call psb_bcast(ictxt,prectype%prol) ! prolongation over application of as call psb_bcast(icontxt,prec%otr_sweeps)
call psb_bcast(ictxt,prectype%solve) ! Subdomain solver: DSCALE ILU MILU ILUT FWGS BWGS MUMPS UMF SLU call psb_bcast(icontxt,prec%maxlevs)
call psb_bcast(ictxt,prectype%svsweeps) ! Solver sweeps (GS)
call psb_bcast(ictxt,prectype%fill1) ! Fill-in for factorization 1 call psb_bcast(icontxt,prec%smther2)
call psb_bcast(ictxt,prectype%thr1) ! Threshold for fact. 1 ILU(T) call psb_bcast(icontxt,prec%jsweeps2)
call psb_bcast(ictxt,prectype%cmat) ! coarse mat call psb_bcast(icontxt,prec%novr2)
call psb_bcast(ictxt,prectype%csolve) ! Coarse solver: JACOBI BJAC UMF SLU SLUDIST MUMPS call psb_bcast(icontxt,prec%restr2)
call psb_bcast(ictxt,prectype%csbsolve) ! subsolver: DSCALE GS BWGS ILU UMF SLU SLUDIST MUMPS call psb_bcast(icontxt,prec%prol2)
call psb_bcast(ictxt,prectype%cfill) ! Fill-in for factorization 1 call psb_bcast(icontxt,prec%solve2)
call psb_bcast(ictxt,prectype%cthres) ! Threshold for fact. 1 ILU(T) call psb_bcast(icontxt,prec%fill2)
call psb_bcast(ictxt,prectype%cjswp) ! Jacobi sweeps call psb_bcast(icontxt,prec%thr2)
call psb_bcast(icontxt,prec%aggrkind)
call psb_bcast(icontxt,prec%aggr_alg)
call psb_bcast(icontxt,prec%aggr_ord)
call psb_bcast(icontxt,prec%aggr_filter)
call psb_bcast(icontxt,prec%mnaggratio)
call psb_bcast(ictxt,prec%thrvsz)
if (prec%thrvsz > 0) then
if (iam /= psb_root_) call psb_realloc(prec%thrvsz,prec%athresv,info)
call psb_bcast(ictxt,prec%athresv)
end if
call psb_bcast(ictxt,prec%athres)
call psb_bcast(ictxt,prec%ascale)
call psb_bcast(ictxt,prec%aggr_omalg)
call psb_bcast(ictxt,prec%aggr_eig)
call psb_bcast(ictxt,prec%omega_val)
call psb_bcast(icontxt,prec%csize)
call psb_bcast(icontxt,prec%cmat)
call psb_bcast(icontxt,prec%csolve)
call psb_bcast(icontxt,prec%csbsolve)
call psb_bcast(icontxt,prec%cfill)
call psb_bcast(icontxt,prec%cthres)
call psb_bcast(icontxt,prec%cjswp)
end if
if (iam == psb_root_) then
write(psb_out_unit,'("Solving matrix : ell1")')
write(psb_out_unit,'("Grid dimensions : ",i4,"x",i4)')idim,idim
write(psb_out_unit,'("Number of processors : ",i0)') np
write(psb_out_unit,'("Data distribution : BLOCK")')
write(psb_out_unit,'("Preconditioner : ",a)') prectype%descr
write(psb_out_unit,'("Iterative method : ",a)') kmethd
write(psb_out_unit,'(" ")')
endif
return
end subroutine get_parms end subroutine get_parms
! !
! print an error message ! print an error message
! !

@ -1,4 +1,5 @@
! !
!
! MLD2P4 version 2.1 ! MLD2P4 version 2.1
! MultiLevel Domain Decomposition Parallel Preconditioners Package ! MultiLevel Domain Decomposition Parallel Preconditioners Package
! based on PSBLAS (Parallel Sparse BLAS version 3.5) ! based on PSBLAS (Parallel Sparse BLAS version 3.5)
@ -146,50 +147,91 @@ program mld_s_pde3d
! descriptor ! descriptor
type(psb_desc_type) :: desc_a type(psb_desc_type) :: desc_a
! dense vectors ! dense vectors
type(psb_s_vect_type) :: x,b type(psb_s_vect_type) :: x,b,r
! parallel environment ! parallel environment
integer(psb_ipk_) :: ictxt, iam, np integer(psb_ipk_) :: ictxt, iam, np
! solver parameters ! solver parameters
integer(psb_ipk_) :: iter, itmax,itrace, istopc, irst, nlv integer(psb_ipk_) :: iter, itmax,itrace, istopc, irst, nlv
integer(psb_long_int_k_) :: amatsize, precsize, descsize integer(psb_long_int_k_) :: amatsize, precsize, descsize
real(psb_spk_) :: err, eps real(psb_spk_) :: err, resmx, resmxp
! Krylov solver data
type solverdata
character(len=40) :: kmethd ! Krylov solver
integer(psb_ipk_) :: istopc ! stopping criterion
integer(psb_ipk_) :: itmax ! maximum number of iterations
integer(psb_ipk_) :: itrace ! tracing
integer(psb_ipk_) :: irst ! restart
real(psb_spk_) :: eps ! stopping tolerance
end type solverdata
type(solverdata) :: s_choice
! preconditioner data
type precdata type precdata
character(len=20) :: descr ! verbose description of the prec
character(len=10) :: prec ! overall prectype ! preconditioner type
character(len=40) :: descr ! verbose description of the prec
character(len=10) :: ptype ! preconditioner type
! general AMG data
character(len=16) :: mltype ! AMG cycle type
integer(psb_ipk_) :: otr_sweeps ! number of AMG cycles
integer(psb_ipk_) :: maxlevs ! maximum number of levels in AMG preconditioner
! AMG aggregation
character(len=16) :: aggrkind ! aggregation type: SMOOTHED, NONSMOOTHED
character(len=16) :: aggr_alg ! parallel aggregation algorithm: DEC, SYMDEC
character(len=16) :: aggr_ord ! ordering for aggregation: NATURAL, DEGREE
character(len=16) :: aggr_filter ! filtering: FILTER, NO_FILTER
real(psb_spk_) :: mnaggratio ! minimum aggregation ratio
real(psb_spk_), allocatable :: athresv(:) ! smoothed aggregation threshold vector
integer(psb_ipk_) :: thrvsz ! size of threshold vector
real(psb_spk_) :: athres ! smoothed aggregation threshold
real(psb_spk_) :: ascale ! smoothed aggregation scale factor for threshold
character(len=16) :: aggr_omalg ! algorithm for estimating omega parameter
character(len=16) :: aggr_eig ! Eigenvalue estimation procedure
real(psb_spk_) :: omega_val ! Eigenvalue estimate value
integer(psb_ipk_) :: csize ! minimum size of coarsest matrix
! AMG smoother or pre-smoother; also 1-lev preconditioner
character(len=16) :: smther ! (pre-)smoother type: BJAC, AS
integer(psb_ipk_) :: jsweeps ! (pre-)smoother / 1-lev prec. sweeps
integer(psb_ipk_) :: novr ! number of overlap layers integer(psb_ipk_) :: novr ! number of overlap layers
integer(psb_ipk_) :: jsweeps ! Jacobi/smoother sweeps character(len=16) :: restr ! restriction over application of AS
character(len=16) :: restr ! restriction over application of as character(len=16) :: prol ! prolongation over application of AS
character(len=16) :: prol ! prolongation over application of as character(len=16) :: solve ! local subsolver type: ILU, MILU, ILUT,
character(len=16) :: solve ! Solver type: ILU, SuperLU, UMFPACK. ! UMF, MUMPS, SLU, FWGS, BWGS, JAC
integer(psb_ipk_) :: fill1 ! Fill-in for factorization 1 integer(psb_ipk_) :: fill ! fill-in for incomplete LU factorization
integer(psb_ipk_) :: svsweeps ! Solver sweeps for GS real(psb_spk_) :: thr ! threshold for ILUT factorization
real(psb_spk_) :: thr1 ! Threshold for fact. 1 ILU(T)
character(len=16) :: smther ! Smoother ! AMG post-smoother; ignored by 1-lev preconditioner
integer(psb_ipk_) :: maxlevs ! Maximum number of levels in multilevel prec. character(len=16) :: smther2 ! post-smoother type: BJAC, AS
character(len=16) :: aggrprol ! smoothed/raw aggregatin integer(psb_ipk_) :: jsweeps2 ! post-smoother sweeps
character(len=16) :: par_aggr_alg ! decoupled aggregation integer(psb_ipk_) :: novr2 ! number of overlap layers
character(len=16) :: aggr_ord ! Ordering for aggregation character(len=16) :: restr2 ! restriction over application of AS
character(len=16) :: aggr_filter ! Use filtering? character(len=16) :: prol2 ! prolongation over application of AS
character(len=16) :: mltype ! additive or multiplicative 2nd level prec character(len=16) :: solve2 ! local subsolver type: ILU, MILU, ILUT,
character(len=16) :: smthpos ! side: pre, post, both smoothing ! UMF, MUMPS, SLU, FWGS, BWGS, JAC
integer(psb_ipk_) :: csize ! aggregation size at which to stop. integer(psb_ipk_) :: fill2 ! fill-in for incomplete LU factorization
character(len=16) :: cmat ! coarse mat real(psb_spk_) :: thr2 ! threshold for ILUT factorization
character(len=16) :: csolve ! Coarse solver: bjac, umf, slu, sludist
character(len=16) :: csbsolve ! Coarse subsolver: ILU, ILU(T), SuperLU, UMFPACK. ! coarsest-level solver
integer(psb_ipk_) :: cfill ! Fill-in for factorization 1 character(len=16) :: cmat ! coarsest matrix layout: REPL, DIST
real(psb_spk_) :: cthres ! Threshold for fact. 1 ILU(T) character(len=16) :: csolve ! coarsest-lev solver: BJAC, SLUDIST (distr.
integer(psb_ipk_) :: cjswp ! Jacobi sweeps ! mat.); UMF, MUMPS, SLU, ILU, ILUT, MILU
real(psb_spk_) :: athres ! smoother aggregation threshold ! (repl. mat.)
real(psb_spk_) :: mncrratio ! Minimum aggregation ratio character(len=16) :: csbsolve ! coarsest-lev local subsolver: ILU, ILUT,
! MILU, UMF, MUMPS, SLU
integer(psb_ipk_) :: cfill ! fill-in for incomplete LU factorization
real(psb_spk_) :: cthres ! threshold for ILUT factorization
integer(psb_ipk_) :: cjswp ! sweeps for GS or JAC coarsest-lev subsolver
end type precdata end type precdata
type(precdata) :: prectype type(precdata) :: p_choice
type(psb_s_coo_sparse_mat) :: acoo
! other variables ! other variables
logical :: dump_prec integer(psb_ipk_) :: info, i, k
character(len=40) :: dump_prefix
integer(psb_ipk_) :: info, i
character(len=20) :: name,ch_err character(len=20) :: name,ch_err
info=psb_success_ info=psb_success_
@ -217,8 +259,7 @@ program mld_s_pde3d
! !
! get parameters ! get parameters
! !
call get_parms(ictxt,kmethd,prectype,afmt,idim,istopc,itmax,itrace,irst,eps,& call get_parms(ictxt,afmt,idim,s_choice,p_choice)
&dump_prec,dump_prefix)
! !
! allocate and fill in the coefficient matrix, rhs and initial guess ! allocate and fill in the coefficient matrix, rhs and initial guess
@ -232,7 +273,7 @@ program mld_s_pde3d
t2 = psb_wtime() - t1 t2 = psb_wtime() - t1
if(info /= psb_success_) then if(info /= psb_success_) then
info=psb_err_from_subroutine_ info=psb_err_from_subroutine_
ch_err='create_matrix' ch_err='psb_gen_pdeed'
call psb_errpush(info,name,a_err=ch_err) call psb_errpush(info,name,a_err=ch_err)
goto 9999 goto 9999
end if end if
@ -242,108 +283,136 @@ program mld_s_pde3d
if (iam == psb_root_) & if (iam == psb_root_) &
& write(psb_out_unit,'(" ")') & write(psb_out_unit,'(" ")')
! !
! prepare the preconditioner. ! initialize the preconditioner
! !
if (psb_toupper(prectype%prec) == 'ML') then if (psb_toupper(p_choice%ptype) == 'ML') then
call prec%init(prectype%prec, info) ! multilevel preconditioner
if (prectype%csize>0)& call prec%init(p_choice%ptype,info)
& call prec%set('min_coarse_size', prectype%csize, info)
if (prectype%maxlevs>0)& call prec%set('ml_type', p_choice%mltype, info)
& call prec%set('max_levs', prectype%maxlevs, info) call prec%set('outer_sweeps', p_choice%otr_sweeps,info)
if (prectype%mncrratio>0)& if (p_choice%csize>0)&
& call prec%set('min_cr_ratio', prectype%mncrratio, info) & call prec%set('coarse_aggr_size', p_choice%csize, info)
if (prectype%athres >= szero) & if (p_choice%mnaggratio>0)&
& call prec%set('aggr_thresh', prectype%athres, info) & call prec%set('min_aggr_ratio', p_choice%mnaggratio, info)
call prec%set('aggr_prol', prectype%aggrprol,info) if (p_choice%maxlevs>0)&
call prec%set('par_aggr_alg', prectype%par_aggr_alg,info) & call prec%set('max_prec_levs', p_choice%maxlevs, info)
call prec%set('aggr_ord', prectype%aggr_ord,info) if (p_choice%ascale > dzero) &
call prec%set('aggr_filter', prectype%aggr_filter, info) & call prec%set('aggr_scale', p_choice%ascale, info)
if (p_choice%athres >= dzero) &
& call prec%set('aggr_thresh', p_choice%athres, info)
if (p_choice%thrvsz>0) then
do k=1,min(p_choice%thrvsz,size(prec%precv)-1)
call prec%set('aggr_thresh', p_choice%athresv(k), info,ilev=(k+1))
end do
end if
call prec%set('aggr_kind', p_choice%aggrkind, info)
call prec%set('aggr_alg', p_choice%aggr_alg, info)
call prec%set('aggr_ord', p_choice%aggr_ord, info)
call prec%set('aggr_filter', p_choice%aggr_filter,info)
call prec%set('aggr_omega_alg', p_choice%aggr_omalg, info)
if (psb_toupper(p_choice%aggr_omalg) == 'EIG_EST') then
call prec%set('aggr_eig', p_choice%aggr_eig, info)
else if (psb_toupper(p_choice%aggr_omalg) == 'USER_CHOICE') then
call prec%set('aggr_omega_val', p_choice%omega_val, info)
end if
call prec%set('coarse_solve', p_choice%csolve, info)
if (psb_toupper(p_choice%csolve) == 'BJAC') &
& call prec%set('coarse_subsolve', p_choice%csbsolve, info)
call prec%set('coarse_mat', p_choice%cmat, info)
call prec%set('coarse_fillin', p_choice%cfill, info)
call prec%set('coarse_iluthrs', p_choice%cthres, info)
call prec%set('coarse_sweeps', p_choice%cjswp, info)
call prec%set('smoother_type', p_choice%smther, info)
call prec%set('smoother_sweeps', p_choice%jsweeps, info)
call prec%set('sub_ovr', p_choice%novr, info)
call prec%set('sub_restr', p_choice%restr, info)
call prec%set('sub_prol', p_choice%prol, info)
call prec%set('sub_solve', p_choice%solve, info)
call prec%set('sub_fillin', p_choice%fill, info)
call prec%set('sub_iluthrs', p_choice%thr, info)
if (psb_toupper(p_choice%smther2) /= 'NONE') then
call prec%set('smoother_type', p_choice%smther2, info,pos='post')
call prec%set('smoother_sweeps', p_choice%jsweeps2, info,pos='post')
call prec%set('sub_ovr', p_choice%novr2, info,pos='post')
call prec%set('sub_restr', p_choice%restr2, info,pos='post')
call prec%set('sub_prol', p_choice%prol2, info,pos='post')
call prec%set('sub_solve', p_choice%solve2, info,pos='post')
call prec%set('sub_fillin', p_choice%fill2, info,pos='post')
call prec%set('sub_iluthrs', p_choice%thr2, info,pos='post')
end if
! build the preconditioner
call psb_barrier(ictxt) call psb_barrier(ictxt)
t1 = psb_wtime() t1 = psb_wtime()
call prec%hierarchy_build(a,desc_a,info) call prec%hierarchy_build(a,desc_a,info)
if(info /= psb_success_) then thier = psb_wtime()-t1
info=psb_err_from_subroutine_ if (info /= psb_success_) then
ch_err='psb_precbld' call psb_errpush(psb_err_from_subroutine_,name,a_err='mld_hierarchy_bld')
call psb_errpush(info,name,a_err=ch_err)
goto 9999 goto 9999
end if end if
thier = psb_wtime()-t1
call prec%set('smoother_type', prectype%smther, info)
call prec%set('smoother_sweeps', prectype%jsweeps, info)
call prec%set('sub_ovr', prectype%novr, info)
call prec%set('sub_restr', prectype%restr, info)
call prec%set('sub_prol', prectype%prol, info)
call prec%set('sub_solve', prectype%solve, info)
call prec%set('sub_fillin', prectype%fill1, info)
call prec%set('solver_sweeps', prectype%svsweeps, info)
call prec%set('sub_iluthrs', prectype%thr1, info)
call prec%set('ml_type', prectype%mltype, info)
call prec%set('smoother_pos', prectype%smthpos, info)
call prec%set('coarse_solve', prectype%csolve, info)
call prec%set('coarse_subsolve', prectype%csbsolve,info)
call prec%set('coarse_mat', prectype%cmat, info)
call prec%set('coarse_fillin', prectype%cfill, info)
call prec%set('coarse_iluthrs', prectype%cthres, info)
call prec%set('coarse_sweeps', prectype%cjswp, info)
call psb_barrier(ictxt) call psb_barrier(ictxt)
t1 = psb_wtime() t1 = psb_wtime()
call prec%smoothers_build(a,desc_a,info) call prec%smoothers_build(a,desc_a,info)
if(info /= psb_success_) then tprec = psb_wtime()-t1
info=psb_err_from_subroutine_ if (info /= psb_success_) then
ch_err='psb_precbld' call psb_errpush(psb_err_from_subroutine_,name,a_err='mld_smoothers_bld')
call psb_errpush(info,name,a_err=ch_err)
goto 9999 goto 9999
end if end if
tprec = psb_wtime()-t1
else else
! 1-level preconditioner
nlv = 1 nlv = 1
call prec%init(prectype%prec, info) call prec%init(p_choice%ptype,info)
call prec%set('smoother_sweeps', prectype%jsweeps, info)
call prec%set('sub_ovr', prectype%novr, info) if (psb_toupper(p_choice%ptype) /= 'NONE') then
call prec%set('sub_restr', prectype%restr, info) call prec%set('smoother_sweeps', p_choice%jsweeps, info)
call prec%set('sub_prol', prectype%prol, info) call prec%set('sub_ovr', p_choice%novr, info)
call prec%set('sub_solve', prectype%solve, info) call prec%set('sub_restr', p_choice%restr, info)
call prec%set('sub_fillin', prectype%fill1, info) call prec%set('sub_prol', p_choice%prol, info)
call prec%set('solver_sweeps', prectype%svsweeps, info) call prec%set('sub_solve', p_choice%solve, info)
call prec%set('sub_iluthrs', prectype%thr1, info) call prec%set('sub_fillin', p_choice%fill, info)
call psb_barrier(ictxt) call prec%set('sub_iluthrs', p_choice%thr, info)
thier = szero !!! call prec%set('solver_sweeps', p_choice%svsweeps, info)
end if
! build the preconditioner
thier = dzero
t1 = psb_wtime() t1 = psb_wtime()
call prec%build(a,desc_a,info) call prec%build(a,desc_a,info)
if(info /= psb_success_) then tprec = psb_wtime()-t1
info=psb_err_from_subroutine_ if (info /= psb_success_) then
ch_err='psb_precbld' call psb_errpush(psb_err_from_subroutine_,name,a_err='mld_precbld')
call psb_errpush(info,name,a_err=ch_err)
goto 9999 goto 9999
end if end if
tprec = psb_wtime()-t1
end if end if
!!$ call prec%dump(info,prefix='test-ml',ac=.true.,solver=.true.,smoother=.true.) call psb_amx(ictxt, thier)
call psb_amx(ictxt, tprec)
call psb_amx(ictxt,thier) if(iam == psb_root_) then
call psb_amx(ictxt,tprec) write(psb_out_unit,'(" ")')
write(psb_out_unit,'("Preconditioner: ",a)') trim(p_choice%descr)
if (iam == psb_root_) & write(psb_out_unit,'("Preconditioner time: ",es12.5)')thier+tprec
& write(psb_out_unit,'("Preconditioner time : ",es12.5)') tprec+thier write(psb_out_unit,'(" ")')
if (iam == psb_root_) call mld_precdescr(prec,info) end if
if (iam == psb_root_) &
& write(psb_out_unit,'(" ")')
! !
! iterative method parameters ! iterative method parameters
! !
if(iam == psb_root_) &
& write(psb_out_unit,'("Calling iterative method ",a)')kmethd
call psb_barrier(ictxt) call psb_barrier(ictxt)
t1 = psb_wtime() t1 = psb_wtime()
call psb_krylov(kmethd,a,prec,b,x,eps,desc_a,info,& call psb_krylov(s_choice%kmethd,a,prec,b,x,s_choice%eps,&
& itmax=itmax,iter=iter,err=err,itrace=itrace,istop=istopc,irst=irst) & desc_a,info,itmax=s_choice%itmax,iter=iter,err=err,itrace=s_choice%itrace,&
& istop=s_choice%istopc,irst=s_choice%irst)
call psb_barrier(ictxt)
tslv = psb_wtime() - t1
call psb_amx(ictxt,tslv)
if(info /= psb_success_) then if(info /= psb_success_) then
info=psb_err_from_subroutine_ info=psb_err_from_subroutine_
@ -356,33 +425,44 @@ program mld_s_pde3d
tslv = psb_wtime() - t1 tslv = psb_wtime() - t1
call psb_amx(ictxt,tslv) call psb_amx(ictxt,tslv)
! compute residual norms
call psb_geall(r,desc_a,info)
call r%zero()
call psb_geasb(r,desc_a,info)
call psb_geaxpby(sone,b,szero,r,desc_a,info)
call psb_spmm(-sone,a,x,sone,r,desc_a,info)
resmx = psb_genrm2(r,desc_a,info)
resmxp = psb_geamax(r,desc_a,info)
amatsize = a%sizeof() amatsize = a%sizeof()
descsize = desc_a%sizeof() descsize = desc_a%sizeof()
precsize = prec%sizeof() precsize = prec%sizeof()
call psb_sum(ictxt,amatsize) call psb_sum(ictxt,amatsize)
call psb_sum(ictxt,descsize) call psb_sum(ictxt,descsize)
call psb_sum(ictxt,precsize) call psb_sum(ictxt,precsize)
call prec%descr(info)
if (iam == psb_root_) then if (iam == psb_root_) then
write(psb_out_unit,'(" ")') write(psb_out_unit,'("Computed solution on ",i8," processors")') np
write(psb_out_unit,'("Numer of levels of aggr. hierarchy: ",i12)') prec%get_nlevs() write(psb_out_unit,'("Krylov method : ",a)') trim(s_choice%kmethd)
write(psb_out_unit,'("Time to build aggr. hierarchy : ",es12.5)') thier write(psb_out_unit,'("Preconditioner : ",a)') trim(p_choice%descr)
write(psb_out_unit,'("Time to build smoothers : ",es12.5)') tprec write(psb_out_unit,'("Iterations to convergence : ",i12)') iter
write(psb_out_unit,'("Total preconditioner time : ",es12.5)') tprec+thier write(psb_out_unit,'("Relative error estimate on exit : ",es12.5)') err
write(psb_out_unit,'("Time to solve system : ",es12.5)') tslv write(psb_out_unit,'("Number of levels in hierarchy : ",i12)') prec%get_nlevs()
write(psb_out_unit,'("Time per iteration : ",es12.5)') tslv/iter write(psb_out_unit,'("Time to build hierarchy : ",es12.5)') thier
write(psb_out_unit,'("Number of iterations : ",i0)') iter write(psb_out_unit,'("Time to build smoothers : ",es12.5)') tprec
write(psb_out_unit,'("Convergence indicator on exit : ",es12.5)') err write(psb_out_unit,'("Total time for preconditioner : ",es12.5)') tprec+thier
write(psb_out_unit,'("Info on exit : ",i0)') info write(psb_out_unit,'("Time to solve system : ",es12.5)') tslv
write(psb_out_unit,'("Total memory occupation for A: ",i12)') amatsize write(psb_out_unit,'("Time per iteration : ",es12.5)') tslv/iter
write(psb_out_unit,'("Storage format for A: ",a)') trim(a%get_fmt()) write(psb_out_unit,'("Total time : ",es12.5)') tslv+tprec+thier
write(psb_out_unit,'("Total memory occupation for DESC_A: ",i12)') descsize write(psb_out_unit,'("Residual 2-norm : ",es12.5)') resmx
write(psb_out_unit,'("Storage format for DESC_A: ",a)') trim(desc_a%get_fmt()) write(psb_out_unit,'("Residual inf-norm : ",es12.5)') resmxp
write(psb_out_unit,'("Total memory occupation for PREC: ",i12)') precsize write(psb_out_unit,'("Total memory occupation for A : ",i12)') amatsize
end if write(psb_out_unit,'("Total memory occupation for DESC_A : ",i12)') descsize
write(psb_out_unit,'("Total memory occupation for PREC : ",i12)') precsize
if (dump_prec) call prec%dump(info,prefix=trim(dump_prefix),& write(psb_out_unit,'("Storage format for A : ",a )') a%get_fmt()
& ac=.true.,solver=.true.,smoother=.true.,rp=.true.,global_num=.true.) write(psb_out_unit,'("Storage format for DESC_A : ",a )') desc_a%get_fmt()
end if
! !
! cleanup storage and exit ! cleanup storage and exit
@ -408,114 +488,153 @@ contains
! !
! get iteration parameters from standard input ! get iteration parameters from standard input
! !
subroutine get_parms(ictxt,kmethd,prectype,afmt,idim,istopc,itmax,itrace,irst,eps,& !
& dump_prec,dump_prefix) ! get iteration parameters from standard input
!
subroutine get_parms(icontxt,afmt,idim,solve,prec)
use psb_base_mod
implicit none
integer(psb_ipk_) :: ictxt integer(psb_ipk_) :: icontxt, idim
type(precdata) :: prectype character(len=*) :: afmt
character(len=*) :: kmethd, afmt type(solverdata) :: solve
integer(psb_ipk_) :: idim, istopc,itmax,itrace,irst type(precdata) :: prec
integer(psb_ipk_) :: np, iam, info integer(psb_ipk_) :: iam, nm, np
real(psb_spk_) :: eps
logical :: dump_prec
character(len=*) :: dump_prefix
character(len=20) :: buffer
call psb_info(ictxt, iam, np) call psb_info(icontxt,iam,np)
if (iam == psb_root_) then if (iam == psb_root_) then
call read_data(kmethd,psb_inp_unit) ! read input data
call read_data(afmt,psb_inp_unit) !
call read_data(idim,psb_inp_unit) call read_data(afmt,psb_inp_unit) ! matrix storage format
call read_data(istopc,psb_inp_unit) call read_data(idim,psb_inp_unit) ! Discretization grid size
call read_data(itmax,psb_inp_unit) ! Krylov solver data
call read_data(itrace,psb_inp_unit) call read_data(solve%kmethd,psb_inp_unit) ! Krylov solver
call read_data(irst,psb_inp_unit) call read_data(solve%istopc,psb_inp_unit) ! stopping criterion
call read_data(eps,psb_inp_unit) call read_data(solve%itmax,psb_inp_unit) ! max num iterations
call read_data(dump_prec,psb_inp_unit) call read_data(solve%itrace,psb_inp_unit) ! tracing
call read_data(dump_prefix,psb_inp_unit) call read_data(solve%irst,psb_inp_unit) ! restart
call read_data(prectype%descr,psb_inp_unit) ! verbose description of the prec call read_data(solve%eps,psb_inp_unit) ! tolerance
call read_data(prectype%prec,psb_inp_unit) ! overall prectype ! preconditioner type
call read_data(prectype%csize,psb_inp_unit) ! coarse size call read_data(prec%descr,psb_inp_unit) ! verbose description of the prec
call read_data(prectype%mncrratio,psb_inp_unit) ! Minimum aggregation ratio call read_data(prec%ptype,psb_inp_unit) ! preconditioner type
call read_data(prectype%athres,psb_inp_unit) ! smoother aggr thresh ! general AMG data
call read_data(prectype%maxlevs,psb_inp_unit) ! Maximum number of levels call read_data(prec%mltype,psb_inp_unit) ! AMG cycle type
call read_data(prectype%aggrprol,psb_inp_unit) ! smoothed/nonsmoothed/minenergy aggregatin call read_data(prec%otr_sweeps,psb_inp_unit) ! number of AMG cycles
call read_data(prectype%par_aggr_alg,psb_inp_unit) ! decoupled or sym. decoupled aggregation call read_data(prec%maxlevs,psb_inp_unit) ! max number of levels in AMG prec
call read_data(prectype%aggr_ord,psb_inp_unit) ! aggregation ordering: natural, node degree call read_data(prec%csize,psb_inp_unit) ! min size coarsest mat
call read_data(prectype%aggr_filter,psb_inp_unit) ! aggregation filtering: filter, no_filter ! aggregation
call read_data(prectype%mltype,psb_inp_unit) ! additive or multiplicative 2nd level prec call read_data(prec%aggrkind,psb_inp_unit) ! aggregation type
call read_data(prectype%smthpos,psb_inp_unit) ! side: pre, post, both smoothing call read_data(prec%aggr_alg,psb_inp_unit) ! parallel aggregation alg
call read_data(prectype%jsweeps,psb_inp_unit) ! Smoother sweeps call read_data(prec%aggr_ord,psb_inp_unit) ! ordering for aggregation
call read_data(prectype%smther,psb_inp_unit) ! Smoother type. call read_data(prec%aggr_filter,psb_inp_unit) ! filtering
call read_data(prectype%novr,psb_inp_unit) ! number of overlap layers call read_data(prec%mnaggratio,psb_inp_unit) ! minimum aggregation ratio
call read_data(prectype%restr,psb_inp_unit) ! restriction over application of as call read_data(prec%thrvsz,psb_inp_unit) ! size of aggr thresh vector
call read_data(prectype%prol,psb_inp_unit) ! prolongation over application of as if (prec%thrvsz > 0) then
call read_data(prectype%solve,psb_inp_unit) ! Subdomain solver: DSCALE ILU MILU ILUT FWGS BWGS MUMPS UMF SLU call psb_realloc(prec%thrvsz,prec%athresv,info)
call read_data(prectype%svsweeps,psb_inp_unit) ! Solver sweeps (GS) call read_data(prec%athresv,psb_inp_unit) ! aggr thresh vector
call read_data(prectype%fill1,psb_inp_unit) ! Fill-in for factorization 1 else
call read_data(prectype%thr1,psb_inp_unit) ! Threshold for fact. 1 ILU(T) read(psb_inp_unit,*) ! dummy read to skip a record
call read_data(prectype%cmat,psb_inp_unit) ! coarse mat end if
call read_data(prectype%csolve,psb_inp_unit) ! Coarse solver: JACOBI BJAC UMF SLU SLUDIST MUMPS call read_data(prec%athres,psb_inp_unit) ! smoothed aggr thresh
call read_data(prectype%csbsolve,psb_inp_unit) ! subsolver: DSCALE GS BWGS ILU UMF SLU SLUDIST MUMPS call read_data(prec%aggr_omalg,psb_inp_unit) ! alg for estimating omega
call read_data(prectype%cfill,psb_inp_unit) ! Fill-in for factorization 1 call read_data(prec%aggr_eig,psb_inp_unit) ! alg for estimating omega
call read_data(prectype%cthres,psb_inp_unit) ! Threshold for fact. 1 ILU(T) call read_data(prec%omega_val,psb_inp_unit) ! alg for estimating omega
call read_data(prectype%cjswp,psb_inp_unit) ! Jacobi sweeps ! AMG smoother (or pre-smoother) / 1-lev preconditioner
call read_data(prec%smther,psb_inp_unit) ! smoother type
call read_data(prec%jsweeps,psb_inp_unit) ! (pre-)smoother / 1-lev prec sweeps
call read_data(prec%novr,psb_inp_unit) ! number of overlap layers
call read_data(prec%restr,psb_inp_unit) ! restriction over application of AS
call read_data(prec%prol,psb_inp_unit) ! prolongation over application of AS
call read_data(prec%solve,psb_inp_unit) ! local subsolver
call read_data(prec%fill,psb_inp_unit) ! fill-in for incomplete LU
call read_data(prec%thr,psb_inp_unit) ! threshold for ILUT
! AMG post-smoother
call read_data(prec%smther2,psb_inp_unit) ! smoother type
call read_data(prec%jsweeps2,psb_inp_unit) ! (post-)smoother sweeps
call read_data(prec%novr2,psb_inp_unit) ! number of overlap layers
call read_data(prec%restr2,psb_inp_unit) ! restriction over application of AS
call read_data(prec%prol2,psb_inp_unit) ! prolongation over application of AS
call read_data(prec%solve2,psb_inp_unit) ! local subsolver
call read_data(prec%fill2,psb_inp_unit) ! fill-in for incomplete LU
call read_data(prec%thr2,psb_inp_unit) ! threshold for ILUT
! coasest-level solver
call read_data(prec%csolve,psb_inp_unit) ! coarsest-lev solver
call read_data(prec%cmat,psb_inp_unit) ! coarsest mat layout
call read_data(prec%csbsolve,psb_inp_unit) ! coarsest-lev subsolver
call read_data(prec%cfill,psb_inp_unit) ! fill-in for incompl LU
call read_data(prec%cthres,psb_inp_unit) ! Threshold for ILUT
call read_data(prec%cjswp,psb_inp_unit) ! sweeps for GS/JAC subsolver
end if end if
! broadcast parameters to all processors call psb_bcast(icontxt,afmt)
call psb_bcast(ictxt,kmethd) call psb_bcast(icontxt,idim)
call psb_bcast(ictxt,afmt)
call psb_bcast(ictxt,idim) call psb_bcast(icontxt,solve%kmethd)
call psb_bcast(ictxt,istopc) call psb_bcast(icontxt,solve%istopc)
call psb_bcast(ictxt,itmax) call psb_bcast(icontxt,solve%itmax)
call psb_bcast(ictxt,itrace) call psb_bcast(icontxt,solve%itrace)
call psb_bcast(ictxt,irst) call psb_bcast(icontxt,solve%irst)
call psb_bcast(ictxt,eps) call psb_bcast(icontxt,solve%eps)
call psb_bcast(ictxt,dump_prec)
call psb_bcast(ictxt,dump_prefix) call psb_bcast(icontxt,prec%descr)
call psb_bcast(ictxt,prectype%descr) ! verbose description of the prec call psb_bcast(icontxt,prec%ptype)
call psb_bcast(ictxt,prectype%prec) ! overall prectype
call psb_bcast(ictxt,prectype%csize) ! coarse size ! broadcast first (pre-)smoother / 1-lev prec data
call psb_bcast(ictxt,prectype%mncrratio) ! Minimum aggregation ratio call psb_bcast(icontxt,prec%smther) ! actually not needed for 1-lev precs
call psb_bcast(ictxt,prectype%athres) ! smoother aggr thresh call psb_bcast(icontxt,prec%jsweeps)
call psb_bcast(ictxt,prectype%maxlevs) ! Maximum number of levels call psb_bcast(icontxt,prec%novr)
call psb_bcast(ictxt,prectype%aggrprol) ! smoothed/nonsmoothed/minenergy aggregatin call psb_bcast(icontxt,prec%restr)
call psb_bcast(ictxt,prectype%par_aggr_alg) ! decoupled or sym. decoupled aggregation call psb_bcast(icontxt,prec%prol)
call psb_bcast(ictxt,prectype%aggr_ord) ! aggregation ordering: natural, node degree call psb_bcast(icontxt,prec%solve)
call psb_bcast(ictxt,prectype%aggr_filter) ! aggregation filtering: filter, no_filter call psb_bcast(icontxt,prec%fill)
call psb_bcast(ictxt,prectype%mltype) ! additive or multiplicative 2nd level prec call psb_bcast(icontxt,prec%thr)
call psb_bcast(ictxt,prectype%smthpos) ! side: pre, post, both smoothing
call psb_bcast(ictxt,prectype%jsweeps) ! Smoother sweeps ! broadcast (other) AMG parameters
call psb_bcast(ictxt,prectype%smther) ! Smoother type. if (psb_toupper(prec%ptype) == 'ML') then
call psb_bcast(ictxt,prectype%novr) ! number of overlap layers
call psb_bcast(ictxt,prectype%restr) ! restriction over application of as call psb_bcast(icontxt,prec%mltype)
call psb_bcast(ictxt,prectype%prol) ! prolongation over application of as call psb_bcast(icontxt,prec%otr_sweeps)
call psb_bcast(ictxt,prectype%solve) ! Subdomain solver: DSCALE ILU MILU ILUT FWGS BWGS MUMPS UMF SLU call psb_bcast(icontxt,prec%maxlevs)
call psb_bcast(ictxt,prectype%svsweeps) ! Solver sweeps (GS)
call psb_bcast(ictxt,prectype%fill1) ! Fill-in for factorization 1 call psb_bcast(icontxt,prec%smther2)
call psb_bcast(ictxt,prectype%thr1) ! Threshold for fact. 1 ILU(T) call psb_bcast(icontxt,prec%jsweeps2)
call psb_bcast(ictxt,prectype%cmat) ! coarse mat call psb_bcast(icontxt,prec%novr2)
call psb_bcast(ictxt,prectype%csolve) ! Coarse solver: JACOBI BJAC UMF SLU SLUDIST MUMPS call psb_bcast(icontxt,prec%restr2)
call psb_bcast(ictxt,prectype%csbsolve) ! subsolver: DSCALE GS BWGS ILU UMF SLU SLUDIST MUMPS call psb_bcast(icontxt,prec%prol2)
call psb_bcast(ictxt,prectype%cfill) ! Fill-in for factorization 1 call psb_bcast(icontxt,prec%solve2)
call psb_bcast(ictxt,prectype%cthres) ! Threshold for fact. 1 ILU(T) call psb_bcast(icontxt,prec%fill2)
call psb_bcast(ictxt,prectype%cjswp) ! Jacobi sweeps call psb_bcast(icontxt,prec%thr2)
call psb_bcast(icontxt,prec%aggrkind)
call psb_bcast(icontxt,prec%aggr_alg)
call psb_bcast(icontxt,prec%aggr_ord)
call psb_bcast(icontxt,prec%aggr_filter)
call psb_bcast(icontxt,prec%mnaggratio)
call psb_bcast(ictxt,prec%thrvsz)
if (prec%thrvsz > 0) then
if (iam /= psb_root_) call psb_realloc(prec%thrvsz,prec%athresv,info)
call psb_bcast(ictxt,prec%athresv)
end if
call psb_bcast(ictxt,prec%athres)
call psb_bcast(ictxt,prec%ascale)
call psb_bcast(ictxt,prec%aggr_omalg)
call psb_bcast(ictxt,prec%aggr_eig)
call psb_bcast(ictxt,prec%omega_val)
call psb_bcast(icontxt,prec%csize)
call psb_bcast(icontxt,prec%cmat)
call psb_bcast(icontxt,prec%csolve)
call psb_bcast(icontxt,prec%csbsolve)
call psb_bcast(icontxt,prec%cfill)
call psb_bcast(icontxt,prec%cthres)
call psb_bcast(icontxt,prec%cjswp)
end if
if (iam == psb_root_) then
write(psb_out_unit,'("Solving matrix : ell1")')
write(psb_out_unit,'("Grid dimensions : ",i4,"x",i4,"x",i4)')idim,idim,idim
write(psb_out_unit,'("Number of processors : ",i0)') np
write(psb_out_unit,'("Data distribution : BLOCK")')
write(psb_out_unit,'("Preconditioner : ",a)') prectype%descr
write(psb_out_unit,'("Iterative method : ",a)') kmethd
write(psb_out_unit,'(" ")')
endif
return
end subroutine get_parms end subroutine get_parms
! !
! print an error message ! print an error message
! !

@ -1,37 +1,47 @@
BICGSTAB ! Iterative method: BiCGSTAB BiCG CGS RGMRES BiCGSTABL CG
CSR ! Storage format CSR COO JAD CSR ! Storage format CSR COO JAD
0100 ! IDIM; domain size is idim**2 0080 ! IDIM; domain size is idim**3
FCG ! Iterative method: BiCGSTAB BiCG CGS RGMRES BiCGSTABL CG
2 ! ISTOPC 2 ! ISTOPC
2000 ! ITMAX 00500 ! ITMAX
10 ! ITRACE 1 ! ITRACE
30 ! IRST (restart for RGMRES and BiCGSTABL) 30 ! IRST (restart for RGMRES and BiCGSTABL)
1.d-6 ! EPS 1.d-6 ! EPS
F ! Dump preconditioner on file T F ML-VCYCLE-FBGS-SLUD ! Longer descriptive name for preconditioner (up to 20 chars)
test-ml-unsm-our ! File prefix for preconditioner dump ML ! Preconditioner type: NONE JACOBI BJAC AS ML
ML-MUL-RAS-ILU ! Descriptive name for preconditioner (up to 40 chars) VCYCLE ! Type of multilevel correction: ADD MULT
ML ! Preconditioner NONE JACOBI BJAC AS ML 1 ! Number of outer sweeps
-8000 ! If ML: Target coarse size. If <0, then use library default -3 ! Max Number of levels in a multilevel preconditioner; if <0, lib default
-1.5d0 ! If ML: Minimum aggregation ratio; if <0 use library default -3 ! Target coarse matrix size; if <0, lib default
-0.08d0 ! If ML: Smoother Aggregation Threshold: >= 0.0 default if <0 SMOOTHED ! Type of aggregation: SMOOTHED NONSMOOTHED
-20 ! If ML: Maximum acceptable number of levels; if <0 use library default DEC ! Parallel aggregation: DEC, SYMDEC
SMOOTHED ! Type of aggregation: SMOOTHED, UNSMOOTHED, MINENERGY NATURAL ! Ordering of aggregation NATURAL DEGREE
DEC ! Type of aggregation: DEC SYMDEC NOFILTER ! Filtering of matrix ? FILTER NOFILTER
NATURAL ! Ordering of aggregation: NATURAL DEGREE -1.5 ! Coarsening ratio, if < 0 use library default
FILTER ! Filtering aggregation: FILTER NOFILTER 2 ! Number of thresholds in vector, next line ignored if <= 0
MULT ! Type of multilevel correction: ADD MULT KCYCLE VCYCLE WCYCLE KCYCLESYM 0.05 0.025 ! Thresholds
TWOSIDE ! Side of correction: PRE POST TWOSIDE (ignored for ADD) 0.0100d0 ! Smoothed aggregation threshold: >= 0.0
2 ! Smoother sweeps EIG_EST ! Omega algorithm: EIG_EST USER_CHOICE
BJAC ! Smoother type JACOBI BJAC AS; ignored for non-ML A_NORMI ! Estimate procedure if EIG_EST
0 ! Number of overlap layers for AS preconditioner (at finest level) 1.0 ! Estimate value (if USER_CHOICE)
HALO ! AS Restriction operator NONE HALO FBGS ! Smoother type JACOBI BJAC AS ignored for non-ML
NONE ! AS Prolongation operator NONE SUM AVG 1 ! Number of sweeps for (pre) smoother
ILU ! Subdomain solver DSCALE ILU MILU ILUT FWGS BWGS MUMPS UMF SLU 0 ! Number of overlap layers for AS preconditioner
1 ! Solver sweeps for GS HALO ! AS restriction operator: NONE HALO
0 ! Level-set N for ILU(N), and P for ILUT NONE ! AS prolongation operator: NONE SUM AVG
DSCALE ! Subdomain solver: DSCALE ILU MILU ILUT UMF SLU MUMPS
0 ! Fill level P for ILU(P) and ILU(T,P)
1.d-4 ! Threshold T for ILU(T,P) 1.d-4 ! Threshold T for ILU(T,P)
REPL ! Coarse level: matrix distribution DIST REPL NONE ! Second (post) smoother, ignored if NONE
SLU ! Coarse level: solver JACOBI BJAC UMF SLU SLUDIST MUMPS 1 ! Number of sweeps for (post) smoother
SLU ! Coarse level: subsolver DSCALE GS BWGS ILU UMF SLU SLUDIST MUMPS 0 ! Number of overlap layers for AS preconditioner
1 ! Coarse level: Level-set N for ILU(N) HALO ! AS restriction operator: NONE HALO
1.d-4 ! Coarse level: Threshold T for ILU(T,P) NONE ! AS prolongation operator: NONE SUM AVG
2 ! Coarse level: Number of Jacobi sweeps DSCALE ! Subdomain solver: DSCALE ILU MILU ILUT UMF SLU MUMPS
0 ! Fill level P for ILU(P) and ILU(T,P)
1.d-4 ! Threshold T for ILU(T,P)
SLUDIST ! Coarsest-level solver: JACOBI BJAC UMF SLU SLUDIST MUMPS
DIST ! Coarsest-level matrix distribution: DIST REPL
SLUDIST ! Coarsest-level subsolver: ILU UMF SLU MUMPS SLUDIST
1 ! Coarsest-level fillin P for ILU(P) and ILU(T,P)
1.d-4 ! Coarsest-level threshold T for ILU(T,P)
1 ! Number of Jacobi sweeps for BJAC/PJAC coarsest-level solver

@ -1,37 +1,47 @@
BICGSTAB ! Iterative method: BiCGSTAB BiCG CGS RGMRES BiCGSTABL CG
CSR ! Storage format CSR COO JAD CSR ! Storage format CSR COO JAD
0080 ! IDIM; domain size is idim**3 0080 ! IDIM; domain size is idim**3
FCG ! Iterative method: BiCGSTAB BiCG CGS RGMRES BiCGSTABL CG
2 ! ISTOPC 2 ! ISTOPC
2000 ! ITMAX 00500 ! ITMAX
1 ! ITRACE 1 ! ITRACE
30 ! IRST (restart for RGMRES and BiCGSTABL) 30 ! IRST (restart for RGMRES and BiCGSTABL)
1.d-6 ! EPS 1.d-6 ! EPS
F ! Dump preconditioner on file T F ML-VCYCLE-FBGS-SLUD ! Longer descriptive name for preconditioner (up to 20 chars)
test-ml-unsm-our ! File prefix for preconditioner dump ML ! Preconditioner type: NONE JACOBI BJAC AS ML
ML-MUL-RAS-ILU ! Descriptive name for preconditioner (up to 40 chars) VCYCLE ! Type of multilevel correction: ADD MULT
ML ! Preconditioner NONE JACOBI BJAC AS ML 1 ! Number of outer sweeps
-8000 ! If ML: Target coarse size. If <0, then use library default -3 ! Max Number of levels in a multilevel preconditioner; if <0, lib default
-1.5d0 ! If ML: Minimum aggregation ratio; if <0 use library default -3 ! Target coarse matrix size; if <0, lib default
-0.10d0 ! If ML: Smoother Aggregation Threshold: >= 0.0 default if <0 SMOOTHED ! Type of aggregation: SMOOTHED NONSMOOTHED
-20 ! If ML: Maximum acceptable number of levels; if <0 use library default DEC ! Parallel aggregation: DEC, SYMDEC
SMOOTHED ! Type of aggregation: SMOOTHED, UNSMOOTHED, MINENERGY NATURAL ! Ordering of aggregation NATURAL DEGREE
DEC ! Type of aggregation: DEC SYMDEC NOFILTER ! Filtering of matrix ? FILTER NOFILTER
NATURAL ! Ordering of aggregation: NATURAL DEGREE -1.5 ! Coarsening ratio, if < 0 use library default
FILTER ! Filtering aggregation: FILTER NOFILTER 2 ! Number of thresholds in vector, next line ignored if <= 0
VCYCLE ! Type of multilevel correction: ADD MULT KCYCLE VCYCLE WCYCLE KCYCLESYM 0.05 0.025 ! Thresholds
TWOSIDE ! Side of correction: PRE POST TWOSIDE (ignored for ADD) 0.0100d0 ! Smoothed aggregation threshold: >= 0.0
4 ! Smoother sweeps EIG_EST ! Omega algorithm: EIG_EST USER_CHOICE
BJAC ! Smoother type JACOBI BJAC AS; ignored for non-ML A_NORMI ! Estimate procedure if EIG_EST
0 ! Number of overlap layers for AS preconditioner (at finest level) 1.0 ! Estimate value (if USER_CHOICE)
HALO ! AS Restriction operator NONE HALO FBGS ! Smoother type JACOBI BJAC AS ignored for non-ML
NONE ! AS Prolongation operator NONE SUM AVG 1 ! Number of sweeps for (pre) smoother
ILU ! Subdomain solver DSCALE ILU MILU ILUT FWGS BWGS MUMPS UMF SLU 0 ! Number of overlap layers for AS preconditioner
1 ! Solver sweeps for GS HALO ! AS restriction operator: NONE HALO
0 ! Level-set N for ILU(N), and P for ILUT NONE ! AS prolongation operator: NONE SUM AVG
DSCALE ! Subdomain solver: DSCALE ILU MILU ILUT UMF SLU MUMPS
0 ! Fill level P for ILU(P) and ILU(T,P)
1.d-4 ! Threshold T for ILU(T,P) 1.d-4 ! Threshold T for ILU(T,P)
DIST ! Coarse level: matrix distribution DIST REPL NONE ! Second (post) smoother, ignored if NONE
BJAC ! Coarse level: solver JACOBI BJAC UMF SLU SLUDIST MUMPS 1 ! Number of sweeps for (post) smoother
UMFPACK ! Coarse level: subsolver DSCALE GS BWGS ILU UMF SLU SLUDIST MUMPS 0 ! Number of overlap layers for AS preconditioner
1 ! Coarse level: Level-set N for ILU(N) HALO ! AS restriction operator: NONE HALO
1.d-4 ! Coarse level: Threshold T for ILU(T,P) NONE ! AS prolongation operator: NONE SUM AVG
2 ! Coarse level: Number of Jacobi sweeps DSCALE ! Subdomain solver: DSCALE ILU MILU ILUT UMF SLU MUMPS
0 ! Fill level P for ILU(P) and ILU(T,P)
1.d-4 ! Threshold T for ILU(T,P)
SLUDIST ! Coarsest-level solver: JACOBI BJAC UMF SLU SLUDIST MUMPS
DIST ! Coarsest-level matrix distribution: DIST REPL
SLUDIST ! Coarsest-level subsolver: ILU UMF SLU MUMPS SLUDIST
1 ! Coarsest-level fillin P for ILU(P) and ILU(T,P)
1.d-4 ! Coarsest-level threshold T for ILU(T,P)
1 ! Number of Jacobi sweeps for BJAC/PJAC coarsest-level solver

Loading…
Cancel
Save