mld2p4-2:

tests/fileread/data_input.f90
 tests/fileread/mld_cf_sample.f90
 tests/fileread/mld_df_sample.f90
 tests/fileread/mld_sf_sample.f90
 tests/fileread/mld_zf_sample.f90
 tests/fileread/runs/cfs.inp
 tests/fileread/runs/dfs.inp
 tests/fileread/runs/sfs.inp
 tests/fileread/runs/zfs.inp

Fixed new Xf_sample.
stopcriterion
Salvatore Filippone 8 years ago
parent 9761a6e854
commit a29a7f5dcf

@ -41,10 +41,12 @@ module data_input
use psb_base_mod, only : psb_spk_, psb_dpk_, psb_ipk_
interface read_data
module procedure read_char, read_int,&
& read_double, read_single, read_logical,&
& string_read_char, string_read_int,&
& string_read_double, string_read_single, &
module procedure read_char, read_int, read_int_array,&
& read_double, read_double_array, &
& read_single, read_single_array, read_logical,&
& 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
end interface read_data
interface trim_string
@ -85,6 +87,17 @@ contains
call read_data(val,charbuf,marker)
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)
real(psb_spk_), intent(out) :: val
integer(psb_ipk_), intent(in) :: file
@ -94,6 +107,17 @@ contains
call read_data(val,charbuf,marker)
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)
real(psb_dpk_), intent(out) :: val
integer(psb_ipk_), intent(in) :: file
@ -104,6 +128,16 @@ contains
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)
character(len=*), intent(out) :: val
character(len=*), intent(in) :: file
@ -142,6 +176,25 @@ contains
read(charbuf(1:idx-1),*) val
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)
real(psb_spk_), intent(out) :: val
character(len=*), intent(in) :: file
@ -161,6 +214,25 @@ contains
read(charbuf(1:idx-1),*) val
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)
real(psb_dpk_), intent(out) :: val
character(len=*), intent(in) :: file
@ -180,6 +252,25 @@ contains
read(charbuf(1:idx-1),*) val
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)
logical, intent(out) :: val
character(len=*), intent(in) :: file
@ -196,7 +287,6 @@ contains
charbuf = adjustl(charbuf)
idx=index(charbuf,marker_)
if (idx == 0) idx = len(charbuf)+1
write(0,*) ' From string_read_logical: ',idx
read(charbuf(1:idx-1),*) val
end subroutine string_read_logical

@ -4,7 +4,7 @@
! MultiLevel Domain Decomposition Parallel Preconditioners Package
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
!
! (C) Copyright 2008, 2010, 2012, 2015, 2017 , 2016
! (C) Copyright 2008, 2010, 2012, 2015, 2017
!
! Salvatore Filippone Cranfield University, UK
! Ambra Abdullahi Hassan University of Rome Tor Vergata, IT
@ -47,35 +47,83 @@ program mld_cf_sample
! input parameters
character(len=40) :: kmethd, mtrx_file, rhs_file
character(len=40) :: kmethd, mtrx_file, rhs_file, guess_file, sol_file
character(len=2) :: filefmt
! 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
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_) :: jsweeps ! Jacobi/smoother sweeps
character(len=16) :: restr ! restriction over application of AS
character(len=16) :: prol ! prolongation over application of AS
character(len=16) :: solve ! factorization type: ILU, SuperLU, UMFPACK
integer(psb_ipk_) :: fill ! fillin for factorization
real(psb_spk_) :: thr ! threshold for fact. ILU(T)
character(len=16) :: smther ! Smoother
integer(psb_ipk_) :: nlev ! number of levels in multilevel prec.
character(len=16) :: aggrkind ! smoothed, raw aggregation
character(len=16) :: aggr_alg ! aggregation algorithm (currently only decoupled)
character(len=16) :: aggr_ord ! Ordering for aggregation
character(len=16) :: mltype ! additive or multiplicative multi-level prec
character(len=16) :: smthpos ! side: pre, post, both smoothing
character(len=16) :: cmat ! coarse mat: distributed, replicated
character(len=16) :: csolve ! coarse solver: bjac, umf, slu, sludist
character(len=16) :: csbsolve ! coarse subsolver: ILU, ILU(T), SuperLU, UMFPACK
integer(psb_ipk_) :: cfill ! fillin for coarse factorization
real(psb_spk_) :: cthres ! threshold for coarse fact. ILU(T)
integer(psb_ipk_) :: cjswp ! block-Jacobi sweeps
real(psb_spk_) :: athres ! smoothed aggregation threshold
real(psb_spk_) :: ascale ! smoothed aggregation scale factor
character(len=16) :: solve ! local subsolver type: ILU, MILU, ILUT,
! UMF, MUMPS, SLU, FWGS, BWGS, JAC
integer(psb_ipk_) :: fill ! fill-in for incomplete LU factorization
real(psb_spk_) :: thr ! threshold for ILUT factorization
! AMG post-smoother; ignored by 1-lev preconditioner
character(len=16) :: smther2 ! post-smoother type: BJAC, AS
integer(psb_ipk_) :: jsweeps2 ! post-smoother sweeps
integer(psb_ipk_) :: novr2 ! number of overlap layers
character(len=16) :: restr2 ! restriction over application of AS
character(len=16) :: prol2 ! prolongation over application of AS
character(len=16) :: solve2 ! local subsolver type: ILU, MILU, ILUT,
! UMF, MUMPS, SLU, FWGS, BWGS, JAC
integer(psb_ipk_) :: fill2 ! fill-in for incomplete LU factorization
real(psb_spk_) :: thr2 ! threshold for ILUT factorization
! coarsest-level solver
character(len=16) :: cmat ! coarsest matrix layout: REPL, DIST
character(len=16) :: csolve ! coarsest-lev solver: BJAC, SLUDIST (distr.
! mat.); UMF, MUMPS, SLU, ILU, ILUT, MILU
! (repl. mat.)
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
type(precdata) :: prec_choice
type(precdata) :: p_choice
! sparse matrices
type(psb_cspmat_type) :: a, aux_a
@ -83,10 +131,10 @@ program mld_cf_sample
! preconditioner data
type(mld_cprec_type) :: prec
! dense matrices
complex(psb_spk_), allocatable, target :: aux_b(:,:), d(:)
complex(psb_spk_), allocatable, target :: aux_b(:,:), d(:), aux_g(:,:), aux_x(:,:)
complex(psb_spk_), allocatable , save :: x_col_glob(:), r_col_glob(:)
complex(psb_spk_), pointer :: b_col_glob(:)
type(psb_c_vect_type) :: b_col, x_col, r_col
complex(psb_spk_), pointer :: b_col_glob(:), ref_col_glob(:), guess_col_glob(:)
type(psb_c_vect_type) :: b_col, x_col, r_col, ref_col
! communications data structure
type(psb_desc_type):: desc_a
@ -94,24 +142,23 @@ program mld_cf_sample
integer(psb_ipk_) :: ictxt, iam, np
! solver paramters
integer(psb_ipk_) :: iter, itmax, ierr, itrace, ircode, ipart,&
& methd, istopc, irst, nlv
integer(psb_ipk_) :: iter, ircode, ipart, nlv
integer(psb_long_int_k_) :: amatsize, precsize, descsize
real(psb_spk_) :: err, eps
real(psb_spk_) :: err
character(len=5) :: afmt
character(len=20) :: name, renum
integer(psb_ipk_), parameter :: iunit=12
integer(psb_ipk_) :: iparm(20)
character(len=40) :: fprefix
! other variables
integer(psb_ipk_) :: i,info,j,m_problem
integer(psb_ipk_) :: internal, m,ii,nnzero
real(psb_spk_) :: t1, t2, tprec, thier, tslv
real(psb_spk_) :: r_amax, b_amax, scale,resmx,resmxp
integer(psb_ipk_) :: nrhs, nrow, n_row, dim, nv, ne
integer(psb_ipk_), allocatable :: ivg(:), ipv(:)
integer(psb_ipk_) :: i, info, j, k, m_problem
integer(psb_ipk_) :: lbw, ubw, prf
real(psb_dpk_) :: t1, t2, tprec, thier, tslv
real(psb_spk_) :: resmx, resmxp, xdiffn2, xdiffni, xni, xn2
integer(psb_ipk_) :: nrhs, nv
integer(psb_ipk_), allocatable :: ivg(:), ipv(:), perm(:)
logical :: have_guess=.false., have_ref=.false.
call psb_init(ictxt)
call psb_info(ictxt,iam,np)
@ -131,41 +178,55 @@ program mld_cf_sample
! Hello world
!
if (iam == psb_root_) then
write(*,*) 'Welcome to MLD2P4 version: ',mld_version_string_
write(*,*) 'This is the ',trim(name),' sample program'
write(psb_out_unit,*) ' '
write(psb_out_unit,*) 'Welcome to MLD2P4 version: ',mld_version_string_
write(psb_out_unit,*) 'This is the ',trim(name),' sample test program'
write(psb_out_unit,*) ' '
end if
!
! get parameters
!
call get_parms(ictxt,mtrx_file,rhs_file,filefmt,kmethd,&
& prec_choice,ipart,afmt,istopc,itmax,itrace,irst,eps)
call get_parms(ictxt,mtrx_file,rhs_file,guess_file,sol_file,filefmt, &
& ipart,afmt,s_choice,p_choice)
call psb_barrier(ictxt)
t1 = psb_wtime()
! read the input matrix to be processed and (possibly) the rhs
! read the input matrix to be processed and (possibly) the rhs,
! the initial guess and the reference solution
nrhs = 1
if (iam == psb_root_) then
select case(psb_toupper(filefmt))
case('MM')
! For Matrix Market we have an input file for the matrix
! and an (optional) second file for the RHS.
! and (optional) separate files for the rhs, the initial guess
! and the reference solution
call mm_mat_read(aux_a,info,iunit=iunit,filename=mtrx_file)
if (info == psb_success_) then
if (rhs_file /= 'NONE') then
call mm_array_read(aux_b,info,iunit=iunit,filename=rhs_file)
if ((info == psb_success_).and.(rhs_file /= 'NONE')) &
& call mm_array_read(aux_b,info,iunit=iunit,filename=rhs_file)
if ((info == psb_success_).and.(guess_file /= 'NONE')) then
call mm_array_read(aux_g,info,iunit=iunit,filename=guess_file)
have_guess = .true.
end if
if ((info == psb_success_).and.(sol_file /= 'NONE')) then
call mm_array_read(aux_x,info,iunit=iunit,filename=sol_file)
have_ref = .true.
end if
case ('HB')
! For Harwell-Boeing we have a single file which may or may not
! contain an RHS.
call hb_read(aux_a,info,iunit=iunit,b=aux_b,filename=mtrx_file)
! contain rhs, initial guess and reference solution.
call hb_read(aux_a,info,iunit=iunit,b=aux_b,&
& g=aux_g,x=aux_x,filename=mtrx_file)
have_guess = allocated(aux_g)
have_ref = allocated(aux_x)
case default
info = -1
write(psb_err_unit,*) 'Wrong choice for fileformat ', filefmt
end select
if (info /= psb_success_) then
write(psb_err_unit,*) 'Error while reading input matrix '
call psb_abort(ictxt)
@ -173,6 +234,8 @@ program mld_cf_sample
m_problem = aux_a%get_nrows()
call psb_bcast(ictxt,m_problem)
call psb_bcast(ictxt,have_guess)
call psb_bcast(ictxt,have_ref)
! At this point aux_b may still be unallocated
if (psb_size(aux_b,dim=ione) == m_problem) then
@ -181,23 +244,81 @@ program mld_cf_sample
b_col_glob =>aux_b(:,1)
else
write(psb_out_unit,'("Generating an rhs...")')
write(psb_out_unit,'(" ")')
call psb_realloc(m_problem,1,aux_b,ircode)
if (ircode /= 0) then
call psb_errpush(psb_err_alloc_dealloc_,name)
goto 9999
endif
b_col_glob => aux_b(:,1)
do i=1, m_problem
b_col_glob(i) = 1.d0
enddo
endif
if ((have_guess).and.(psb_size(aux_g,dim=ione) == m_problem)) then
! if any initial guess were present, broadcast the first one
write(psb_err_unit,'("Ok, got an initial guess ")')
guess_col_glob =>aux_g(:,1)
else
write(psb_out_unit,'("Generating an initial guess...")')
call psb_realloc(m_problem,1,aux_g,ircode)
if (ircode /= 0) then
call psb_errpush(psb_err_alloc_dealloc_,name)
goto 9999
endif
guess_col_glob => aux_g(:,1)
do i=1, m_problem
guess_col_glob(i) = 0.d0
enddo
endif
if ((have_ref).and.(psb_size(aux_x,dim=ione) == m_problem)) then
! if any reference were present, broadcast the first one
write(psb_err_unit,'("Ok, got a reference solution ")')
ref_col_glob =>aux_x(:,1)
else
write(psb_out_unit,'("No reference solution...")')
endif
! clean zeros in the input matrix
call aux_a%clean_zeros(info)
else
call psb_bcast(ictxt,m_problem)
call psb_bcast(ictxt,have_guess)
call psb_bcast(ictxt,have_ref)
end if
!
! Renumbering (NONE for the moment)
!
if (iam==psb_root_) then
renum='NONE'
call psb_cmp_bwpf(aux_a,lbw,ubw,prf,info)
write(psb_out_unit,'(" ")')
write(psb_out_unit,*) 'Bandwidth and profile: ',lbw,ubw,prf
write(psb_out_unit,*) 'Renumbering algorithm: ',psb_toupper(renum)
if (trim(psb_toupper(renum))/='NONE') then
call psb_mat_renum(renum,aux_a,info,perm=perm)
if (info /= 0) then
write(psb_err_unit,*) 'Error from RENUM',info
goto 9999
end if
call psb_gelp('N',perm(1:m_problem),b_col_glob(1:m_problem),info)
call psb_cmp_bwpf(aux_a,lbw,ubw,prf,info)
write(psb_out_unit,*) 'Bandwidth and profile (renumberd):',lbw,ubw,prf
end if
write(psb_out_unit,'(" ")')
end if
!
! switch over different partition types
!
if (ipart == 0) then
call psb_barrier(ictxt)
if (iam == psb_root_) write(psb_out_unit,'("Partition type: block")')
@ -211,10 +332,8 @@ program mld_cf_sample
if (iam == psb_root_) then
write(psb_out_unit,'("Partition type: graph")')
write(psb_out_unit,'(" ")')
! write(psb_err_unit,'("Build type: graph")')
call build_mtpart(aux_a,np)
endif
!!$ call psb_barrier(ictxt)
call distr_mtpart(psb_root_,ictxt)
call getv_mtpart(ivg)
call psb_matdist(aux_a, a, ictxt,desc_a,info,fmt=afmt,v=ivg)
@ -223,89 +342,136 @@ program mld_cf_sample
call psb_matdist(aux_a, a, ictxt, desc_a,info,fmt=afmt,parts=part_block)
end if
call psb_scatter(b_col_glob,b_col,desc_a,info,root=psb_root_)
!
! Scatter rhs, initial guess and reference solution
!
call psb_geall(b_col,desc_a,info)
call psb_geall(x_col,desc_a,info)
call x_col%zero()
call psb_geasb(x_col,desc_a,info)
call psb_geall(r_col,desc_a,info)
call r_col%zero()
call psb_geasb(r_col,desc_a,info)
t2 = psb_wtime() - t1
if (have_ref) call psb_geall(ref_col,desc_a,info)
if (iam == psb_root_) write(psb_out_unit,'("Scatter rhs")')
call psb_scatter(b_col_glob,b_col,desc_a,info)
if (iam == psb_root_) write(psb_out_unit,'("Scatter initial guess")')
call psb_scatter(guess_col_glob,x_col,desc_a,info)
if (have_ref) then
if (iam == psb_root_) write(psb_out_unit,'("Scatter reference solution")')
call psb_scatter(ref_col_glob,ref_col,desc_a,info)
end if
t2 = psb_wtime() - t1
call psb_amx(ictxt, t2)
if (iam == psb_root_) then
write(psb_out_unit,'(" ")')
write(psb_out_unit,'("Time to read and partition matrix : ",es12.5)')t2
write(psb_out_unit,'("Time to read and partition matrix, rhs(, guess, ref sol) : ",es12.5)')t2
write(psb_out_unit,'(" ")')
write(psb_out_unit,*) 'Preconditioner: ',prec_choice%descr
end if
!
! initialize the preconditioner
!
if (psb_toupper(p_choice%ptype) == 'ML') then
! multilevel preconditioner
call prec%init(p_choice%ptype,info)
call prec%set('ml_type', p_choice%mltype, info)
call prec%set('outer_sweeps', p_choice%otr_sweeps,info)
if (p_choice%csize>0)&
& call prec%set('coarse_aggr_size', p_choice%csize, info)
if (p_choice%mnaggratio>0)&
& call prec%set('min_aggr_ratio', p_choice%mnaggratio, info)
if (p_choice%maxlevs>0)&
& call prec%set('max_prec_levs', p_choice%maxlevs, info)
if (p_choice%ascale > dzero) &
& 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
if (psb_toupper(prec_choice%prec) == 'ML') then
call mld_precinit(prec,prec_choice%prec, info)
if (prec_choice%nlev > 0) &
& call mld_precset(prec,'max_prec_levs', prec_choice%nlev, info)
call mld_precset(prec,'aggr_kind', prec_choice%aggrkind,info)
call mld_precset(prec,'aggr_alg', prec_choice%aggr_alg,info)
call mld_precset(prec,'aggr_ord', prec_choice%aggr_ord,info)
call mld_precset(prec,'aggr_scale', prec_choice%ascale, info)
call mld_precset(prec,'aggr_thresh', prec_choice%athres, info)
call mld_precset(prec,'smoother_type', prec_choice%smther, info)
call mld_precset(prec,'smoother_sweeps', prec_choice%jsweeps, info)
call mld_precset(prec,'sub_ovr', prec_choice%novr, info)
call mld_precset(prec,'sub_restr', prec_choice%restr, info)
call mld_precset(prec,'sub_prol', prec_choice%prol, info)
call mld_precset(prec,'sub_solve', prec_choice%solve, info)
call mld_precset(prec,'sub_fillin', prec_choice%fill, info)
call mld_precset(prec,'sub_iluthrs', prec_choice%thr, info)
call mld_precset(prec,'ml_type', prec_choice%mltype, info)
call mld_precset(prec,'smoother_pos', prec_choice%smthpos, info)
call mld_precset(prec,'coarse_solve', prec_choice%csolve, info)
call mld_precset(prec,'coarse_subsolve', prec_choice%csbsolve,info)
call mld_precset(prec,'coarse_mat', prec_choice%cmat, info)
call mld_precset(prec,'coarse_fillin', prec_choice%cfill, info)
call mld_precset(prec,'coarse_iluthrs', prec_choice%cthres, info)
call mld_precset(prec,'coarse_sweeps', prec_choice%cjswp, info)
! building the preconditioner
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)
t1 = psb_wtime()
call mld_hierarchy_bld(a,desc_a,prec,info)
call prec%hierarchy_build(a,desc_a,info)
thier = psb_wtime()-t1
if (info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='psb_precbld')
call psb_errpush(psb_err_from_subroutine_,name,a_err='mld_hierarchy_bld')
goto 9999
end if
call psb_barrier(ictxt)
t1 = psb_wtime()
call mld_smoothers_bld(a,desc_a,prec,info)
call prec%smoothers_build(a,desc_a,info)
tprec = psb_wtime()-t1
if (info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='psb_precbld')
call psb_errpush(psb_err_from_subroutine_,name,a_err='mld_smoothers_bld')
goto 9999
end if
else
! 1-level preconditioner
nlv = 1
call mld_precinit(prec,prec_choice%prec,info)
if (psb_toupper(prec_choice%prec) /= 'NONE') then
call mld_precset(prec,'smoother_sweeps', prec_choice%jsweeps, info)
call mld_precset(prec,'sub_ovr', prec_choice%novr, info)
call mld_precset(prec,'sub_restr', prec_choice%restr, info)
call mld_precset(prec,'sub_prol', prec_choice%prol, info)
call mld_precset(prec,'sub_solve', prec_choice%solve, info)
call mld_precset(prec,'sub_fillin', prec_choice%fill, info)
call mld_precset(prec,'sub_iluthrs', prec_choice%thr, info)
call prec%init(p_choice%ptype,info)
if (psb_toupper(p_choice%ptype) /= 'NONE') then
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)
!!! call prec%set('solver_sweeps', p_choice%svsweeps, info)
end if
! building the preconditioner
! build the preconditioner
thier = dzero
t1 = psb_wtime()
call mld_precbld(a,desc_a,prec,info)
call prec%build(a,desc_a,info)
tprec = psb_wtime()-t1
if (info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='psb_precbld')
call psb_errpush(psb_err_from_subroutine_,name,a_err='mld_precbld')
goto 9999
end if
end if
@ -314,6 +480,8 @@ program mld_cf_sample
call psb_amx(ictxt, tprec)
if(iam == psb_root_) then
write(psb_out_unit,'(" ")')
write(psb_out_unit,'("Preconditioner: ",a)') trim(p_choice%descr)
write(psb_out_unit,'("Preconditioner time: ",es12.5)')thier+tprec
write(psb_out_unit,'(" ")')
end if
@ -321,43 +489,71 @@ program mld_cf_sample
iparm = 0
call psb_barrier(ictxt)
t1 = psb_wtime()
call psb_krylov(kmethd,a,prec,b_col,x_col,eps,desc_a,info,&
& itmax=itmax,iter=iter,err=err,itrace=itrace,istop=istopc,irst=irst)
call psb_krylov(s_choice%kmethd,a,prec,b_col,x_col,s_choice%eps,&
& 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)
! compute residual norms
call psb_geall(r_col,desc_a,info)
call r_col%zero()
call psb_geasb(r_col,desc_a,info)
call psb_geaxpby(cone,b_col,czero,r_col,desc_a,info)
call psb_spmm(-cone,a,x_col,cone,r_col,desc_a,info)
resmx = psb_genrm2(r_col,desc_a,info)
resmxp = psb_geamax(r_col,desc_a,info)
! compute error in solution
if (have_ref) then
call psb_geaxpby(-cone,x_col,cone,ref_col,desc_a,info)
xdiffn2 = psb_genrm2(ref_col,desc_a,info)
xdiffni = psb_geamax(ref_col,desc_a,info)
xn2 = psb_genrm2(ref_col,desc_a,info)
xni = psb_geamax(ref_col,desc_a,info)
end if
amatsize = a%sizeof()
descsize = desc_a%sizeof()
precsize = prec%sizeof()
call psb_sum(ictxt,amatsize)
call psb_sum(ictxt,descsize)
call psb_sum(ictxt,precsize)
call prec%descr(info)
if (iam == psb_root_) then
call mld_precdescr(prec,info)
write(psb_out_unit,'("Matrix: ",a)')mtrx_file
write(psb_out_unit,'("Computed solution on ",i8," processors")')np
write(psb_out_unit,'("Iterations to convergence : ",i6)')iter
write(psb_out_unit,'("Error estimate on exit : ",es12.5)')err
write(psb_out_unit,'("Krylov method : ",a)') trim(s_choice%kmethd)
write(psb_out_unit,'("Preconditioner : ",a)') trim(p_choice%descr)
write(psb_out_unit,'("Iterations to convergence : ",i12)')iter
write(psb_out_unit,'("Relative error estimate on exit : ",es12.5)') err
write(psb_out_unit,'("Number of levels in hierarchy : ",i12)') prec%get_nlevs()
write(psb_out_unit,'("Time to build hierarchy : ",es12.5)')thier
write(psb_out_unit,'("Time to build smoothers : ",es12.5)')tprec
write(psb_out_unit,'("Total time for preconditioner : ",es12.5)')tprec+thier
write(psb_out_unit,'("Time to solve system : ",es12.5)')tslv
write(psb_out_unit,'("Time per iteration : ",es12.5)')tslv/(iter)
write(psb_out_unit,'("Total time : ",es12.5)')tslv+tprec
write(psb_out_unit,'("Residual norm 2 : ",es12.5)')resmx
write(psb_out_unit,'("Residual norm inf : ",es12.5)')resmxp
write(psb_out_unit,'("Time per iteration : ",es12.5)')tslv/iter
write(psb_out_unit,'("Total time : ",es12.5)')tslv+tprec+thier
write(psb_out_unit,'("Residual 2-norm : ",es12.5)')resmx
write(psb_out_unit,'("Residual inf-norm : ",es12.5)')resmxp
write(psb_out_unit,'("Total memory occupation for A : ",i12)')amatsize
write(psb_out_unit,'("Total memory occupation for DESC_A : ",i12)')descsize
write(psb_out_unit,'("Total memory occupation for PREC : ",i12)')precsize
write(psb_out_unit,'("Storage format for A : ",a )')a%get_fmt()
write(psb_out_unit,'("Storage format for DESC_A : ",a )')desc_a%get_fmt()
if (have_ref) then
write(psb_out_unit,'(" ")')
write(psb_out_unit,'(2x,a10,9x,a8,4x,a20,5x,a8)') &
& '||X-XREF||','||XREF||','||X-XREF||/||XREF||','(2-norm)'
write(psb_out_unit,'(1x,3(e12.6,6x))') xdiffn2,xn2,xdiffn2/xn2
write(psb_out_unit,'(" ")')
write(psb_out_unit,'(2x,a10,9x,a8,4x,a20,4x,a10)') &
& '||X-XREF||','||XREF||','||X-XREF||/||XREF||','(inf-norm)'
write(psb_out_unit,'(1x,3(e12.6,6x))') xdiffni,xni,xdiffni/xni
end if
end if
call psb_gather(x_col_glob,x_col,desc_a,info,root=psb_root_)
@ -367,13 +563,15 @@ program mld_cf_sample
if (iam == psb_root_) then
write(psb_err_unit,'(" ")')
write(psb_err_unit,'("Saving x on file")')
write(20,*) 'matrix: ',mtrx_file
write(20,*) 'computed solution on ',np,' processors.'
write(20,*) 'iterations to convergence: ',iter
write(20,*) 'error estimate (infinity norm) on exit:', &
& ' ||r||/(||a||||x||+||b||) = ',err
write(20,'("Residual norm 2 : ",es12.5)')resmx
write(20,'("Residual norm inf : ",es12.5)')resmxp
write(20,*) 'Matrix: ',mtrx_file
write(20,*) 'Krylov method:',trim(s_choice%kmethd)
write(20,*) 'Preconditioner:',trim(p_choice%descr)
write(20,*) 'Computed solution on ',np,' processors.'
write(20,*) 'Iterations to convergence: ',iter
write(20,*) 'Error estimate (infinity norm) on exit:', &
& ' ||r||/||b|| (inf-norm) = ',err
write(20,'(" Residual 2-norm 2 : ",es12.5)')resmx
write(20,'(" Residual inf-norm : ",es12.5)')resmxp
write(20,'(a8,4(2x,a20))') 'I','X(I)','R(I)','B(I)'
do i=1,m_problem
write(20,998) i,x_col_glob(i),r_col_glob(i),b_col_glob(i)
@ -383,10 +581,12 @@ program mld_cf_sample
993 format(i6,4(1x,e12.6))
call psb_gefree(b_col, desc_a,info)
call psb_gefree(x_col, desc_a,info)
call psb_gefree(b_col,desc_a,info)
call psb_gefree(x_col,desc_a,info)
call psb_gefree(r_col,desc_a,info)
call psb_gefree(ref_col,desc_a,info)
call psb_spfree(a, desc_a,info)
call mld_precfree(prec,info)
call prec%free(info)
call psb_cdfree(desc_a,info)
call psb_exit(ictxt)
@ -399,101 +599,161 @@ contains
!
! get iteration parameters from standard input
!
subroutine get_parms(icontxt,mtrx,rhs,filefmt,kmethd,&
& prec, ipart,afmt,istopc,itmax,itrace,irst,eps)
subroutine get_parms(icontxt,mtrx,rhs,guess,sol,filefmt,ipart,afmt,solve,prec)
use psb_base_mod
implicit none
integer(psb_ipk_) :: icontxt
character(len=*) :: kmethd, mtrx, rhs, afmt,filefmt
integer(psb_ipk_) :: icontxt, ipart
character(len=*) :: mtrx, rhs, guess, sol, filefmt, afmt
type(solverdata) :: solve
type(precdata) :: prec
real(psb_spk_) :: eps
integer(psb_ipk_) :: iret, istopc,itmax,itrace, ipart, irst
integer(psb_ipk_) :: iam, nm, np, i
integer(psb_ipk_) :: iam, nm, np
call psb_info(icontxt,iam,np)
if (iam == psb_root_) then
! read input parameters
call read_data(mtrx,psb_inp_unit)
call read_data(rhs,psb_inp_unit)
call read_data(filefmt,psb_inp_unit)
call read_data(kmethd,psb_inp_unit)
call read_data(afmt,psb_inp_unit)
call read_data(ipart,psb_inp_unit)
call read_data(istopc,psb_inp_unit)
call read_data(itmax,psb_inp_unit)
call read_data(itrace,psb_inp_unit)
call read_data(irst,psb_inp_unit)
call read_data(eps,psb_inp_unit)
! read input data
!
! input files
call read_data(mtrx,psb_inp_unit) ! matrix file
call read_data(rhs,psb_inp_unit) ! rhs file
call read_data(guess,psb_inp_unit) ! starting guess file
call read_data(sol,psb_inp_unit) ! solution file (for comparison)
call read_data(filefmt,psb_inp_unit) ! format of files
call read_data(afmt,psb_inp_unit) ! matrix storage format
call read_data(ipart,psb_inp_unit) ! partition type
! Krylov solver data
call read_data(solve%kmethd,psb_inp_unit) ! Krylov solver
call read_data(solve%istopc,psb_inp_unit) ! stopping criterion
call read_data(solve%itmax,psb_inp_unit) ! max num iterations
call read_data(solve%itrace,psb_inp_unit) ! tracing
call read_data(solve%irst,psb_inp_unit) ! restart
call read_data(solve%eps,psb_inp_unit) ! tolerance
! preconditioner type
call read_data(prec%descr,psb_inp_unit) ! verbose description of the prec
call read_data(prec%prec,psb_inp_unit) ! overall prectype
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) ! Factorization type: ILU, SuperLU, UMFPACK.
call read_data(prec%fill,psb_inp_unit) ! Fill-in for factorization
call read_data(prec%thr,psb_inp_unit) ! Threshold for fact. ILU(T)
call read_data(prec%jsweeps,psb_inp_unit) ! Jacobi sweeps for PJAC
if (psb_toupper(prec%prec) == 'ML') then
call read_data(prec%nlev,psb_inp_unit) ! Number of levels in multilevel prec.
call read_data(prec%smther,psb_inp_unit) ! Smoother type.
call read_data(prec%aggrkind,psb_inp_unit) ! smoothed/raw aggregatin
call read_data(prec%aggr_alg,psb_inp_unit) ! local or global aggregation
call read_data(prec%aggr_ord,psb_inp_unit) ! Ordering for aggregation
call read_data(prec%mltype,psb_inp_unit) ! additive or multiplicative 2nd level prec
call read_data(prec%smthpos,psb_inp_unit) ! side: pre, post, both smoothing
call read_data(prec%cmat,psb_inp_unit) ! coarse mat
call read_data(prec%csolve,psb_inp_unit) ! Factorization type: BJAC, SuperLU, UMFPACK.
call read_data(prec%csbsolve,psb_inp_unit) ! Factorization type: ILU, SuperLU, UMFPACK.
call read_data(prec%cfill,psb_inp_unit) ! Fill-in for factorization
call read_data(prec%cthres,psb_inp_unit) ! Threshold for fact. ILU(T)
call read_data(prec%cjswp,psb_inp_unit) ! Jacobi sweeps
call read_data(prec%athres,psb_inp_unit) ! smoother aggr thresh
call read_data(prec%ascale,psb_inp_unit) ! smoother aggr thresh
call read_data(prec%ptype,psb_inp_unit) ! preconditioner type
! general AMG data
call read_data(prec%mltype,psb_inp_unit) ! AMG cycle type
call read_data(prec%otr_sweeps,psb_inp_unit) ! number of AMG cycles
call read_data(prec%maxlevs,psb_inp_unit) ! max number of levels in AMG prec
call read_data(prec%csize,psb_inp_unit) ! min size coarsest mat
! aggregation
call read_data(prec%aggrkind,psb_inp_unit) ! aggregation type
call read_data(prec%aggr_alg,psb_inp_unit) ! parallel aggregation alg
call read_data(prec%aggr_ord,psb_inp_unit) ! ordering for aggregation
call read_data(prec%aggr_filter,psb_inp_unit) ! filtering
call read_data(prec%mnaggratio,psb_inp_unit) ! minimum aggregation ratio
call read_data(prec%thrvsz,psb_inp_unit) ! size of aggr thresh vector
if (prec%thrvsz > 0) then
call psb_realloc(prec%thrvsz,prec%athresv,info)
call read_data(prec%athresv,psb_inp_unit) ! aggr thresh vector
else
read(psb_inp_unit,*) ! dummy read to skip a record
end if
call read_data(prec%athres,psb_inp_unit) ! smoothed aggr thresh
call read_data(prec%aggr_omalg,psb_inp_unit) ! alg for estimating omega
call read_data(prec%aggr_eig,psb_inp_unit) ! alg for estimating omega
call read_data(prec%omega_val,psb_inp_unit) ! alg for estimating omega
! 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
call psb_bcast(icontxt,mtrx)
call psb_bcast(icontxt,rhs)
call psb_bcast(icontxt,guess)
call psb_bcast(icontxt,sol)
call psb_bcast(icontxt,filefmt)
call psb_bcast(icontxt,kmethd)
call psb_bcast(icontxt,afmt)
call psb_bcast(icontxt,ipart)
call psb_bcast(icontxt,istopc)
call psb_bcast(icontxt,itmax)
call psb_bcast(icontxt,itrace)
call psb_bcast(icontxt,irst)
call psb_bcast(icontxt,eps)
call psb_bcast(icontxt,prec%descr) ! verbose description of the prec
call psb_bcast(icontxt,prec%prec) ! overall prectype
call psb_bcast(icontxt,prec%novr) ! number of overlap layers
call psb_bcast(icontxt,prec%restr) ! restriction over application of as
call psb_bcast(icontxt,prec%prol) ! prolongation over application of as
call psb_bcast(icontxt,prec%solve) ! Factorization type: ILU, SuperLU, UMFPACK.
call psb_bcast(icontxt,prec%fill) ! Fill-in for factorization
call psb_bcast(icontxt,prec%thr) ! Threshold for fact. ILU(T)
call psb_bcast(icontxt,prec%jsweeps) ! Jacobi sweeps
if (psb_toupper(prec%prec) == 'ML') then
call psb_bcast(icontxt,prec%smther) ! Smoother type.
call psb_bcast(icontxt,prec%nlev) ! Number of levels in multilevel prec.
call psb_bcast(icontxt,prec%aggrkind) ! smoothed/raw aggregatin
call psb_bcast(icontxt,prec%aggr_alg) ! local or global aggregation
call psb_bcast(icontxt,prec%aggr_ord) ! Ordering for aggregation
call psb_bcast(icontxt,prec%mltype) ! additive or multiplicative 2nd level prec
call psb_bcast(icontxt,prec%smthpos) ! side: pre, post, both smoothing
call psb_bcast(icontxt,prec%cmat) ! coarse mat
call psb_bcast(icontxt,prec%csolve) ! Factorization type: ILU, SuperLU, UMFPACK.
call psb_bcast(icontxt,prec%csbsolve) ! Factorization type: ILU, SuperLU, UMFPACK.
call psb_bcast(icontxt,prec%cfill) ! Fill-in for factorization
call psb_bcast(icontxt,prec%cthres) ! Threshold for fact. ILU(T)
call psb_bcast(icontxt,prec%cjswp) ! Jacobi sweeps
call psb_bcast(icontxt,prec%athres) ! smoother aggr thresh
call psb_bcast(icontxt,prec%ascale) ! smoother aggr scale factor
call psb_bcast(icontxt,solve%kmethd)
call psb_bcast(icontxt,solve%istopc)
call psb_bcast(icontxt,solve%itmax)
call psb_bcast(icontxt,solve%itrace)
call psb_bcast(icontxt,solve%irst)
call psb_bcast(icontxt,solve%eps)
call psb_bcast(icontxt,prec%descr)
call psb_bcast(icontxt,prec%ptype)
! broadcast first (pre-)smoother / 1-lev prec data
call psb_bcast(icontxt,prec%smther) ! actually not needed for 1-lev precs
call psb_bcast(icontxt,prec%jsweeps)
call psb_bcast(icontxt,prec%novr)
call psb_bcast(icontxt,prec%restr)
call psb_bcast(icontxt,prec%prol)
call psb_bcast(icontxt,prec%solve)
call psb_bcast(icontxt,prec%fill)
call psb_bcast(icontxt,prec%thr)
! broadcast (other) AMG parameters
if (psb_toupper(prec%ptype) == 'ML') then
call psb_bcast(icontxt,prec%mltype)
call psb_bcast(icontxt,prec%otr_sweeps)
call psb_bcast(icontxt,prec%maxlevs)
call psb_bcast(icontxt,prec%smther2)
call psb_bcast(icontxt,prec%jsweeps2)
call psb_bcast(icontxt,prec%novr2)
call psb_bcast(icontxt,prec%restr2)
call psb_bcast(icontxt,prec%prol2)
call psb_bcast(icontxt,prec%solve2)
call psb_bcast(icontxt,prec%fill2)
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
end subroutine get_parms
subroutine pr_usage(iout)
integer(psb_ipk_) iout
write(iout, *) ' number of parameters is incorrect!'
@ -511,4 +771,5 @@ contains
write(iout, *) ' ptype partition strategy default 0'
write(iout, *) ' 0: block partition '
end subroutine pr_usage
end program mld_cf_sample

@ -4,7 +4,7 @@
! MultiLevel Domain Decomposition Parallel Preconditioners Package
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
!
! (C) Copyright 2008, 2010, 2012, 2015, 2017 , 2016
! (C) Copyright 2008, 2010, 2012, 2015, 2017
!
! Salvatore Filippone Cranfield University, UK
! Ambra Abdullahi Hassan University of Rome Tor Vergata, IT
@ -47,35 +47,83 @@ program mld_df_sample
! input parameters
character(len=40) :: kmethd, mtrx_file, rhs_file
character(len=40) :: kmethd, mtrx_file, rhs_file, guess_file, sol_file
character(len=2) :: filefmt
! 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
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_) :: jsweeps ! Jacobi/smoother sweeps
character(len=16) :: restr ! restriction over application of AS
character(len=16) :: prol ! prolongation over application of AS
character(len=16) :: solve ! factorization type: ILU, SuperLU, UMFPACK
integer(psb_ipk_) :: fill ! fillin for factorization
real(psb_dpk_) :: thr ! threshold for fact. ILU(T)
character(len=16) :: smther ! Smoother
integer(psb_ipk_) :: nlev ! number of levels in multilevel prec.
character(len=16) :: aggrkind ! smoothed, raw aggregation
character(len=16) :: aggr_alg ! aggregation algorithm (currently only decoupled)
character(len=16) :: aggr_ord ! Ordering for aggregation
character(len=16) :: mltype ! additive or multiplicative multi-level prec
character(len=16) :: smthpos ! side: pre, post, both smoothing
character(len=16) :: cmat ! coarse mat: distributed, replicated
character(len=16) :: csolve ! coarse solver: bjac, umf, slu, sludist
character(len=16) :: csbsolve ! coarse subsolver: ILU, ILU(T), SuperLU, UMFPACK
integer(psb_ipk_) :: cfill ! fillin for coarse factorization
real(psb_dpk_) :: cthres ! threshold for coarse fact. ILU(T)
integer(psb_ipk_) :: cjswp ! block-Jacobi sweeps
real(psb_dpk_) :: athres ! smoothed aggregation threshold
real(psb_dpk_) :: ascale ! smoothed aggregation scale factor
character(len=16) :: solve ! local subsolver type: ILU, MILU, ILUT,
! UMF, MUMPS, SLU, FWGS, BWGS, JAC
integer(psb_ipk_) :: fill ! fill-in for incomplete LU factorization
real(psb_dpk_) :: thr ! threshold for ILUT factorization
! AMG post-smoother; ignored by 1-lev preconditioner
character(len=16) :: smther2 ! post-smoother type: BJAC, AS
integer(psb_ipk_) :: jsweeps2 ! post-smoother sweeps
integer(psb_ipk_) :: novr2 ! number of overlap layers
character(len=16) :: restr2 ! restriction over application of AS
character(len=16) :: prol2 ! prolongation over application of AS
character(len=16) :: solve2 ! local subsolver type: ILU, MILU, ILUT,
! UMF, MUMPS, SLU, FWGS, BWGS, JAC
integer(psb_ipk_) :: fill2 ! fill-in for incomplete LU factorization
real(psb_dpk_) :: thr2 ! threshold for ILUT factorization
! coarsest-level solver
character(len=16) :: cmat ! coarsest matrix layout: REPL, DIST
character(len=16) :: csolve ! coarsest-lev solver: BJAC, SLUDIST (distr.
! mat.); UMF, MUMPS, SLU, ILU, ILUT, MILU
! (repl. mat.)
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
type(precdata) :: prec_choice
type(precdata) :: p_choice
! sparse matrices
type(psb_dspmat_type) :: a, aux_a
@ -83,10 +131,10 @@ program mld_df_sample
! preconditioner data
type(mld_dprec_type) :: prec
! dense matrices
real(psb_dpk_), allocatable, target :: aux_b(:,:), d(:)
real(psb_dpk_), allocatable, target :: aux_b(:,:), d(:), aux_g(:,:), aux_x(:,:)
real(psb_dpk_), allocatable , save :: x_col_glob(:), r_col_glob(:)
real(psb_dpk_), pointer :: b_col_glob(:)
type(psb_d_vect_type) :: b_col, x_col, r_col
real(psb_dpk_), pointer :: b_col_glob(:), ref_col_glob(:), guess_col_glob(:)
type(psb_d_vect_type) :: b_col, x_col, r_col, ref_col
! communications data structure
type(psb_desc_type):: desc_a
@ -94,24 +142,23 @@ program mld_df_sample
integer(psb_ipk_) :: ictxt, iam, np
! solver paramters
integer(psb_ipk_) :: iter, itmax, ierr, itrace, ircode, ipart,&
& methd, istopc, irst, nlv
integer(psb_ipk_) :: iter, ircode, ipart, nlv
integer(psb_long_int_k_) :: amatsize, precsize, descsize
real(psb_dpk_) :: err, eps
real(psb_dpk_) :: err
character(len=5) :: afmt
character(len=20) :: name, renum
integer(psb_ipk_), parameter :: iunit=12
integer(psb_ipk_) :: iparm(20)
character(len=40) :: fprefix
! other variables
integer(psb_ipk_) :: i,info,j,m_problem
integer(psb_ipk_) :: internal, m,ii,nnzero
integer(psb_ipk_) :: i, info, j, k, m_problem
integer(psb_ipk_) :: lbw, ubw, prf
real(psb_dpk_) :: t1, t2, tprec, thier, tslv
real(psb_dpk_) :: r_amax, b_amax, scale,resmx,resmxp
integer(psb_ipk_) :: nrhs, nrow, n_row, dim, nv, ne
integer(psb_ipk_), allocatable :: ivg(:), ipv(:)
real(psb_dpk_) :: resmx, resmxp, xdiffn2, xdiffni, xni, xn2
integer(psb_ipk_) :: nrhs, nv
integer(psb_ipk_), allocatable :: ivg(:), ipv(:), perm(:)
logical :: have_guess=.false., have_ref=.false.
call psb_init(ictxt)
call psb_info(ictxt,iam,np)
@ -131,41 +178,55 @@ program mld_df_sample
! Hello world
!
if (iam == psb_root_) then
write(*,*) 'Welcome to MLD2P4 version: ',mld_version_string_
write(*,*) 'This is the ',trim(name),' sample program'
write(psb_out_unit,*) ' '
write(psb_out_unit,*) 'Welcome to MLD2P4 version: ',mld_version_string_
write(psb_out_unit,*) 'This is the ',trim(name),' sample test program'
write(psb_out_unit,*) ' '
end if
!
! get parameters
!
call get_parms(ictxt,mtrx_file,rhs_file,filefmt,kmethd,&
& prec_choice,ipart,afmt,istopc,itmax,itrace,irst,eps)
call get_parms(ictxt,mtrx_file,rhs_file,guess_file,sol_file,filefmt, &
& ipart,afmt,s_choice,p_choice)
call psb_barrier(ictxt)
t1 = psb_wtime()
! read the input matrix to be processed and (possibly) the rhs
! read the input matrix to be processed and (possibly) the rhs,
! the initial guess and the reference solution
nrhs = 1
if (iam == psb_root_) then
select case(psb_toupper(filefmt))
case('MM')
! For Matrix Market we have an input file for the matrix
! and an (optional) second file for the RHS.
! and (optional) separate files for the rhs, the initial guess
! and the reference solution
call mm_mat_read(aux_a,info,iunit=iunit,filename=mtrx_file)
if (info == psb_success_) then
if (rhs_file /= 'NONE') then
call mm_array_read(aux_b,info,iunit=iunit,filename=rhs_file)
if ((info == psb_success_).and.(rhs_file /= 'NONE')) &
& call mm_array_read(aux_b,info,iunit=iunit,filename=rhs_file)
if ((info == psb_success_).and.(guess_file /= 'NONE')) then
call mm_array_read(aux_g,info,iunit=iunit,filename=guess_file)
have_guess = .true.
end if
if ((info == psb_success_).and.(sol_file /= 'NONE')) then
call mm_array_read(aux_x,info,iunit=iunit,filename=sol_file)
have_ref = .true.
end if
case ('HB')
! For Harwell-Boeing we have a single file which may or may not
! contain an RHS.
call hb_read(aux_a,info,iunit=iunit,b=aux_b,filename=mtrx_file)
! contain rhs, initial guess and reference solution.
call hb_read(aux_a,info,iunit=iunit,b=aux_b,&
& g=aux_g,x=aux_x,filename=mtrx_file)
have_guess = allocated(aux_g)
have_ref = allocated(aux_x)
case default
info = -1
write(psb_err_unit,*) 'Wrong choice for fileformat ', filefmt
end select
if (info /= psb_success_) then
write(psb_err_unit,*) 'Error while reading input matrix '
call psb_abort(ictxt)
@ -173,6 +234,8 @@ program mld_df_sample
m_problem = aux_a%get_nrows()
call psb_bcast(ictxt,m_problem)
call psb_bcast(ictxt,have_guess)
call psb_bcast(ictxt,have_ref)
! At this point aux_b may still be unallocated
if (psb_size(aux_b,dim=ione) == m_problem) then
@ -181,23 +244,81 @@ program mld_df_sample
b_col_glob =>aux_b(:,1)
else
write(psb_out_unit,'("Generating an rhs...")')
write(psb_out_unit,'(" ")')
call psb_realloc(m_problem,1,aux_b,ircode)
if (ircode /= 0) then
call psb_errpush(psb_err_alloc_dealloc_,name)
goto 9999
endif
b_col_glob => aux_b(:,1)
do i=1, m_problem
b_col_glob(i) = 1.d0
enddo
endif
if ((have_guess).and.(psb_size(aux_g,dim=ione) == m_problem)) then
! if any initial guess were present, broadcast the first one
write(psb_err_unit,'("Ok, got an initial guess ")')
guess_col_glob =>aux_g(:,1)
else
write(psb_out_unit,'("Generating an initial guess...")')
call psb_realloc(m_problem,1,aux_g,ircode)
if (ircode /= 0) then
call psb_errpush(psb_err_alloc_dealloc_,name)
goto 9999
endif
guess_col_glob => aux_g(:,1)
do i=1, m_problem
guess_col_glob(i) = 0.d0
enddo
endif
if ((have_ref).and.(psb_size(aux_x,dim=ione) == m_problem)) then
! if any reference were present, broadcast the first one
write(psb_err_unit,'("Ok, got a reference solution ")')
ref_col_glob =>aux_x(:,1)
else
write(psb_out_unit,'("No reference solution...")')
endif
! clean zeros in the input matrix
call aux_a%clean_zeros(info)
else
call psb_bcast(ictxt,m_problem)
call psb_bcast(ictxt,have_guess)
call psb_bcast(ictxt,have_ref)
end if
!
! Renumbering (NONE for the moment)
!
if (iam==psb_root_) then
renum='NONE'
call psb_cmp_bwpf(aux_a,lbw,ubw,prf,info)
write(psb_out_unit,'(" ")')
write(psb_out_unit,*) 'Bandwidth and profile: ',lbw,ubw,prf
write(psb_out_unit,*) 'Renumbering algorithm: ',psb_toupper(renum)
if (trim(psb_toupper(renum))/='NONE') then
call psb_mat_renum(renum,aux_a,info,perm=perm)
if (info /= 0) then
write(psb_err_unit,*) 'Error from RENUM',info
goto 9999
end if
call psb_gelp('N',perm(1:m_problem),b_col_glob(1:m_problem),info)
call psb_cmp_bwpf(aux_a,lbw,ubw,prf,info)
write(psb_out_unit,*) 'Bandwidth and profile (renumberd):',lbw,ubw,prf
end if
write(psb_out_unit,'(" ")')
end if
!
! switch over different partition types
!
if (ipart == 0) then
call psb_barrier(ictxt)
if (iam == psb_root_) write(psb_out_unit,'("Partition type: block")')
@ -211,10 +332,8 @@ program mld_df_sample
if (iam == psb_root_) then
write(psb_out_unit,'("Partition type: graph")')
write(psb_out_unit,'(" ")')
! write(psb_err_unit,'("Build type: graph")')
call build_mtpart(aux_a,np)
endif
!!$ call psb_barrier(ictxt)
call distr_mtpart(psb_root_,ictxt)
call getv_mtpart(ivg)
call psb_matdist(aux_a, a, ictxt,desc_a,info,fmt=afmt,v=ivg)
@ -223,89 +342,136 @@ program mld_df_sample
call psb_matdist(aux_a, a, ictxt, desc_a,info,fmt=afmt,parts=part_block)
end if
call psb_scatter(b_col_glob,b_col,desc_a,info,root=psb_root_)
!
! Scatter rhs, initial guess and reference solution
!
call psb_geall(b_col,desc_a,info)
call psb_geall(x_col,desc_a,info)
call x_col%zero()
call psb_geasb(x_col,desc_a,info)
call psb_geall(r_col,desc_a,info)
call r_col%zero()
call psb_geasb(r_col,desc_a,info)
t2 = psb_wtime() - t1
if (have_ref) call psb_geall(ref_col,desc_a,info)
if (iam == psb_root_) write(psb_out_unit,'("Scatter rhs")')
call psb_scatter(b_col_glob,b_col,desc_a,info)
if (iam == psb_root_) write(psb_out_unit,'("Scatter initial guess")')
call psb_scatter(guess_col_glob,x_col,desc_a,info)
if (have_ref) then
if (iam == psb_root_) write(psb_out_unit,'("Scatter reference solution")')
call psb_scatter(ref_col_glob,ref_col,desc_a,info)
end if
t2 = psb_wtime() - t1
call psb_amx(ictxt, t2)
if (iam == psb_root_) then
write(psb_out_unit,'(" ")')
write(psb_out_unit,'("Time to read and partition matrix : ",es12.5)')t2
write(psb_out_unit,'("Time to read and partition matrix, rhs(, guess, ref sol) : ",es12.5)')t2
write(psb_out_unit,'(" ")')
write(psb_out_unit,*) 'Preconditioner: ',prec_choice%descr
end if
!
! initialize the preconditioner
!
if (psb_toupper(p_choice%ptype) == 'ML') then
! multilevel preconditioner
call prec%init(p_choice%ptype,info)
call prec%set('ml_type', p_choice%mltype, info)
call prec%set('outer_sweeps', p_choice%otr_sweeps,info)
if (p_choice%csize>0)&
& call prec%set('coarse_aggr_size', p_choice%csize, info)
if (p_choice%mnaggratio>0)&
& call prec%set('min_aggr_ratio', p_choice%mnaggratio, info)
if (p_choice%maxlevs>0)&
& call prec%set('max_prec_levs', p_choice%maxlevs, info)
if (p_choice%ascale > dzero) &
& 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
if (psb_toupper(prec_choice%prec) == 'ML') then
call mld_precinit(prec,prec_choice%prec, info)
if (prec_choice%nlev > 0) &
& call mld_precset(prec,'max_prec_levs', prec_choice%nlev, info)
call mld_precset(prec,'aggr_kind', prec_choice%aggrkind,info)
call mld_precset(prec,'aggr_alg', prec_choice%aggr_alg,info)
call mld_precset(prec,'aggr_ord', prec_choice%aggr_ord,info)
call mld_precset(prec,'aggr_scale', prec_choice%ascale, info)
call mld_precset(prec,'aggr_thresh', prec_choice%athres, info)
call mld_precset(prec,'smoother_type', prec_choice%smther, info)
call mld_precset(prec,'smoother_sweeps', prec_choice%jsweeps, info)
call mld_precset(prec,'sub_ovr', prec_choice%novr, info)
call mld_precset(prec,'sub_restr', prec_choice%restr, info)
call mld_precset(prec,'sub_prol', prec_choice%prol, info)
call mld_precset(prec,'sub_solve', prec_choice%solve, info)
call mld_precset(prec,'sub_fillin', prec_choice%fill, info)
call mld_precset(prec,'sub_iluthrs', prec_choice%thr, info)
call mld_precset(prec,'ml_type', prec_choice%mltype, info)
call mld_precset(prec,'smoother_pos', prec_choice%smthpos, info)
call mld_precset(prec,'coarse_solve', prec_choice%csolve, info)
call mld_precset(prec,'coarse_subsolve', prec_choice%csbsolve,info)
call mld_precset(prec,'coarse_mat', prec_choice%cmat, info)
call mld_precset(prec,'coarse_fillin', prec_choice%cfill, info)
call mld_precset(prec,'coarse_iluthrs', prec_choice%cthres, info)
call mld_precset(prec,'coarse_sweeps', prec_choice%cjswp, info)
! building the preconditioner
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)
t1 = psb_wtime()
call mld_hierarchy_bld(a,desc_a,prec,info)
call prec%hierarchy_build(a,desc_a,info)
thier = psb_wtime()-t1
if (info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='psb_precbld')
call psb_errpush(psb_err_from_subroutine_,name,a_err='mld_hierarchy_bld')
goto 9999
end if
call psb_barrier(ictxt)
t1 = psb_wtime()
call mld_smoothers_bld(a,desc_a,prec,info)
call prec%smoothers_build(a,desc_a,info)
tprec = psb_wtime()-t1
if (info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='psb_precbld')
call psb_errpush(psb_err_from_subroutine_,name,a_err='mld_smoothers_bld')
goto 9999
end if
else
! 1-level preconditioner
nlv = 1
call mld_precinit(prec,prec_choice%prec,info)
if (psb_toupper(prec_choice%prec) /= 'NONE') then
call mld_precset(prec,'smoother_sweeps', prec_choice%jsweeps, info)
call mld_precset(prec,'sub_ovr', prec_choice%novr, info)
call mld_precset(prec,'sub_restr', prec_choice%restr, info)
call mld_precset(prec,'sub_prol', prec_choice%prol, info)
call mld_precset(prec,'sub_solve', prec_choice%solve, info)
call mld_precset(prec,'sub_fillin', prec_choice%fill, info)
call mld_precset(prec,'sub_iluthrs', prec_choice%thr, info)
call prec%init(p_choice%ptype,info)
if (psb_toupper(p_choice%ptype) /= 'NONE') then
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)
!!! call prec%set('solver_sweeps', p_choice%svsweeps, info)
end if
! building the preconditioner
! build the preconditioner
thier = dzero
t1 = psb_wtime()
call mld_precbld(a,desc_a,prec,info)
call prec%build(a,desc_a,info)
tprec = psb_wtime()-t1
if (info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='psb_precbld')
call psb_errpush(psb_err_from_subroutine_,name,a_err='mld_precbld')
goto 9999
end if
end if
@ -314,6 +480,8 @@ program mld_df_sample
call psb_amx(ictxt, tprec)
if(iam == psb_root_) then
write(psb_out_unit,'(" ")')
write(psb_out_unit,'("Preconditioner: ",a)') trim(p_choice%descr)
write(psb_out_unit,'("Preconditioner time: ",es12.5)')thier+tprec
write(psb_out_unit,'(" ")')
end if
@ -321,43 +489,71 @@ program mld_df_sample
iparm = 0
call psb_barrier(ictxt)
t1 = psb_wtime()
call psb_krylov(kmethd,a,prec,b_col,x_col,eps,desc_a,info,&
& itmax=itmax,iter=iter,err=err,itrace=itrace,istop=istopc,irst=irst)
call psb_krylov(s_choice%kmethd,a,prec,b_col,x_col,s_choice%eps,&
& 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)
! compute residual norms
call psb_geall(r_col,desc_a,info)
call r_col%zero()
call psb_geasb(r_col,desc_a,info)
call psb_geaxpby(done,b_col,dzero,r_col,desc_a,info)
call psb_spmm(-done,a,x_col,done,r_col,desc_a,info)
resmx = psb_genrm2(r_col,desc_a,info)
resmxp = psb_geamax(r_col,desc_a,info)
! compute error in solution
if (have_ref) then
call psb_geaxpby(-done,x_col,done,ref_col,desc_a,info)
xdiffn2 = psb_genrm2(ref_col,desc_a,info)
xdiffni = psb_geamax(ref_col,desc_a,info)
xn2 = psb_genrm2(ref_col,desc_a,info)
xni = psb_geamax(ref_col,desc_a,info)
end if
amatsize = a%sizeof()
descsize = desc_a%sizeof()
precsize = prec%sizeof()
call psb_sum(ictxt,amatsize)
call psb_sum(ictxt,descsize)
call psb_sum(ictxt,precsize)
call prec%descr(info)
if (iam == psb_root_) then
call mld_precdescr(prec,info)
write(psb_out_unit,'("Matrix: ",a)')mtrx_file
write(psb_out_unit,'("Computed solution on ",i8," processors")')np
write(psb_out_unit,'("Iterations to convergence : ",i6)')iter
write(psb_out_unit,'("Error estimate on exit : ",es12.5)')err
write(psb_out_unit,'("Krylov method : ",a)') trim(s_choice%kmethd)
write(psb_out_unit,'("Preconditioner : ",a)') trim(p_choice%descr)
write(psb_out_unit,'("Iterations to convergence : ",i12)')iter
write(psb_out_unit,'("Relative error estimate on exit : ",es12.5)') err
write(psb_out_unit,'("Number of levels in hierarchy : ",i12)') prec%get_nlevs()
write(psb_out_unit,'("Time to build hierarchy : ",es12.5)')thier
write(psb_out_unit,'("Time to build smoothers : ",es12.5)')tprec
write(psb_out_unit,'("Total time for preconditioner : ",es12.5)')tprec+thier
write(psb_out_unit,'("Time to solve system : ",es12.5)')tslv
write(psb_out_unit,'("Time per iteration : ",es12.5)')tslv/(iter)
write(psb_out_unit,'("Total time : ",es12.5)')tslv+tprec
write(psb_out_unit,'("Residual norm 2 : ",es12.5)')resmx
write(psb_out_unit,'("Residual norm inf : ",es12.5)')resmxp
write(psb_out_unit,'("Time per iteration : ",es12.5)')tslv/iter
write(psb_out_unit,'("Total time : ",es12.5)')tslv+tprec+thier
write(psb_out_unit,'("Residual 2-norm : ",es12.5)')resmx
write(psb_out_unit,'("Residual inf-norm : ",es12.5)')resmxp
write(psb_out_unit,'("Total memory occupation for A : ",i12)')amatsize
write(psb_out_unit,'("Total memory occupation for DESC_A : ",i12)')descsize
write(psb_out_unit,'("Total memory occupation for PREC : ",i12)')precsize
write(psb_out_unit,'("Storage format for A : ",a )')a%get_fmt()
write(psb_out_unit,'("Storage format for DESC_A : ",a )')desc_a%get_fmt()
if (have_ref) then
write(psb_out_unit,'(" ")')
write(psb_out_unit,'(2x,a10,9x,a8,4x,a20,5x,a8)') &
& '||X-XREF||','||XREF||','||X-XREF||/||XREF||','(2-norm)'
write(psb_out_unit,'(1x,3(e12.6,6x))') xdiffn2,xn2,xdiffn2/xn2
write(psb_out_unit,'(" ")')
write(psb_out_unit,'(2x,a10,9x,a8,4x,a20,4x,a10)') &
& '||X-XREF||','||XREF||','||X-XREF||/||XREF||','(inf-norm)'
write(psb_out_unit,'(1x,3(e12.6,6x))') xdiffni,xni,xdiffni/xni
end if
end if
call psb_gather(x_col_glob,x_col,desc_a,info,root=psb_root_)
@ -367,13 +563,15 @@ program mld_df_sample
if (iam == psb_root_) then
write(psb_err_unit,'(" ")')
write(psb_err_unit,'("Saving x on file")')
write(20,*) 'matrix: ',mtrx_file
write(20,*) 'computed solution on ',np,' processors.'
write(20,*) 'iterations to convergence: ',iter
write(20,*) 'error estimate (infinity norm) on exit:', &
& ' ||r||/(||a||||x||+||b||) = ',err
write(20,'("Residual norm 2 : ",es12.5)')resmx
write(20,'("Residual norm inf : ",es12.5)')resmxp
write(20,*) 'Matrix: ',mtrx_file
write(20,*) 'Krylov method:',trim(s_choice%kmethd)
write(20,*) 'Preconditioner:',trim(p_choice%descr)
write(20,*) 'Computed solution on ',np,' processors.'
write(20,*) 'Iterations to convergence: ',iter
write(20,*) 'Error estimate (infinity norm) on exit:', &
& ' ||r||/||b|| (inf-norm) = ',err
write(20,'(" Residual 2-norm 2 : ",es12.5)')resmx
write(20,'(" Residual inf-norm : ",es12.5)')resmxp
write(20,'(a8,4(2x,a20))') 'I','X(I)','R(I)','B(I)'
do i=1,m_problem
write(20,998) i,x_col_glob(i),r_col_glob(i),b_col_glob(i)
@ -383,10 +581,12 @@ program mld_df_sample
993 format(i6,4(1x,e12.6))
call psb_gefree(b_col, desc_a,info)
call psb_gefree(x_col, desc_a,info)
call psb_gefree(b_col,desc_a,info)
call psb_gefree(x_col,desc_a,info)
call psb_gefree(r_col,desc_a,info)
call psb_gefree(ref_col,desc_a,info)
call psb_spfree(a, desc_a,info)
call mld_precfree(prec,info)
call prec%free(info)
call psb_cdfree(desc_a,info)
call psb_exit(ictxt)
@ -399,101 +599,161 @@ contains
!
! get iteration parameters from standard input
!
subroutine get_parms(icontxt,mtrx,rhs,filefmt,kmethd,&
& prec, ipart,afmt,istopc,itmax,itrace,irst,eps)
subroutine get_parms(icontxt,mtrx,rhs,guess,sol,filefmt,ipart,afmt,solve,prec)
use psb_base_mod
implicit none
integer(psb_ipk_) :: icontxt
character(len=*) :: kmethd, mtrx, rhs, afmt,filefmt
integer(psb_ipk_) :: icontxt, ipart
character(len=*) :: mtrx, rhs, guess, sol, filefmt, afmt
type(solverdata) :: solve
type(precdata) :: prec
real(psb_dpk_) :: eps
integer(psb_ipk_) :: iret, istopc,itmax,itrace, ipart, irst
integer(psb_ipk_) :: iam, nm, np, i
integer(psb_ipk_) :: iam, nm, np
call psb_info(icontxt,iam,np)
if (iam == psb_root_) then
! read input parameters
call read_data(mtrx,psb_inp_unit)
call read_data(rhs,psb_inp_unit)
call read_data(filefmt,psb_inp_unit)
call read_data(kmethd,psb_inp_unit)
call read_data(afmt,psb_inp_unit)
call read_data(ipart,psb_inp_unit)
call read_data(istopc,psb_inp_unit)
call read_data(itmax,psb_inp_unit)
call read_data(itrace,psb_inp_unit)
call read_data(irst,psb_inp_unit)
call read_data(eps,psb_inp_unit)
! read input data
!
! input files
call read_data(mtrx,psb_inp_unit) ! matrix file
call read_data(rhs,psb_inp_unit) ! rhs file
call read_data(guess,psb_inp_unit) ! starting guess file
call read_data(sol,psb_inp_unit) ! solution file (for comparison)
call read_data(filefmt,psb_inp_unit) ! format of files
call read_data(afmt,psb_inp_unit) ! matrix storage format
call read_data(ipart,psb_inp_unit) ! partition type
! Krylov solver data
call read_data(solve%kmethd,psb_inp_unit) ! Krylov solver
call read_data(solve%istopc,psb_inp_unit) ! stopping criterion
call read_data(solve%itmax,psb_inp_unit) ! max num iterations
call read_data(solve%itrace,psb_inp_unit) ! tracing
call read_data(solve%irst,psb_inp_unit) ! restart
call read_data(solve%eps,psb_inp_unit) ! tolerance
! preconditioner type
call read_data(prec%descr,psb_inp_unit) ! verbose description of the prec
call read_data(prec%prec,psb_inp_unit) ! overall prectype
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) ! Factorization type: ILU, SuperLU, UMFPACK.
call read_data(prec%fill,psb_inp_unit) ! Fill-in for factorization
call read_data(prec%thr,psb_inp_unit) ! Threshold for fact. ILU(T)
call read_data(prec%jsweeps,psb_inp_unit) ! Jacobi sweeps for PJAC
if (psb_toupper(prec%prec) == 'ML') then
call read_data(prec%nlev,psb_inp_unit) ! Number of levels in multilevel prec.
call read_data(prec%smther,psb_inp_unit) ! Smoother type.
call read_data(prec%aggrkind,psb_inp_unit) ! smoothed/raw aggregatin
call read_data(prec%aggr_alg,psb_inp_unit) ! local or global aggregation
call read_data(prec%aggr_ord,psb_inp_unit) ! Ordering for aggregation
call read_data(prec%mltype,psb_inp_unit) ! additive or multiplicative 2nd level prec
call read_data(prec%smthpos,psb_inp_unit) ! side: pre, post, both smoothing
call read_data(prec%cmat,psb_inp_unit) ! coarse mat
call read_data(prec%csolve,psb_inp_unit) ! Factorization type: BJAC, SuperLU, UMFPACK.
call read_data(prec%csbsolve,psb_inp_unit) ! Factorization type: ILU, SuperLU, UMFPACK.
call read_data(prec%cfill,psb_inp_unit) ! Fill-in for factorization
call read_data(prec%cthres,psb_inp_unit) ! Threshold for fact. ILU(T)
call read_data(prec%cjswp,psb_inp_unit) ! Jacobi sweeps
call read_data(prec%athres,psb_inp_unit) ! smoother aggr thresh
call read_data(prec%ascale,psb_inp_unit) ! smoother aggr thresh
call read_data(prec%ptype,psb_inp_unit) ! preconditioner type
! general AMG data
call read_data(prec%mltype,psb_inp_unit) ! AMG cycle type
call read_data(prec%otr_sweeps,psb_inp_unit) ! number of AMG cycles
call read_data(prec%maxlevs,psb_inp_unit) ! max number of levels in AMG prec
call read_data(prec%csize,psb_inp_unit) ! min size coarsest mat
! aggregation
call read_data(prec%aggrkind,psb_inp_unit) ! aggregation type
call read_data(prec%aggr_alg,psb_inp_unit) ! parallel aggregation alg
call read_data(prec%aggr_ord,psb_inp_unit) ! ordering for aggregation
call read_data(prec%aggr_filter,psb_inp_unit) ! filtering
call read_data(prec%mnaggratio,psb_inp_unit) ! minimum aggregation ratio
call read_data(prec%thrvsz,psb_inp_unit) ! size of aggr thresh vector
if (prec%thrvsz > 0) then
call psb_realloc(prec%thrvsz,prec%athresv,info)
call read_data(prec%athresv,psb_inp_unit) ! aggr thresh vector
else
read(psb_inp_unit,*) ! dummy read to skip a record
end if
call read_data(prec%athres,psb_inp_unit) ! smoothed aggr thresh
call read_data(prec%aggr_omalg,psb_inp_unit) ! alg for estimating omega
call read_data(prec%aggr_eig,psb_inp_unit) ! alg for estimating omega
call read_data(prec%omega_val,psb_inp_unit) ! alg for estimating omega
! 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
call psb_bcast(icontxt,mtrx)
call psb_bcast(icontxt,rhs)
call psb_bcast(icontxt,guess)
call psb_bcast(icontxt,sol)
call psb_bcast(icontxt,filefmt)
call psb_bcast(icontxt,kmethd)
call psb_bcast(icontxt,afmt)
call psb_bcast(icontxt,ipart)
call psb_bcast(icontxt,istopc)
call psb_bcast(icontxt,itmax)
call psb_bcast(icontxt,itrace)
call psb_bcast(icontxt,irst)
call psb_bcast(icontxt,eps)
call psb_bcast(icontxt,prec%descr) ! verbose description of the prec
call psb_bcast(icontxt,prec%prec) ! overall prectype
call psb_bcast(icontxt,prec%novr) ! number of overlap layers
call psb_bcast(icontxt,prec%restr) ! restriction over application of as
call psb_bcast(icontxt,prec%prol) ! prolongation over application of as
call psb_bcast(icontxt,prec%solve) ! Factorization type: ILU, SuperLU, UMFPACK.
call psb_bcast(icontxt,prec%fill) ! Fill-in for factorization
call psb_bcast(icontxt,prec%thr) ! Threshold for fact. ILU(T)
call psb_bcast(icontxt,prec%jsweeps) ! Jacobi sweeps
if (psb_toupper(prec%prec) == 'ML') then
call psb_bcast(icontxt,prec%smther) ! Smoother type.
call psb_bcast(icontxt,prec%nlev) ! Number of levels in multilevel prec.
call psb_bcast(icontxt,prec%aggrkind) ! smoothed/raw aggregatin
call psb_bcast(icontxt,prec%aggr_alg) ! local or global aggregation
call psb_bcast(icontxt,prec%aggr_ord) ! Ordering for aggregation
call psb_bcast(icontxt,prec%mltype) ! additive or multiplicative 2nd level prec
call psb_bcast(icontxt,prec%smthpos) ! side: pre, post, both smoothing
call psb_bcast(icontxt,prec%cmat) ! coarse mat
call psb_bcast(icontxt,prec%csolve) ! Factorization type: ILU, SuperLU, UMFPACK.
call psb_bcast(icontxt,prec%csbsolve) ! Factorization type: ILU, SuperLU, UMFPACK.
call psb_bcast(icontxt,prec%cfill) ! Fill-in for factorization
call psb_bcast(icontxt,prec%cthres) ! Threshold for fact. ILU(T)
call psb_bcast(icontxt,prec%cjswp) ! Jacobi sweeps
call psb_bcast(icontxt,prec%athres) ! smoother aggr thresh
call psb_bcast(icontxt,prec%ascale) ! smoother aggr scale factor
call psb_bcast(icontxt,solve%kmethd)
call psb_bcast(icontxt,solve%istopc)
call psb_bcast(icontxt,solve%itmax)
call psb_bcast(icontxt,solve%itrace)
call psb_bcast(icontxt,solve%irst)
call psb_bcast(icontxt,solve%eps)
call psb_bcast(icontxt,prec%descr)
call psb_bcast(icontxt,prec%ptype)
! broadcast first (pre-)smoother / 1-lev prec data
call psb_bcast(icontxt,prec%smther) ! actually not needed for 1-lev precs
call psb_bcast(icontxt,prec%jsweeps)
call psb_bcast(icontxt,prec%novr)
call psb_bcast(icontxt,prec%restr)
call psb_bcast(icontxt,prec%prol)
call psb_bcast(icontxt,prec%solve)
call psb_bcast(icontxt,prec%fill)
call psb_bcast(icontxt,prec%thr)
! broadcast (other) AMG parameters
if (psb_toupper(prec%ptype) == 'ML') then
call psb_bcast(icontxt,prec%mltype)
call psb_bcast(icontxt,prec%otr_sweeps)
call psb_bcast(icontxt,prec%maxlevs)
call psb_bcast(icontxt,prec%smther2)
call psb_bcast(icontxt,prec%jsweeps2)
call psb_bcast(icontxt,prec%novr2)
call psb_bcast(icontxt,prec%restr2)
call psb_bcast(icontxt,prec%prol2)
call psb_bcast(icontxt,prec%solve2)
call psb_bcast(icontxt,prec%fill2)
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
end subroutine get_parms
subroutine pr_usage(iout)
integer(psb_ipk_) iout
write(iout, *) ' number of parameters is incorrect!'
@ -511,4 +771,5 @@ contains
write(iout, *) ' ptype partition strategy default 0'
write(iout, *) ' 0: block partition '
end subroutine pr_usage
end program mld_df_sample

@ -4,7 +4,7 @@
! MultiLevel Domain Decomposition Parallel Preconditioners Package
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
!
! (C) Copyright 2008, 2010, 2012, 2015, 2017 , 2016
! (C) Copyright 2008, 2010, 2012, 2015, 2017
!
! Salvatore Filippone Cranfield University, UK
! Ambra Abdullahi Hassan University of Rome Tor Vergata, IT
@ -47,35 +47,83 @@ program mld_sf_sample
! input parameters
character(len=40) :: kmethd, mtrx_file, rhs_file
character(len=40) :: kmethd, mtrx_file, rhs_file, guess_file, sol_file
character(len=2) :: filefmt
! 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
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_) :: jsweeps ! Jacobi/smoother sweeps
character(len=16) :: restr ! restriction over application of AS
character(len=16) :: prol ! prolongation over application of AS
character(len=16) :: solve ! factorization type: ILU, SuperLU, UMFPACK
integer(psb_ipk_) :: fill ! fillin for factorization
real(psb_spk_) :: thr ! threshold for fact. ILU(T)
character(len=16) :: smther ! Smoother
integer(psb_ipk_) :: nlev ! number of levels in multilevel prec.
character(len=16) :: aggrkind ! smoothed, raw aggregation
character(len=16) :: aggr_alg ! aggregation algorithm (currently only decoupled)
character(len=16) :: aggr_ord ! Ordering for aggregation
character(len=16) :: mltype ! additive or multiplicative multi-level prec
character(len=16) :: smthpos ! side: pre, post, both smoothing
character(len=16) :: cmat ! coarse mat: distributed, replicated
character(len=16) :: csolve ! coarse solver: bjac, umf, slu, sludist
character(len=16) :: csbsolve ! coarse subsolver: ILU, ILU(T), SuperLU, UMFPACK
integer(psb_ipk_) :: cfill ! fillin for coarse factorization
real(psb_spk_) :: cthres ! threshold for coarse fact. ILU(T)
integer(psb_ipk_) :: cjswp ! block-Jacobi sweeps
real(psb_spk_) :: athres ! smoothed aggregation threshold
real(psb_spk_) :: ascale ! smoothed aggregation scale factor
character(len=16) :: solve ! local subsolver type: ILU, MILU, ILUT,
! UMF, MUMPS, SLU, FWGS, BWGS, JAC
integer(psb_ipk_) :: fill ! fill-in for incomplete LU factorization
real(psb_spk_) :: thr ! threshold for ILUT factorization
! AMG post-smoother; ignored by 1-lev preconditioner
character(len=16) :: smther2 ! post-smoother type: BJAC, AS
integer(psb_ipk_) :: jsweeps2 ! post-smoother sweeps
integer(psb_ipk_) :: novr2 ! number of overlap layers
character(len=16) :: restr2 ! restriction over application of AS
character(len=16) :: prol2 ! prolongation over application of AS
character(len=16) :: solve2 ! local subsolver type: ILU, MILU, ILUT,
! UMF, MUMPS, SLU, FWGS, BWGS, JAC
integer(psb_ipk_) :: fill2 ! fill-in for incomplete LU factorization
real(psb_spk_) :: thr2 ! threshold for ILUT factorization
! coarsest-level solver
character(len=16) :: cmat ! coarsest matrix layout: REPL, DIST
character(len=16) :: csolve ! coarsest-lev solver: BJAC, SLUDIST (distr.
! mat.); UMF, MUMPS, SLU, ILU, ILUT, MILU
! (repl. mat.)
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
type(precdata) :: prec_choice
type(precdata) :: p_choice
! sparse matrices
type(psb_sspmat_type) :: a, aux_a
@ -83,10 +131,10 @@ program mld_sf_sample
! preconditioner data
type(mld_sprec_type) :: prec
! dense matrices
real(psb_spk_), allocatable, target :: aux_b(:,:), d(:)
real(psb_spk_), allocatable, target :: aux_b(:,:), d(:), aux_g(:,:), aux_x(:,:)
real(psb_spk_), allocatable , save :: x_col_glob(:), r_col_glob(:)
real(psb_spk_), pointer :: b_col_glob(:)
type(psb_s_vect_type) :: b_col, x_col, r_col
real(psb_spk_), pointer :: b_col_glob(:), ref_col_glob(:), guess_col_glob(:)
type(psb_s_vect_type) :: b_col, x_col, r_col, ref_col
! communications data structure
type(psb_desc_type):: desc_a
@ -94,24 +142,23 @@ program mld_sf_sample
integer(psb_ipk_) :: ictxt, iam, np
! solver paramters
integer(psb_ipk_) :: iter, itmax, ierr, itrace, ircode, ipart,&
& methd, istopc, irst, nlv
integer(psb_ipk_) :: iter, ircode, ipart, nlv
integer(psb_long_int_k_) :: amatsize, precsize, descsize
real(psb_spk_) :: err, eps
real(psb_spk_) :: err
character(len=5) :: afmt
character(len=20) :: name, renum
integer(psb_ipk_), parameter :: iunit=12
integer(psb_ipk_) :: iparm(20)
character(len=40) :: fprefix
! other variables
integer(psb_ipk_) :: i,info,j,m_problem
integer(psb_ipk_) :: internal, m,ii,nnzero
real(psb_spk_) :: t1, t2, tprec, thier, tslv
real(psb_spk_) :: r_amax, b_amax, scale,resmx,resmxp
integer(psb_ipk_) :: nrhs, nrow, n_row, dim, nv, ne
integer(psb_ipk_), allocatable :: ivg(:), ipv(:)
integer(psb_ipk_) :: i, info, j, k, m_problem
integer(psb_ipk_) :: lbw, ubw, prf
real(psb_dpk_) :: t1, t2, tprec, thier, tslv
real(psb_spk_) :: resmx, resmxp, xdiffn2, xdiffni, xni, xn2
integer(psb_ipk_) :: nrhs, nv
integer(psb_ipk_), allocatable :: ivg(:), ipv(:), perm(:)
logical :: have_guess=.false., have_ref=.false.
call psb_init(ictxt)
call psb_info(ictxt,iam,np)
@ -131,41 +178,55 @@ program mld_sf_sample
! Hello world
!
if (iam == psb_root_) then
write(*,*) 'Welcome to MLD2P4 version: ',mld_version_string_
write(*,*) 'This is the ',trim(name),' sample program'
write(psb_out_unit,*) ' '
write(psb_out_unit,*) 'Welcome to MLD2P4 version: ',mld_version_string_
write(psb_out_unit,*) 'This is the ',trim(name),' sample test program'
write(psb_out_unit,*) ' '
end if
!
! get parameters
!
call get_parms(ictxt,mtrx_file,rhs_file,filefmt,kmethd,&
& prec_choice,ipart,afmt,istopc,itmax,itrace,irst,eps)
call get_parms(ictxt,mtrx_file,rhs_file,guess_file,sol_file,filefmt, &
& ipart,afmt,s_choice,p_choice)
call psb_barrier(ictxt)
t1 = psb_wtime()
! read the input matrix to be processed and (possibly) the rhs
! read the input matrix to be processed and (possibly) the rhs,
! the initial guess and the reference solution
nrhs = 1
if (iam == psb_root_) then
select case(psb_toupper(filefmt))
case('MM')
! For Matrix Market we have an input file for the matrix
! and an (optional) second file for the RHS.
! and (optional) separate files for the rhs, the initial guess
! and the reference solution
call mm_mat_read(aux_a,info,iunit=iunit,filename=mtrx_file)
if (info == psb_success_) then
if (rhs_file /= 'NONE') then
call mm_array_read(aux_b,info,iunit=iunit,filename=rhs_file)
if ((info == psb_success_).and.(rhs_file /= 'NONE')) &
& call mm_array_read(aux_b,info,iunit=iunit,filename=rhs_file)
if ((info == psb_success_).and.(guess_file /= 'NONE')) then
call mm_array_read(aux_g,info,iunit=iunit,filename=guess_file)
have_guess = .true.
end if
if ((info == psb_success_).and.(sol_file /= 'NONE')) then
call mm_array_read(aux_x,info,iunit=iunit,filename=sol_file)
have_ref = .true.
end if
case ('HB')
! For Harwell-Boeing we have a single file which may or may not
! contain an RHS.
call hb_read(aux_a,info,iunit=iunit,b=aux_b,filename=mtrx_file)
! contain rhs, initial guess and reference solution.
call hb_read(aux_a,info,iunit=iunit,b=aux_b,&
& g=aux_g,x=aux_x,filename=mtrx_file)
have_guess = allocated(aux_g)
have_ref = allocated(aux_x)
case default
info = -1
write(psb_err_unit,*) 'Wrong choice for fileformat ', filefmt
end select
if (info /= psb_success_) then
write(psb_err_unit,*) 'Error while reading input matrix '
call psb_abort(ictxt)
@ -173,6 +234,8 @@ program mld_sf_sample
m_problem = aux_a%get_nrows()
call psb_bcast(ictxt,m_problem)
call psb_bcast(ictxt,have_guess)
call psb_bcast(ictxt,have_ref)
! At this point aux_b may still be unallocated
if (psb_size(aux_b,dim=ione) == m_problem) then
@ -181,23 +244,81 @@ program mld_sf_sample
b_col_glob =>aux_b(:,1)
else
write(psb_out_unit,'("Generating an rhs...")')
write(psb_out_unit,'(" ")')
call psb_realloc(m_problem,1,aux_b,ircode)
if (ircode /= 0) then
call psb_errpush(psb_err_alloc_dealloc_,name)
goto 9999
endif
b_col_glob => aux_b(:,1)
do i=1, m_problem
b_col_glob(i) = 1.d0
enddo
endif
if ((have_guess).and.(psb_size(aux_g,dim=ione) == m_problem)) then
! if any initial guess were present, broadcast the first one
write(psb_err_unit,'("Ok, got an initial guess ")')
guess_col_glob =>aux_g(:,1)
else
write(psb_out_unit,'("Generating an initial guess...")')
call psb_realloc(m_problem,1,aux_g,ircode)
if (ircode /= 0) then
call psb_errpush(psb_err_alloc_dealloc_,name)
goto 9999
endif
guess_col_glob => aux_g(:,1)
do i=1, m_problem
guess_col_glob(i) = 0.d0
enddo
endif
if ((have_ref).and.(psb_size(aux_x,dim=ione) == m_problem)) then
! if any reference were present, broadcast the first one
write(psb_err_unit,'("Ok, got a reference solution ")')
ref_col_glob =>aux_x(:,1)
else
write(psb_out_unit,'("No reference solution...")')
endif
! clean zeros in the input matrix
call aux_a%clean_zeros(info)
else
call psb_bcast(ictxt,m_problem)
call psb_bcast(ictxt,have_guess)
call psb_bcast(ictxt,have_ref)
end if
!
! Renumbering (NONE for the moment)
!
if (iam==psb_root_) then
renum='NONE'
call psb_cmp_bwpf(aux_a,lbw,ubw,prf,info)
write(psb_out_unit,'(" ")')
write(psb_out_unit,*) 'Bandwidth and profile: ',lbw,ubw,prf
write(psb_out_unit,*) 'Renumbering algorithm: ',psb_toupper(renum)
if (trim(psb_toupper(renum))/='NONE') then
call psb_mat_renum(renum,aux_a,info,perm=perm)
if (info /= 0) then
write(psb_err_unit,*) 'Error from RENUM',info
goto 9999
end if
call psb_gelp('N',perm(1:m_problem),b_col_glob(1:m_problem),info)
call psb_cmp_bwpf(aux_a,lbw,ubw,prf,info)
write(psb_out_unit,*) 'Bandwidth and profile (renumberd):',lbw,ubw,prf
end if
write(psb_out_unit,'(" ")')
end if
!
! switch over different partition types
!
if (ipart == 0) then
call psb_barrier(ictxt)
if (iam == psb_root_) write(psb_out_unit,'("Partition type: block")')
@ -211,10 +332,8 @@ program mld_sf_sample
if (iam == psb_root_) then
write(psb_out_unit,'("Partition type: graph")')
write(psb_out_unit,'(" ")')
! write(psb_err_unit,'("Build type: graph")')
call build_mtpart(aux_a,np)
endif
!!$ call psb_barrier(ictxt)
call distr_mtpart(psb_root_,ictxt)
call getv_mtpart(ivg)
call psb_matdist(aux_a, a, ictxt,desc_a,info,fmt=afmt,v=ivg)
@ -223,89 +342,136 @@ program mld_sf_sample
call psb_matdist(aux_a, a, ictxt, desc_a,info,fmt=afmt,parts=part_block)
end if
call psb_scatter(b_col_glob,b_col,desc_a,info,root=psb_root_)
!
! Scatter rhs, initial guess and reference solution
!
call psb_geall(b_col,desc_a,info)
call psb_geall(x_col,desc_a,info)
call x_col%zero()
call psb_geasb(x_col,desc_a,info)
call psb_geall(r_col,desc_a,info)
call r_col%zero()
call psb_geasb(r_col,desc_a,info)
t2 = psb_wtime() - t1
if (have_ref) call psb_geall(ref_col,desc_a,info)
if (iam == psb_root_) write(psb_out_unit,'("Scatter rhs")')
call psb_scatter(b_col_glob,b_col,desc_a,info)
if (iam == psb_root_) write(psb_out_unit,'("Scatter initial guess")')
call psb_scatter(guess_col_glob,x_col,desc_a,info)
if (have_ref) then
if (iam == psb_root_) write(psb_out_unit,'("Scatter reference solution")')
call psb_scatter(ref_col_glob,ref_col,desc_a,info)
end if
t2 = psb_wtime() - t1
call psb_amx(ictxt, t2)
if (iam == psb_root_) then
write(psb_out_unit,'(" ")')
write(psb_out_unit,'("Time to read and partition matrix : ",es12.5)')t2
write(psb_out_unit,'("Time to read and partition matrix, rhs(, guess, ref sol) : ",es12.5)')t2
write(psb_out_unit,'(" ")')
write(psb_out_unit,*) 'Preconditioner: ',prec_choice%descr
end if
!
! initialize the preconditioner
!
if (psb_toupper(p_choice%ptype) == 'ML') then
! multilevel preconditioner
call prec%init(p_choice%ptype,info)
call prec%set('ml_type', p_choice%mltype, info)
call prec%set('outer_sweeps', p_choice%otr_sweeps,info)
if (p_choice%csize>0)&
& call prec%set('coarse_aggr_size', p_choice%csize, info)
if (p_choice%mnaggratio>0)&
& call prec%set('min_aggr_ratio', p_choice%mnaggratio, info)
if (p_choice%maxlevs>0)&
& call prec%set('max_prec_levs', p_choice%maxlevs, info)
if (p_choice%ascale > dzero) &
& 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
if (psb_toupper(prec_choice%prec) == 'ML') then
call mld_precinit(prec,prec_choice%prec, info)
if (prec_choice%nlev > 0) &
& call mld_precset(prec,'max_prec_levs', prec_choice%nlev, info)
call mld_precset(prec,'aggr_kind', prec_choice%aggrkind,info)
call mld_precset(prec,'aggr_alg', prec_choice%aggr_alg,info)
call mld_precset(prec,'aggr_ord', prec_choice%aggr_ord,info)
call mld_precset(prec,'aggr_scale', prec_choice%ascale, info)
call mld_precset(prec,'aggr_thresh', prec_choice%athres, info)
call mld_precset(prec,'smoother_type', prec_choice%smther, info)
call mld_precset(prec,'smoother_sweeps', prec_choice%jsweeps, info)
call mld_precset(prec,'sub_ovr', prec_choice%novr, info)
call mld_precset(prec,'sub_restr', prec_choice%restr, info)
call mld_precset(prec,'sub_prol', prec_choice%prol, info)
call mld_precset(prec,'sub_solve', prec_choice%solve, info)
call mld_precset(prec,'sub_fillin', prec_choice%fill, info)
call mld_precset(prec,'sub_iluthrs', prec_choice%thr, info)
call mld_precset(prec,'ml_type', prec_choice%mltype, info)
call mld_precset(prec,'smoother_pos', prec_choice%smthpos, info)
call mld_precset(prec,'coarse_solve', prec_choice%csolve, info)
call mld_precset(prec,'coarse_subsolve', prec_choice%csbsolve,info)
call mld_precset(prec,'coarse_mat', prec_choice%cmat, info)
call mld_precset(prec,'coarse_fillin', prec_choice%cfill, info)
call mld_precset(prec,'coarse_iluthrs', prec_choice%cthres, info)
call mld_precset(prec,'coarse_sweeps', prec_choice%cjswp, info)
! building the preconditioner
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)
t1 = psb_wtime()
call mld_hierarchy_bld(a,desc_a,prec,info)
call prec%hierarchy_build(a,desc_a,info)
thier = psb_wtime()-t1
if (info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='psb_precbld')
call psb_errpush(psb_err_from_subroutine_,name,a_err='mld_hierarchy_bld')
goto 9999
end if
call psb_barrier(ictxt)
t1 = psb_wtime()
call mld_smoothers_bld(a,desc_a,prec,info)
call prec%smoothers_build(a,desc_a,info)
tprec = psb_wtime()-t1
if (info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='psb_precbld')
call psb_errpush(psb_err_from_subroutine_,name,a_err='mld_smoothers_bld')
goto 9999
end if
else
! 1-level preconditioner
nlv = 1
call mld_precinit(prec,prec_choice%prec,info)
if (psb_toupper(prec_choice%prec) /= 'NONE') then
call mld_precset(prec,'smoother_sweeps', prec_choice%jsweeps, info)
call mld_precset(prec,'sub_ovr', prec_choice%novr, info)
call mld_precset(prec,'sub_restr', prec_choice%restr, info)
call mld_precset(prec,'sub_prol', prec_choice%prol, info)
call mld_precset(prec,'sub_solve', prec_choice%solve, info)
call mld_precset(prec,'sub_fillin', prec_choice%fill, info)
call mld_precset(prec,'sub_iluthrs', prec_choice%thr, info)
call prec%init(p_choice%ptype,info)
if (psb_toupper(p_choice%ptype) /= 'NONE') then
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)
!!! call prec%set('solver_sweeps', p_choice%svsweeps, info)
end if
! building the preconditioner
! build the preconditioner
thier = dzero
t1 = psb_wtime()
call mld_precbld(a,desc_a,prec,info)
call prec%build(a,desc_a,info)
tprec = psb_wtime()-t1
if (info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='psb_precbld')
call psb_errpush(psb_err_from_subroutine_,name,a_err='mld_precbld')
goto 9999
end if
end if
@ -314,6 +480,8 @@ program mld_sf_sample
call psb_amx(ictxt, tprec)
if(iam == psb_root_) then
write(psb_out_unit,'(" ")')
write(psb_out_unit,'("Preconditioner: ",a)') trim(p_choice%descr)
write(psb_out_unit,'("Preconditioner time: ",es12.5)')thier+tprec
write(psb_out_unit,'(" ")')
end if
@ -321,43 +489,71 @@ program mld_sf_sample
iparm = 0
call psb_barrier(ictxt)
t1 = psb_wtime()
call psb_krylov(kmethd,a,prec,b_col,x_col,eps,desc_a,info,&
& itmax=itmax,iter=iter,err=err,itrace=itrace,istop=istopc,irst=irst)
call psb_krylov(s_choice%kmethd,a,prec,b_col,x_col,s_choice%eps,&
& 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)
! compute residual norms
call psb_geall(r_col,desc_a,info)
call r_col%zero()
call psb_geasb(r_col,desc_a,info)
call psb_geaxpby(sone,b_col,szero,r_col,desc_a,info)
call psb_spmm(-sone,a,x_col,sone,r_col,desc_a,info)
resmx = psb_genrm2(r_col,desc_a,info)
resmxp = psb_geamax(r_col,desc_a,info)
! compute error in solution
if (have_ref) then
call psb_geaxpby(-sone,x_col,sone,ref_col,desc_a,info)
xdiffn2 = psb_genrm2(ref_col,desc_a,info)
xdiffni = psb_geamax(ref_col,desc_a,info)
xn2 = psb_genrm2(ref_col,desc_a,info)
xni = psb_geamax(ref_col,desc_a,info)
end if
amatsize = a%sizeof()
descsize = desc_a%sizeof()
precsize = prec%sizeof()
call psb_sum(ictxt,amatsize)
call psb_sum(ictxt,descsize)
call psb_sum(ictxt,precsize)
call prec%descr(info)
if (iam == psb_root_) then
call mld_precdescr(prec,info)
write(psb_out_unit,'("Matrix: ",a)')mtrx_file
write(psb_out_unit,'("Computed solution on ",i8," processors")')np
write(psb_out_unit,'("Iterations to convergence : ",i6)')iter
write(psb_out_unit,'("Error estimate on exit : ",es12.5)')err
write(psb_out_unit,'("Krylov method : ",a)') trim(s_choice%kmethd)
write(psb_out_unit,'("Preconditioner : ",a)') trim(p_choice%descr)
write(psb_out_unit,'("Iterations to convergence : ",i12)')iter
write(psb_out_unit,'("Relative error estimate on exit : ",es12.5)') err
write(psb_out_unit,'("Number of levels in hierarchy : ",i12)') prec%get_nlevs()
write(psb_out_unit,'("Time to build hierarchy : ",es12.5)')thier
write(psb_out_unit,'("Time to build smoothers : ",es12.5)')tprec
write(psb_out_unit,'("Total time for preconditioner : ",es12.5)')tprec+thier
write(psb_out_unit,'("Time to solve system : ",es12.5)')tslv
write(psb_out_unit,'("Time per iteration : ",es12.5)')tslv/(iter)
write(psb_out_unit,'("Total time : ",es12.5)')tslv+tprec
write(psb_out_unit,'("Residual norm 2 : ",es12.5)')resmx
write(psb_out_unit,'("Residual norm inf : ",es12.5)')resmxp
write(psb_out_unit,'("Time per iteration : ",es12.5)')tslv/iter
write(psb_out_unit,'("Total time : ",es12.5)')tslv+tprec+thier
write(psb_out_unit,'("Residual 2-norm : ",es12.5)')resmx
write(psb_out_unit,'("Residual inf-norm : ",es12.5)')resmxp
write(psb_out_unit,'("Total memory occupation for A : ",i12)')amatsize
write(psb_out_unit,'("Total memory occupation for DESC_A : ",i12)')descsize
write(psb_out_unit,'("Total memory occupation for PREC : ",i12)')precsize
write(psb_out_unit,'("Storage format for A : ",a )')a%get_fmt()
write(psb_out_unit,'("Storage format for DESC_A : ",a )')desc_a%get_fmt()
if (have_ref) then
write(psb_out_unit,'(" ")')
write(psb_out_unit,'(2x,a10,9x,a8,4x,a20,5x,a8)') &
& '||X-XREF||','||XREF||','||X-XREF||/||XREF||','(2-norm)'
write(psb_out_unit,'(1x,3(e12.6,6x))') xdiffn2,xn2,xdiffn2/xn2
write(psb_out_unit,'(" ")')
write(psb_out_unit,'(2x,a10,9x,a8,4x,a20,4x,a10)') &
& '||X-XREF||','||XREF||','||X-XREF||/||XREF||','(inf-norm)'
write(psb_out_unit,'(1x,3(e12.6,6x))') xdiffni,xni,xdiffni/xni
end if
end if
call psb_gather(x_col_glob,x_col,desc_a,info,root=psb_root_)
@ -367,13 +563,15 @@ program mld_sf_sample
if (iam == psb_root_) then
write(psb_err_unit,'(" ")')
write(psb_err_unit,'("Saving x on file")')
write(20,*) 'matrix: ',mtrx_file
write(20,*) 'computed solution on ',np,' processors.'
write(20,*) 'iterations to convergence: ',iter
write(20,*) 'error estimate (infinity norm) on exit:', &
& ' ||r||/(||a||||x||+||b||) = ',err
write(20,'("Residual norm 2 : ",es12.5)')resmx
write(20,'("Residual norm inf : ",es12.5)')resmxp
write(20,*) 'Matrix: ',mtrx_file
write(20,*) 'Krylov method:',trim(s_choice%kmethd)
write(20,*) 'Preconditioner:',trim(p_choice%descr)
write(20,*) 'Computed solution on ',np,' processors.'
write(20,*) 'Iterations to convergence: ',iter
write(20,*) 'Error estimate (infinity norm) on exit:', &
& ' ||r||/||b|| (inf-norm) = ',err
write(20,'(" Residual 2-norm 2 : ",es12.5)')resmx
write(20,'(" Residual inf-norm : ",es12.5)')resmxp
write(20,'(a8,4(2x,a20))') 'I','X(I)','R(I)','B(I)'
do i=1,m_problem
write(20,998) i,x_col_glob(i),r_col_glob(i),b_col_glob(i)
@ -383,10 +581,12 @@ program mld_sf_sample
993 format(i6,4(1x,e12.6))
call psb_gefree(b_col, desc_a,info)
call psb_gefree(x_col, desc_a,info)
call psb_gefree(b_col,desc_a,info)
call psb_gefree(x_col,desc_a,info)
call psb_gefree(r_col,desc_a,info)
call psb_gefree(ref_col,desc_a,info)
call psb_spfree(a, desc_a,info)
call mld_precfree(prec,info)
call prec%free(info)
call psb_cdfree(desc_a,info)
call psb_exit(ictxt)
@ -399,101 +599,161 @@ contains
!
! get iteration parameters from standard input
!
subroutine get_parms(icontxt,mtrx,rhs,filefmt,kmethd,&
& prec, ipart,afmt,istopc,itmax,itrace,irst,eps)
subroutine get_parms(icontxt,mtrx,rhs,guess,sol,filefmt,ipart,afmt,solve,prec)
use psb_base_mod
implicit none
integer(psb_ipk_) :: icontxt
character(len=*) :: kmethd, mtrx, rhs, afmt,filefmt
integer(psb_ipk_) :: icontxt, ipart
character(len=*) :: mtrx, rhs, guess, sol, filefmt, afmt
type(solverdata) :: solve
type(precdata) :: prec
real(psb_spk_) :: eps
integer(psb_ipk_) :: iret, istopc,itmax,itrace, ipart, irst
integer(psb_ipk_) :: iam, nm, np, i
integer(psb_ipk_) :: iam, nm, np
call psb_info(icontxt,iam,np)
if (iam == psb_root_) then
! read input parameters
call read_data(mtrx,psb_inp_unit)
call read_data(rhs,psb_inp_unit)
call read_data(filefmt,psb_inp_unit)
call read_data(kmethd,psb_inp_unit)
call read_data(afmt,psb_inp_unit)
call read_data(ipart,psb_inp_unit)
call read_data(istopc,psb_inp_unit)
call read_data(itmax,psb_inp_unit)
call read_data(itrace,psb_inp_unit)
call read_data(irst,psb_inp_unit)
call read_data(eps,psb_inp_unit)
! read input data
!
! input files
call read_data(mtrx,psb_inp_unit) ! matrix file
call read_data(rhs,psb_inp_unit) ! rhs file
call read_data(guess,psb_inp_unit) ! starting guess file
call read_data(sol,psb_inp_unit) ! solution file (for comparison)
call read_data(filefmt,psb_inp_unit) ! format of files
call read_data(afmt,psb_inp_unit) ! matrix storage format
call read_data(ipart,psb_inp_unit) ! partition type
! Krylov solver data
call read_data(solve%kmethd,psb_inp_unit) ! Krylov solver
call read_data(solve%istopc,psb_inp_unit) ! stopping criterion
call read_data(solve%itmax,psb_inp_unit) ! max num iterations
call read_data(solve%itrace,psb_inp_unit) ! tracing
call read_data(solve%irst,psb_inp_unit) ! restart
call read_data(solve%eps,psb_inp_unit) ! tolerance
! preconditioner type
call read_data(prec%descr,psb_inp_unit) ! verbose description of the prec
call read_data(prec%prec,psb_inp_unit) ! overall prectype
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) ! Factorization type: ILU, SuperLU, UMFPACK.
call read_data(prec%fill,psb_inp_unit) ! Fill-in for factorization
call read_data(prec%thr,psb_inp_unit) ! Threshold for fact. ILU(T)
call read_data(prec%jsweeps,psb_inp_unit) ! Jacobi sweeps for PJAC
if (psb_toupper(prec%prec) == 'ML') then
call read_data(prec%nlev,psb_inp_unit) ! Number of levels in multilevel prec.
call read_data(prec%smther,psb_inp_unit) ! Smoother type.
call read_data(prec%aggrkind,psb_inp_unit) ! smoothed/raw aggregatin
call read_data(prec%aggr_alg,psb_inp_unit) ! local or global aggregation
call read_data(prec%aggr_ord,psb_inp_unit) ! Ordering for aggregation
call read_data(prec%mltype,psb_inp_unit) ! additive or multiplicative 2nd level prec
call read_data(prec%smthpos,psb_inp_unit) ! side: pre, post, both smoothing
call read_data(prec%cmat,psb_inp_unit) ! coarse mat
call read_data(prec%csolve,psb_inp_unit) ! Factorization type: BJAC, SuperLU, UMFPACK.
call read_data(prec%csbsolve,psb_inp_unit) ! Factorization type: ILU, SuperLU, UMFPACK.
call read_data(prec%cfill,psb_inp_unit) ! Fill-in for factorization
call read_data(prec%cthres,psb_inp_unit) ! Threshold for fact. ILU(T)
call read_data(prec%cjswp,psb_inp_unit) ! Jacobi sweeps
call read_data(prec%athres,psb_inp_unit) ! smoother aggr thresh
call read_data(prec%ascale,psb_inp_unit) ! smoother aggr thresh
call read_data(prec%ptype,psb_inp_unit) ! preconditioner type
! general AMG data
call read_data(prec%mltype,psb_inp_unit) ! AMG cycle type
call read_data(prec%otr_sweeps,psb_inp_unit) ! number of AMG cycles
call read_data(prec%maxlevs,psb_inp_unit) ! max number of levels in AMG prec
call read_data(prec%csize,psb_inp_unit) ! min size coarsest mat
! aggregation
call read_data(prec%aggrkind,psb_inp_unit) ! aggregation type
call read_data(prec%aggr_alg,psb_inp_unit) ! parallel aggregation alg
call read_data(prec%aggr_ord,psb_inp_unit) ! ordering for aggregation
call read_data(prec%aggr_filter,psb_inp_unit) ! filtering
call read_data(prec%mnaggratio,psb_inp_unit) ! minimum aggregation ratio
call read_data(prec%thrvsz,psb_inp_unit) ! size of aggr thresh vector
if (prec%thrvsz > 0) then
call psb_realloc(prec%thrvsz,prec%athresv,info)
call read_data(prec%athresv,psb_inp_unit) ! aggr thresh vector
else
read(psb_inp_unit,*) ! dummy read to skip a record
end if
call read_data(prec%athres,psb_inp_unit) ! smoothed aggr thresh
call read_data(prec%aggr_omalg,psb_inp_unit) ! alg for estimating omega
call read_data(prec%aggr_eig,psb_inp_unit) ! alg for estimating omega
call read_data(prec%omega_val,psb_inp_unit) ! alg for estimating omega
! 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
call psb_bcast(icontxt,mtrx)
call psb_bcast(icontxt,rhs)
call psb_bcast(icontxt,guess)
call psb_bcast(icontxt,sol)
call psb_bcast(icontxt,filefmt)
call psb_bcast(icontxt,kmethd)
call psb_bcast(icontxt,afmt)
call psb_bcast(icontxt,ipart)
call psb_bcast(icontxt,istopc)
call psb_bcast(icontxt,itmax)
call psb_bcast(icontxt,itrace)
call psb_bcast(icontxt,irst)
call psb_bcast(icontxt,eps)
call psb_bcast(icontxt,prec%descr) ! verbose description of the prec
call psb_bcast(icontxt,prec%prec) ! overall prectype
call psb_bcast(icontxt,prec%novr) ! number of overlap layers
call psb_bcast(icontxt,prec%restr) ! restriction over application of as
call psb_bcast(icontxt,prec%prol) ! prolongation over application of as
call psb_bcast(icontxt,prec%solve) ! Factorization type: ILU, SuperLU, UMFPACK.
call psb_bcast(icontxt,prec%fill) ! Fill-in for factorization
call psb_bcast(icontxt,prec%thr) ! Threshold for fact. ILU(T)
call psb_bcast(icontxt,prec%jsweeps) ! Jacobi sweeps
if (psb_toupper(prec%prec) == 'ML') then
call psb_bcast(icontxt,prec%smther) ! Smoother type.
call psb_bcast(icontxt,prec%nlev) ! Number of levels in multilevel prec.
call psb_bcast(icontxt,prec%aggrkind) ! smoothed/raw aggregatin
call psb_bcast(icontxt,prec%aggr_alg) ! local or global aggregation
call psb_bcast(icontxt,prec%aggr_ord) ! Ordering for aggregation
call psb_bcast(icontxt,prec%mltype) ! additive or multiplicative 2nd level prec
call psb_bcast(icontxt,prec%smthpos) ! side: pre, post, both smoothing
call psb_bcast(icontxt,prec%cmat) ! coarse mat
call psb_bcast(icontxt,prec%csolve) ! Factorization type: ILU, SuperLU, UMFPACK.
call psb_bcast(icontxt,prec%csbsolve) ! Factorization type: ILU, SuperLU, UMFPACK.
call psb_bcast(icontxt,prec%cfill) ! Fill-in for factorization
call psb_bcast(icontxt,prec%cthres) ! Threshold for fact. ILU(T)
call psb_bcast(icontxt,prec%cjswp) ! Jacobi sweeps
call psb_bcast(icontxt,prec%athres) ! smoother aggr thresh
call psb_bcast(icontxt,prec%ascale) ! smoother aggr scale factor
call psb_bcast(icontxt,solve%kmethd)
call psb_bcast(icontxt,solve%istopc)
call psb_bcast(icontxt,solve%itmax)
call psb_bcast(icontxt,solve%itrace)
call psb_bcast(icontxt,solve%irst)
call psb_bcast(icontxt,solve%eps)
call psb_bcast(icontxt,prec%descr)
call psb_bcast(icontxt,prec%ptype)
! broadcast first (pre-)smoother / 1-lev prec data
call psb_bcast(icontxt,prec%smther) ! actually not needed for 1-lev precs
call psb_bcast(icontxt,prec%jsweeps)
call psb_bcast(icontxt,prec%novr)
call psb_bcast(icontxt,prec%restr)
call psb_bcast(icontxt,prec%prol)
call psb_bcast(icontxt,prec%solve)
call psb_bcast(icontxt,prec%fill)
call psb_bcast(icontxt,prec%thr)
! broadcast (other) AMG parameters
if (psb_toupper(prec%ptype) == 'ML') then
call psb_bcast(icontxt,prec%mltype)
call psb_bcast(icontxt,prec%otr_sweeps)
call psb_bcast(icontxt,prec%maxlevs)
call psb_bcast(icontxt,prec%smther2)
call psb_bcast(icontxt,prec%jsweeps2)
call psb_bcast(icontxt,prec%novr2)
call psb_bcast(icontxt,prec%restr2)
call psb_bcast(icontxt,prec%prol2)
call psb_bcast(icontxt,prec%solve2)
call psb_bcast(icontxt,prec%fill2)
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
end subroutine get_parms
subroutine pr_usage(iout)
integer(psb_ipk_) iout
write(iout, *) ' number of parameters is incorrect!'
@ -511,4 +771,5 @@ contains
write(iout, *) ' ptype partition strategy default 0'
write(iout, *) ' 0: block partition '
end subroutine pr_usage
end program mld_sf_sample

@ -4,7 +4,7 @@
! MultiLevel Domain Decomposition Parallel Preconditioners Package
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
!
! (C) Copyright 2008, 2010, 2012, 2015, 2017 , 2016
! (C) Copyright 2008, 2010, 2012, 2015, 2017
!
! Salvatore Filippone Cranfield University, UK
! Ambra Abdullahi Hassan University of Rome Tor Vergata, IT
@ -47,35 +47,83 @@ program mld_zf_sample
! input parameters
character(len=40) :: kmethd, mtrx_file, rhs_file
character(len=40) :: kmethd, mtrx_file, rhs_file, guess_file, sol_file
character(len=2) :: filefmt
! 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
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_) :: jsweeps ! Jacobi/smoother sweeps
character(len=16) :: restr ! restriction over application of AS
character(len=16) :: prol ! prolongation over application of AS
character(len=16) :: solve ! factorization type: ILU, SuperLU, UMFPACK
integer(psb_ipk_) :: fill ! fillin for factorization
real(psb_dpk_) :: thr ! threshold for fact. ILU(T)
character(len=16) :: smther ! Smoother
integer(psb_ipk_) :: nlev ! number of levels in multilevel prec.
character(len=16) :: aggrkind ! smoothed, raw aggregation
character(len=16) :: aggr_alg ! aggregation algorithm (currently only decoupled)
character(len=16) :: aggr_ord ! Ordering for aggregation
character(len=16) :: mltype ! additive or multiplicative multi-level prec
character(len=16) :: smthpos ! side: pre, post, both smoothing
character(len=16) :: cmat ! coarse mat: distributed, replicated
character(len=16) :: csolve ! coarse solver: bjac, umf, slu, sludist
character(len=16) :: csbsolve ! coarse subsolver: ILU, ILU(T), SuperLU, UMFPACK
integer(psb_ipk_) :: cfill ! fillin for coarse factorization
real(psb_dpk_) :: cthres ! threshold for coarse fact. ILU(T)
integer(psb_ipk_) :: cjswp ! block-Jacobi sweeps
real(psb_dpk_) :: athres ! smoothed aggregation threshold
real(psb_dpk_) :: ascale ! smoothed aggregation scale factor
character(len=16) :: solve ! local subsolver type: ILU, MILU, ILUT,
! UMF, MUMPS, SLU, FWGS, BWGS, JAC
integer(psb_ipk_) :: fill ! fill-in for incomplete LU factorization
real(psb_dpk_) :: thr ! threshold for ILUT factorization
! AMG post-smoother; ignored by 1-lev preconditioner
character(len=16) :: smther2 ! post-smoother type: BJAC, AS
integer(psb_ipk_) :: jsweeps2 ! post-smoother sweeps
integer(psb_ipk_) :: novr2 ! number of overlap layers
character(len=16) :: restr2 ! restriction over application of AS
character(len=16) :: prol2 ! prolongation over application of AS
character(len=16) :: solve2 ! local subsolver type: ILU, MILU, ILUT,
! UMF, MUMPS, SLU, FWGS, BWGS, JAC
integer(psb_ipk_) :: fill2 ! fill-in for incomplete LU factorization
real(psb_dpk_) :: thr2 ! threshold for ILUT factorization
! coarsest-level solver
character(len=16) :: cmat ! coarsest matrix layout: REPL, DIST
character(len=16) :: csolve ! coarsest-lev solver: BJAC, SLUDIST (distr.
! mat.); UMF, MUMPS, SLU, ILU, ILUT, MILU
! (repl. mat.)
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
type(precdata) :: prec_choice
type(precdata) :: p_choice
! sparse matrices
type(psb_zspmat_type) :: a, aux_a
@ -83,10 +131,10 @@ program mld_zf_sample
! preconditioner data
type(mld_zprec_type) :: prec
! dense matrices
complex(psb_dpk_), allocatable, target :: aux_b(:,:), d(:)
complex(psb_dpk_), allocatable, target :: aux_b(:,:), d(:), aux_g(:,:), aux_x(:,:)
complex(psb_dpk_), allocatable , save :: x_col_glob(:), r_col_glob(:)
complex(psb_dpk_), pointer :: b_col_glob(:)
type(psb_z_vect_type) :: b_col, x_col, r_col
complex(psb_dpk_), pointer :: b_col_glob(:), ref_col_glob(:), guess_col_glob(:)
type(psb_z_vect_type) :: b_col, x_col, r_col, ref_col
! communications data structure
type(psb_desc_type):: desc_a
@ -94,24 +142,23 @@ program mld_zf_sample
integer(psb_ipk_) :: ictxt, iam, np
! solver paramters
integer(psb_ipk_) :: iter, itmax, ierr, itrace, ircode, ipart,&
& methd, istopc, irst, nlv
integer(psb_ipk_) :: iter, ircode, ipart, nlv
integer(psb_long_int_k_) :: amatsize, precsize, descsize
real(psb_dpk_) :: err, eps
real(psb_dpk_) :: err
character(len=5) :: afmt
character(len=20) :: name, renum
integer(psb_ipk_), parameter :: iunit=12
integer(psb_ipk_) :: iparm(20)
character(len=40) :: fprefix
! other variables
integer(psb_ipk_) :: i,info,j,m_problem
integer(psb_ipk_) :: internal, m,ii,nnzero
integer(psb_ipk_) :: i, info, j, k, m_problem
integer(psb_ipk_) :: lbw, ubw, prf
real(psb_dpk_) :: t1, t2, tprec, thier, tslv
real(psb_dpk_) :: r_amax, b_amax, scale,resmx,resmxp
integer(psb_ipk_) :: nrhs, nrow, n_row, dim, nv, ne
integer(psb_ipk_), allocatable :: ivg(:), ipv(:)
real(psb_dpk_) :: resmx, resmxp, xdiffn2, xdiffni, xni, xn2
integer(psb_ipk_) :: nrhs, nv
integer(psb_ipk_), allocatable :: ivg(:), ipv(:), perm(:)
logical :: have_guess=.false., have_ref=.false.
call psb_init(ictxt)
call psb_info(ictxt,iam,np)
@ -131,41 +178,55 @@ program mld_zf_sample
! Hello world
!
if (iam == psb_root_) then
write(*,*) 'Welcome to MLD2P4 version: ',mld_version_string_
write(*,*) 'This is the ',trim(name),' sample program'
write(psb_out_unit,*) ' '
write(psb_out_unit,*) 'Welcome to MLD2P4 version: ',mld_version_string_
write(psb_out_unit,*) 'This is the ',trim(name),' sample test program'
write(psb_out_unit,*) ' '
end if
!
! get parameters
!
call get_parms(ictxt,mtrx_file,rhs_file,filefmt,kmethd,&
& prec_choice,ipart,afmt,istopc,itmax,itrace,irst,eps)
call get_parms(ictxt,mtrx_file,rhs_file,guess_file,sol_file,filefmt, &
& ipart,afmt,s_choice,p_choice)
call psb_barrier(ictxt)
t1 = psb_wtime()
! read the input matrix to be processed and (possibly) the rhs
! read the input matrix to be processed and (possibly) the rhs,
! the initial guess and the reference solution
nrhs = 1
if (iam == psb_root_) then
select case(psb_toupper(filefmt))
case('MM')
! For Matrix Market we have an input file for the matrix
! and an (optional) second file for the RHS.
! and (optional) separate files for the rhs, the initial guess
! and the reference solution
call mm_mat_read(aux_a,info,iunit=iunit,filename=mtrx_file)
if (info == psb_success_) then
if (rhs_file /= 'NONE') then
call mm_array_read(aux_b,info,iunit=iunit,filename=rhs_file)
if ((info == psb_success_).and.(rhs_file /= 'NONE')) &
& call mm_array_read(aux_b,info,iunit=iunit,filename=rhs_file)
if ((info == psb_success_).and.(guess_file /= 'NONE')) then
call mm_array_read(aux_g,info,iunit=iunit,filename=guess_file)
have_guess = .true.
end if
if ((info == psb_success_).and.(sol_file /= 'NONE')) then
call mm_array_read(aux_x,info,iunit=iunit,filename=sol_file)
have_ref = .true.
end if
case ('HB')
! For Harwell-Boeing we have a single file which may or may not
! contain an RHS.
call hb_read(aux_a,info,iunit=iunit,b=aux_b,filename=mtrx_file)
! contain rhs, initial guess and reference solution.
call hb_read(aux_a,info,iunit=iunit,b=aux_b,&
& g=aux_g,x=aux_x,filename=mtrx_file)
have_guess = allocated(aux_g)
have_ref = allocated(aux_x)
case default
info = -1
write(psb_err_unit,*) 'Wrong choice for fileformat ', filefmt
end select
if (info /= psb_success_) then
write(psb_err_unit,*) 'Error while reading input matrix '
call psb_abort(ictxt)
@ -173,6 +234,8 @@ program mld_zf_sample
m_problem = aux_a%get_nrows()
call psb_bcast(ictxt,m_problem)
call psb_bcast(ictxt,have_guess)
call psb_bcast(ictxt,have_ref)
! At this point aux_b may still be unallocated
if (psb_size(aux_b,dim=ione) == m_problem) then
@ -181,23 +244,81 @@ program mld_zf_sample
b_col_glob =>aux_b(:,1)
else
write(psb_out_unit,'("Generating an rhs...")')
write(psb_out_unit,'(" ")')
call psb_realloc(m_problem,1,aux_b,ircode)
if (ircode /= 0) then
call psb_errpush(psb_err_alloc_dealloc_,name)
goto 9999
endif
b_col_glob => aux_b(:,1)
do i=1, m_problem
b_col_glob(i) = 1.d0
enddo
endif
if ((have_guess).and.(psb_size(aux_g,dim=ione) == m_problem)) then
! if any initial guess were present, broadcast the first one
write(psb_err_unit,'("Ok, got an initial guess ")')
guess_col_glob =>aux_g(:,1)
else
write(psb_out_unit,'("Generating an initial guess...")')
call psb_realloc(m_problem,1,aux_g,ircode)
if (ircode /= 0) then
call psb_errpush(psb_err_alloc_dealloc_,name)
goto 9999
endif
guess_col_glob => aux_g(:,1)
do i=1, m_problem
guess_col_glob(i) = 0.d0
enddo
endif
if ((have_ref).and.(psb_size(aux_x,dim=ione) == m_problem)) then
! if any reference were present, broadcast the first one
write(psb_err_unit,'("Ok, got a reference solution ")')
ref_col_glob =>aux_x(:,1)
else
write(psb_out_unit,'("No reference solution...")')
endif
! clean zeros in the input matrix
call aux_a%clean_zeros(info)
else
call psb_bcast(ictxt,m_problem)
call psb_bcast(ictxt,have_guess)
call psb_bcast(ictxt,have_ref)
end if
!
! Renumbering (NONE for the moment)
!
if (iam==psb_root_) then
renum='NONE'
call psb_cmp_bwpf(aux_a,lbw,ubw,prf,info)
write(psb_out_unit,'(" ")')
write(psb_out_unit,*) 'Bandwidth and profile: ',lbw,ubw,prf
write(psb_out_unit,*) 'Renumbering algorithm: ',psb_toupper(renum)
if (trim(psb_toupper(renum))/='NONE') then
call psb_mat_renum(renum,aux_a,info,perm=perm)
if (info /= 0) then
write(psb_err_unit,*) 'Error from RENUM',info
goto 9999
end if
call psb_gelp('N',perm(1:m_problem),b_col_glob(1:m_problem),info)
call psb_cmp_bwpf(aux_a,lbw,ubw,prf,info)
write(psb_out_unit,*) 'Bandwidth and profile (renumberd):',lbw,ubw,prf
end if
write(psb_out_unit,'(" ")')
end if
!
! switch over different partition types
!
if (ipart == 0) then
call psb_barrier(ictxt)
if (iam == psb_root_) write(psb_out_unit,'("Partition type: block")')
@ -211,10 +332,8 @@ program mld_zf_sample
if (iam == psb_root_) then
write(psb_out_unit,'("Partition type: graph")')
write(psb_out_unit,'(" ")')
! write(psb_err_unit,'("Build type: graph")')
call build_mtpart(aux_a,np)
endif
!!$ call psb_barrier(ictxt)
call distr_mtpart(psb_root_,ictxt)
call getv_mtpart(ivg)
call psb_matdist(aux_a, a, ictxt,desc_a,info,fmt=afmt,v=ivg)
@ -223,89 +342,136 @@ program mld_zf_sample
call psb_matdist(aux_a, a, ictxt, desc_a,info,fmt=afmt,parts=part_block)
end if
call psb_scatter(b_col_glob,b_col,desc_a,info,root=psb_root_)
!
! Scatter rhs, initial guess and reference solution
!
call psb_geall(b_col,desc_a,info)
call psb_geall(x_col,desc_a,info)
call x_col%zero()
call psb_geasb(x_col,desc_a,info)
call psb_geall(r_col,desc_a,info)
call r_col%zero()
call psb_geasb(r_col,desc_a,info)
t2 = psb_wtime() - t1
if (have_ref) call psb_geall(ref_col,desc_a,info)
if (iam == psb_root_) write(psb_out_unit,'("Scatter rhs")')
call psb_scatter(b_col_glob,b_col,desc_a,info)
if (iam == psb_root_) write(psb_out_unit,'("Scatter initial guess")')
call psb_scatter(guess_col_glob,x_col,desc_a,info)
if (have_ref) then
if (iam == psb_root_) write(psb_out_unit,'("Scatter reference solution")')
call psb_scatter(ref_col_glob,ref_col,desc_a,info)
end if
t2 = psb_wtime() - t1
call psb_amx(ictxt, t2)
if (iam == psb_root_) then
write(psb_out_unit,'(" ")')
write(psb_out_unit,'("Time to read and partition matrix : ",es12.5)')t2
write(psb_out_unit,'("Time to read and partition matrix, rhs(, guess, ref sol) : ",es12.5)')t2
write(psb_out_unit,'(" ")')
write(psb_out_unit,*) 'Preconditioner: ',prec_choice%descr
end if
!
! initialize the preconditioner
!
if (psb_toupper(p_choice%ptype) == 'ML') then
! multilevel preconditioner
call prec%init(p_choice%ptype,info)
call prec%set('ml_type', p_choice%mltype, info)
call prec%set('outer_sweeps', p_choice%otr_sweeps,info)
if (p_choice%csize>0)&
& call prec%set('coarse_aggr_size', p_choice%csize, info)
if (p_choice%mnaggratio>0)&
& call prec%set('min_aggr_ratio', p_choice%mnaggratio, info)
if (p_choice%maxlevs>0)&
& call prec%set('max_prec_levs', p_choice%maxlevs, info)
if (p_choice%ascale > dzero) &
& 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
if (psb_toupper(prec_choice%prec) == 'ML') then
call mld_precinit(prec,prec_choice%prec, info)
if (prec_choice%nlev > 0) &
& call mld_precset(prec,'max_prec_levs', prec_choice%nlev, info)
call mld_precset(prec,'aggr_kind', prec_choice%aggrkind,info)
call mld_precset(prec,'aggr_alg', prec_choice%aggr_alg,info)
call mld_precset(prec,'aggr_ord', prec_choice%aggr_ord,info)
call mld_precset(prec,'aggr_scale', prec_choice%ascale, info)
call mld_precset(prec,'aggr_thresh', prec_choice%athres, info)
call mld_precset(prec,'smoother_type', prec_choice%smther, info)
call mld_precset(prec,'smoother_sweeps', prec_choice%jsweeps, info)
call mld_precset(prec,'sub_ovr', prec_choice%novr, info)
call mld_precset(prec,'sub_restr', prec_choice%restr, info)
call mld_precset(prec,'sub_prol', prec_choice%prol, info)
call mld_precset(prec,'sub_solve', prec_choice%solve, info)
call mld_precset(prec,'sub_fillin', prec_choice%fill, info)
call mld_precset(prec,'sub_iluthrs', prec_choice%thr, info)
call mld_precset(prec,'ml_type', prec_choice%mltype, info)
call mld_precset(prec,'smoother_pos', prec_choice%smthpos, info)
call mld_precset(prec,'coarse_solve', prec_choice%csolve, info)
call mld_precset(prec,'coarse_subsolve', prec_choice%csbsolve,info)
call mld_precset(prec,'coarse_mat', prec_choice%cmat, info)
call mld_precset(prec,'coarse_fillin', prec_choice%cfill, info)
call mld_precset(prec,'coarse_iluthrs', prec_choice%cthres, info)
call mld_precset(prec,'coarse_sweeps', prec_choice%cjswp, info)
! building the preconditioner
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)
t1 = psb_wtime()
call mld_hierarchy_bld(a,desc_a,prec,info)
call prec%hierarchy_build(a,desc_a,info)
thier = psb_wtime()-t1
if (info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='psb_precbld')
call psb_errpush(psb_err_from_subroutine_,name,a_err='mld_hierarchy_bld')
goto 9999
end if
call psb_barrier(ictxt)
t1 = psb_wtime()
call mld_smoothers_bld(a,desc_a,prec,info)
call prec%smoothers_build(a,desc_a,info)
tprec = psb_wtime()-t1
if (info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='psb_precbld')
call psb_errpush(psb_err_from_subroutine_,name,a_err='mld_smoothers_bld')
goto 9999
end if
else
! 1-level preconditioner
nlv = 1
call mld_precinit(prec,prec_choice%prec,info)
if (psb_toupper(prec_choice%prec) /= 'NONE') then
call mld_precset(prec,'smoother_sweeps', prec_choice%jsweeps, info)
call mld_precset(prec,'sub_ovr', prec_choice%novr, info)
call mld_precset(prec,'sub_restr', prec_choice%restr, info)
call mld_precset(prec,'sub_prol', prec_choice%prol, info)
call mld_precset(prec,'sub_solve', prec_choice%solve, info)
call mld_precset(prec,'sub_fillin', prec_choice%fill, info)
call mld_precset(prec,'sub_iluthrs', prec_choice%thr, info)
call prec%init(p_choice%ptype,info)
if (psb_toupper(p_choice%ptype) /= 'NONE') then
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)
!!! call prec%set('solver_sweeps', p_choice%svsweeps, info)
end if
! building the preconditioner
! build the preconditioner
thier = dzero
t1 = psb_wtime()
call mld_precbld(a,desc_a,prec,info)
call prec%build(a,desc_a,info)
tprec = psb_wtime()-t1
if (info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='psb_precbld')
call psb_errpush(psb_err_from_subroutine_,name,a_err='mld_precbld')
goto 9999
end if
end if
@ -314,6 +480,8 @@ program mld_zf_sample
call psb_amx(ictxt, tprec)
if(iam == psb_root_) then
write(psb_out_unit,'(" ")')
write(psb_out_unit,'("Preconditioner: ",a)') trim(p_choice%descr)
write(psb_out_unit,'("Preconditioner time: ",es12.5)')thier+tprec
write(psb_out_unit,'(" ")')
end if
@ -321,43 +489,71 @@ program mld_zf_sample
iparm = 0
call psb_barrier(ictxt)
t1 = psb_wtime()
call psb_krylov(kmethd,a,prec,b_col,x_col,eps,desc_a,info,&
& itmax=itmax,iter=iter,err=err,itrace=itrace,istop=istopc,irst=irst)
call psb_krylov(s_choice%kmethd,a,prec,b_col,x_col,s_choice%eps,&
& 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)
! compute residual norms
call psb_geall(r_col,desc_a,info)
call r_col%zero()
call psb_geasb(r_col,desc_a,info)
call psb_geaxpby(zone,b_col,zzero,r_col,desc_a,info)
call psb_spmm(-zone,a,x_col,zone,r_col,desc_a,info)
resmx = psb_genrm2(r_col,desc_a,info)
resmxp = psb_geamax(r_col,desc_a,info)
! compute error in solution
if (have_ref) then
call psb_geaxpby(-zone,x_col,zone,ref_col,desc_a,info)
xdiffn2 = psb_genrm2(ref_col,desc_a,info)
xdiffni = psb_geamax(ref_col,desc_a,info)
xn2 = psb_genrm2(ref_col,desc_a,info)
xni = psb_geamax(ref_col,desc_a,info)
end if
amatsize = a%sizeof()
descsize = desc_a%sizeof()
precsize = prec%sizeof()
call psb_sum(ictxt,amatsize)
call psb_sum(ictxt,descsize)
call psb_sum(ictxt,precsize)
call prec%descr(info)
if (iam == psb_root_) then
call mld_precdescr(prec,info)
write(psb_out_unit,'("Matrix: ",a)')mtrx_file
write(psb_out_unit,'("Computed solution on ",i8," processors")')np
write(psb_out_unit,'("Iterations to convergence : ",i6)')iter
write(psb_out_unit,'("Error estimate on exit : ",es12.5)')err
write(psb_out_unit,'("Krylov method : ",a)') trim(s_choice%kmethd)
write(psb_out_unit,'("Preconditioner : ",a)') trim(p_choice%descr)
write(psb_out_unit,'("Iterations to convergence : ",i12)')iter
write(psb_out_unit,'("Relative error estimate on exit : ",es12.5)') err
write(psb_out_unit,'("Number of levels in hierarchy : ",i12)') prec%get_nlevs()
write(psb_out_unit,'("Time to build hierarchy : ",es12.5)')thier
write(psb_out_unit,'("Time to build smoothers : ",es12.5)')tprec
write(psb_out_unit,'("Total time for preconditioner : ",es12.5)')tprec+thier
write(psb_out_unit,'("Time to solve system : ",es12.5)')tslv
write(psb_out_unit,'("Time per iteration : ",es12.5)')tslv/(iter)
write(psb_out_unit,'("Total time : ",es12.5)')tslv+tprec
write(psb_out_unit,'("Residual norm 2 : ",es12.5)')resmx
write(psb_out_unit,'("Residual norm inf : ",es12.5)')resmxp
write(psb_out_unit,'("Time per iteration : ",es12.5)')tslv/iter
write(psb_out_unit,'("Total time : ",es12.5)')tslv+tprec+thier
write(psb_out_unit,'("Residual 2-norm : ",es12.5)')resmx
write(psb_out_unit,'("Residual inf-norm : ",es12.5)')resmxp
write(psb_out_unit,'("Total memory occupation for A : ",i12)')amatsize
write(psb_out_unit,'("Total memory occupation for DESC_A : ",i12)')descsize
write(psb_out_unit,'("Total memory occupation for PREC : ",i12)')precsize
write(psb_out_unit,'("Storage format for A : ",a )')a%get_fmt()
write(psb_out_unit,'("Storage format for DESC_A : ",a )')desc_a%get_fmt()
if (have_ref) then
write(psb_out_unit,'(" ")')
write(psb_out_unit,'(2x,a10,9x,a8,4x,a20,5x,a8)') &
& '||X-XREF||','||XREF||','||X-XREF||/||XREF||','(2-norm)'
write(psb_out_unit,'(1x,3(e12.6,6x))') xdiffn2,xn2,xdiffn2/xn2
write(psb_out_unit,'(" ")')
write(psb_out_unit,'(2x,a10,9x,a8,4x,a20,4x,a10)') &
& '||X-XREF||','||XREF||','||X-XREF||/||XREF||','(inf-norm)'
write(psb_out_unit,'(1x,3(e12.6,6x))') xdiffni,xni,xdiffni/xni
end if
end if
call psb_gather(x_col_glob,x_col,desc_a,info,root=psb_root_)
@ -367,13 +563,15 @@ program mld_zf_sample
if (iam == psb_root_) then
write(psb_err_unit,'(" ")')
write(psb_err_unit,'("Saving x on file")')
write(20,*) 'matrix: ',mtrx_file
write(20,*) 'computed solution on ',np,' processors.'
write(20,*) 'iterations to convergence: ',iter
write(20,*) 'error estimate (infinity norm) on exit:', &
& ' ||r||/(||a||||x||+||b||) = ',err
write(20,'("Residual norm 2 : ",es12.5)')resmx
write(20,'("Residual norm inf : ",es12.5)')resmxp
write(20,*) 'Matrix: ',mtrx_file
write(20,*) 'Krylov method:',trim(s_choice%kmethd)
write(20,*) 'Preconditioner:',trim(p_choice%descr)
write(20,*) 'Computed solution on ',np,' processors.'
write(20,*) 'Iterations to convergence: ',iter
write(20,*) 'Error estimate (infinity norm) on exit:', &
& ' ||r||/||b|| (inf-norm) = ',err
write(20,'(" Residual 2-norm 2 : ",es12.5)')resmx
write(20,'(" Residual inf-norm : ",es12.5)')resmxp
write(20,'(a8,4(2x,a20))') 'I','X(I)','R(I)','B(I)'
do i=1,m_problem
write(20,998) i,x_col_glob(i),r_col_glob(i),b_col_glob(i)
@ -383,10 +581,12 @@ program mld_zf_sample
993 format(i6,4(1x,e12.6))
call psb_gefree(b_col, desc_a,info)
call psb_gefree(x_col, desc_a,info)
call psb_gefree(b_col,desc_a,info)
call psb_gefree(x_col,desc_a,info)
call psb_gefree(r_col,desc_a,info)
call psb_gefree(ref_col,desc_a,info)
call psb_spfree(a, desc_a,info)
call mld_precfree(prec,info)
call prec%free(info)
call psb_cdfree(desc_a,info)
call psb_exit(ictxt)
@ -399,101 +599,161 @@ contains
!
! get iteration parameters from standard input
!
subroutine get_parms(icontxt,mtrx,rhs,filefmt,kmethd,&
& prec, ipart,afmt,istopc,itmax,itrace,irst,eps)
subroutine get_parms(icontxt,mtrx,rhs,guess,sol,filefmt,ipart,afmt,solve,prec)
use psb_base_mod
implicit none
integer(psb_ipk_) :: icontxt
character(len=*) :: kmethd, mtrx, rhs, afmt,filefmt
integer(psb_ipk_) :: icontxt, ipart
character(len=*) :: mtrx, rhs, guess, sol, filefmt, afmt
type(solverdata) :: solve
type(precdata) :: prec
real(psb_dpk_) :: eps
integer(psb_ipk_) :: iret, istopc,itmax,itrace, ipart, irst
integer(psb_ipk_) :: iam, nm, np, i
integer(psb_ipk_) :: iam, nm, np
call psb_info(icontxt,iam,np)
if (iam == psb_root_) then
! read input parameters
call read_data(mtrx,psb_inp_unit)
call read_data(rhs,psb_inp_unit)
call read_data(filefmt,psb_inp_unit)
call read_data(kmethd,psb_inp_unit)
call read_data(afmt,psb_inp_unit)
call read_data(ipart,psb_inp_unit)
call read_data(istopc,psb_inp_unit)
call read_data(itmax,psb_inp_unit)
call read_data(itrace,psb_inp_unit)
call read_data(irst,psb_inp_unit)
call read_data(eps,psb_inp_unit)
! read input data
!
! input files
call read_data(mtrx,psb_inp_unit) ! matrix file
call read_data(rhs,psb_inp_unit) ! rhs file
call read_data(guess,psb_inp_unit) ! starting guess file
call read_data(sol,psb_inp_unit) ! solution file (for comparison)
call read_data(filefmt,psb_inp_unit) ! format of files
call read_data(afmt,psb_inp_unit) ! matrix storage format
call read_data(ipart,psb_inp_unit) ! partition type
! Krylov solver data
call read_data(solve%kmethd,psb_inp_unit) ! Krylov solver
call read_data(solve%istopc,psb_inp_unit) ! stopping criterion
call read_data(solve%itmax,psb_inp_unit) ! max num iterations
call read_data(solve%itrace,psb_inp_unit) ! tracing
call read_data(solve%irst,psb_inp_unit) ! restart
call read_data(solve%eps,psb_inp_unit) ! tolerance
! preconditioner type
call read_data(prec%descr,psb_inp_unit) ! verbose description of the prec
call read_data(prec%prec,psb_inp_unit) ! overall prectype
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) ! Factorization type: ILU, SuperLU, UMFPACK.
call read_data(prec%fill,psb_inp_unit) ! Fill-in for factorization
call read_data(prec%thr,psb_inp_unit) ! Threshold for fact. ILU(T)
call read_data(prec%jsweeps,psb_inp_unit) ! Jacobi sweeps for PJAC
if (psb_toupper(prec%prec) == 'ML') then
call read_data(prec%nlev,psb_inp_unit) ! Number of levels in multilevel prec.
call read_data(prec%smther,psb_inp_unit) ! Smoother type.
call read_data(prec%aggrkind,psb_inp_unit) ! smoothed/raw aggregatin
call read_data(prec%aggr_alg,psb_inp_unit) ! local or global aggregation
call read_data(prec%aggr_ord,psb_inp_unit) ! Ordering for aggregation
call read_data(prec%mltype,psb_inp_unit) ! additive or multiplicative 2nd level prec
call read_data(prec%smthpos,psb_inp_unit) ! side: pre, post, both smoothing
call read_data(prec%cmat,psb_inp_unit) ! coarse mat
call read_data(prec%csolve,psb_inp_unit) ! Factorization type: BJAC, SuperLU, UMFPACK.
call read_data(prec%csbsolve,psb_inp_unit) ! Factorization type: ILU, SuperLU, UMFPACK.
call read_data(prec%cfill,psb_inp_unit) ! Fill-in for factorization
call read_data(prec%cthres,psb_inp_unit) ! Threshold for fact. ILU(T)
call read_data(prec%cjswp,psb_inp_unit) ! Jacobi sweeps
call read_data(prec%athres,psb_inp_unit) ! smoother aggr thresh
call read_data(prec%ascale,psb_inp_unit) ! smoother aggr thresh
call read_data(prec%ptype,psb_inp_unit) ! preconditioner type
! general AMG data
call read_data(prec%mltype,psb_inp_unit) ! AMG cycle type
call read_data(prec%otr_sweeps,psb_inp_unit) ! number of AMG cycles
call read_data(prec%maxlevs,psb_inp_unit) ! max number of levels in AMG prec
call read_data(prec%csize,psb_inp_unit) ! min size coarsest mat
! aggregation
call read_data(prec%aggrkind,psb_inp_unit) ! aggregation type
call read_data(prec%aggr_alg,psb_inp_unit) ! parallel aggregation alg
call read_data(prec%aggr_ord,psb_inp_unit) ! ordering for aggregation
call read_data(prec%aggr_filter,psb_inp_unit) ! filtering
call read_data(prec%mnaggratio,psb_inp_unit) ! minimum aggregation ratio
call read_data(prec%thrvsz,psb_inp_unit) ! size of aggr thresh vector
if (prec%thrvsz > 0) then
call psb_realloc(prec%thrvsz,prec%athresv,info)
call read_data(prec%athresv,psb_inp_unit) ! aggr thresh vector
else
read(psb_inp_unit,*) ! dummy read to skip a record
end if
call read_data(prec%athres,psb_inp_unit) ! smoothed aggr thresh
call read_data(prec%aggr_omalg,psb_inp_unit) ! alg for estimating omega
call read_data(prec%aggr_eig,psb_inp_unit) ! alg for estimating omega
call read_data(prec%omega_val,psb_inp_unit) ! alg for estimating omega
! 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
call psb_bcast(icontxt,mtrx)
call psb_bcast(icontxt,rhs)
call psb_bcast(icontxt,guess)
call psb_bcast(icontxt,sol)
call psb_bcast(icontxt,filefmt)
call psb_bcast(icontxt,kmethd)
call psb_bcast(icontxt,afmt)
call psb_bcast(icontxt,ipart)
call psb_bcast(icontxt,istopc)
call psb_bcast(icontxt,itmax)
call psb_bcast(icontxt,itrace)
call psb_bcast(icontxt,irst)
call psb_bcast(icontxt,eps)
call psb_bcast(icontxt,prec%descr) ! verbose description of the prec
call psb_bcast(icontxt,prec%prec) ! overall prectype
call psb_bcast(icontxt,prec%novr) ! number of overlap layers
call psb_bcast(icontxt,prec%restr) ! restriction over application of as
call psb_bcast(icontxt,prec%prol) ! prolongation over application of as
call psb_bcast(icontxt,prec%solve) ! Factorization type: ILU, SuperLU, UMFPACK.
call psb_bcast(icontxt,prec%fill) ! Fill-in for factorization
call psb_bcast(icontxt,prec%thr) ! Threshold for fact. ILU(T)
call psb_bcast(icontxt,prec%jsweeps) ! Jacobi sweeps
if (psb_toupper(prec%prec) == 'ML') then
call psb_bcast(icontxt,prec%smther) ! Smoother type.
call psb_bcast(icontxt,prec%nlev) ! Number of levels in multilevel prec.
call psb_bcast(icontxt,prec%aggrkind) ! smoothed/raw aggregatin
call psb_bcast(icontxt,prec%aggr_alg) ! local or global aggregation
call psb_bcast(icontxt,prec%aggr_ord) ! Ordering for aggregation
call psb_bcast(icontxt,prec%mltype) ! additive or multiplicative 2nd level prec
call psb_bcast(icontxt,prec%smthpos) ! side: pre, post, both smoothing
call psb_bcast(icontxt,prec%cmat) ! coarse mat
call psb_bcast(icontxt,prec%csolve) ! Factorization type: ILU, SuperLU, UMFPACK.
call psb_bcast(icontxt,prec%csbsolve) ! Factorization type: ILU, SuperLU, UMFPACK.
call psb_bcast(icontxt,prec%cfill) ! Fill-in for factorization
call psb_bcast(icontxt,prec%cthres) ! Threshold for fact. ILU(T)
call psb_bcast(icontxt,prec%cjswp) ! Jacobi sweeps
call psb_bcast(icontxt,prec%athres) ! smoother aggr thresh
call psb_bcast(icontxt,prec%ascale) ! smoother aggr scale factor
call psb_bcast(icontxt,solve%kmethd)
call psb_bcast(icontxt,solve%istopc)
call psb_bcast(icontxt,solve%itmax)
call psb_bcast(icontxt,solve%itrace)
call psb_bcast(icontxt,solve%irst)
call psb_bcast(icontxt,solve%eps)
call psb_bcast(icontxt,prec%descr)
call psb_bcast(icontxt,prec%ptype)
! broadcast first (pre-)smoother / 1-lev prec data
call psb_bcast(icontxt,prec%smther) ! actually not needed for 1-lev precs
call psb_bcast(icontxt,prec%jsweeps)
call psb_bcast(icontxt,prec%novr)
call psb_bcast(icontxt,prec%restr)
call psb_bcast(icontxt,prec%prol)
call psb_bcast(icontxt,prec%solve)
call psb_bcast(icontxt,prec%fill)
call psb_bcast(icontxt,prec%thr)
! broadcast (other) AMG parameters
if (psb_toupper(prec%ptype) == 'ML') then
call psb_bcast(icontxt,prec%mltype)
call psb_bcast(icontxt,prec%otr_sweeps)
call psb_bcast(icontxt,prec%maxlevs)
call psb_bcast(icontxt,prec%smther2)
call psb_bcast(icontxt,prec%jsweeps2)
call psb_bcast(icontxt,prec%novr2)
call psb_bcast(icontxt,prec%restr2)
call psb_bcast(icontxt,prec%prol2)
call psb_bcast(icontxt,prec%solve2)
call psb_bcast(icontxt,prec%fill2)
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
end subroutine get_parms
subroutine pr_usage(iout)
integer(psb_ipk_) iout
write(iout, *) ' number of parameters is incorrect!'
@ -511,4 +771,5 @@ contains
write(iout, *) ' ptype partition strategy default 0'
write(iout, *) ' 0: block partition '
end subroutine pr_usage
end program mld_zf_sample

@ -1,35 +1,52 @@
/opt/matrici/qc2534.mtx ! This matrix (and others) from: http://math.nist.gov/MatrixMarket/ or
NONE ! rhs | http://www.cise.ufl.edu/research/sparse/matrices/index.html
MM ! File format: MM (Matrix Market) HB (Harwell-Boeing).
BICGSTAB ! Iterative method: BiCGSTAB BiCG CGS RGMRES BiCGSTABL CG
NONE ! Initial guess
NONE ! Reference solution
MM ! File format: MatrixMarket or Harwell-Boeing
CSR ! Storage format: CSR COO JAD
0 ! IPART (partition method): 0 (block) 2 (graph, with Metis)
2 ! IPART (partition method): 0 (block) 2 (graph, with Metis)
FCG ! Iterative method: BiCGSTAB BiCG CGS RGMRES BiCGSTABL CG
2 ! ISTOPC
01000 ! ITMAX
-1 ! ITRACE
00500 ! ITMAX
1 ! ITRACE
30 ! IRST (restart for RGMRES and BiCGSTABL)
1.d-5 ! EPS
3L-M-RAS-I-D4 ! Longer descriptive name for preconditioner (up to 20 chars)
1.d-6 ! EPS
ML-VCYCLE-FBGS-MUMPS ! Longer descriptive name for preconditioner (up to 20 chars)
ML ! Preconditioner type: NONE JACOBI BJAC AS ML
VCYCLE ! Type of multilevel correction: ADD MULT
1 ! Number of outer sweeps
-3 ! Max Number of levels in a multilevel preconditioner; if <0, lib default
-3 ! Target coarse matrix size; if <0, lib default
SMOOTHED ! Type of aggregation: SMOOTHED NONSMOOTHED
DEC ! Parallel aggregation: DEC, SYMDEC
NATURAL ! Ordering of aggregation NATURAL DEGREE
NOFILTER ! Filtering of matrix ? FILTER NOFILTER
-1.5 ! Coarsening ratio, if < 0 use library default
2 ! Number of thresholds in vector, next line ignored if <= 0
0.05 0.025 ! Thresholds
0.0100d0 ! Smoothed aggregation threshold: >= 0.0
EIG_EST ! Omega algorithm: EIG_EST USER_CHOICE
A_NORMI ! Estimate procedure if EIG_EST
1.0 ! Estimate value (if USER_CHOICE)
FBGS ! Smoother type JACOBI BJAC AS ignored for non-ML
1 ! Number of sweeps for (pre) smoother
0 ! Number of overlap layers for AS preconditioner
HALO ! AS restriction operator: NONE HALO
NONE ! AS prolongation operator: NONE SUM AVG
ILU ! AS subdomain solver: DSCALE ILU MILU ILUT UMF SLU MUMPS
1 ! Fill level P for ILU(P) and ILU(T,P)
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 ! Jacobi sweeps for base smoother
3 ! Number of levels in a multilevel preconditioner
AS ! Smoother type JACOBI BJAC AS ignored for non-ML
SMOOTHED ! Type of aggregation: SMOOTHED NONSMOOTHED
DEC ! Type of aggregation: DEC
NATURAL ! Ordering of aggregation NATURAL DEGREE
MULT ! Type of multilevel correction: ADD MULT
POST ! Side of multiplicative correction PRE POST TWOSIDE (ignored for ADD)
NONE ! Second (post) smoother, ignored if NONE
1 ! Number of sweeps for (post) smoother
0 ! Number of overlap layers for AS preconditioner
HALO ! AS restriction operator: NONE HALO
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)
SLU ! Coarsest-level solver: JACOBI BJAC UMF SLU SLUDIST MUMPS
REPL ! Coarsest-level matrix distribution: DIST REPL
BJAC ! Coarsest-level solver: JACOBI BJAC UMF SLU SLUDIST MUMPS
ILU ! Coarsest-level subsolver: ILU UMF SLU MUMPS SLUDIST (DSCALE for JACOBI)
0 ! Coarsest-level fillin P for ILU(P) and ILU(T,P)
SLU ! 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)
4 ! Number of Jacobi sweeps for BJAC/PJAC coarsest-level solver
0.0125d0 ! Smoothed aggregation threshold: >= 0.0
0.5 ! Smoothed aggregation scaling factor.
1 ! Number of Jacobi sweeps for BJAC/PJAC coarsest-level solver

@ -1,9 +1,11 @@
A1M-hetero3D.mtx ! This matrix (and others) from: http://math.nist.gov/MatrixMarket/ or
B1M-hetero3D.mtx ! rhs | http://www.cise.ufl.edu/research/sparse/matrices/index.html
MM !
FCG ! Iterative method: BiCGSTAB BiCG CGS RGMRES BiCGSTABL CG
NONE ! Initial guess
NONE ! Reference solution
MM ! File format: MatrixMarket or Harwell-Boeing
CSR ! Storage format: CSR COO JAD
2 ! IPART (partition method): 0 (block) 2 (graph, with Metis)
FCG ! Iterative method: BiCGSTAB BiCG CGS RGMRES BiCGSTABL CG
2 ! ISTOPC
00500 ! ITMAX
1 ! ITRACE
@ -11,25 +13,40 @@ CSR ! Storage format: CSR COO JAD
1.d-6 ! EPS
ML-VCYCLE-FBGS-MUMPS ! Longer descriptive name for preconditioner (up to 20 chars)
ML ! Preconditioner type: NONE JACOBI BJAC AS ML
VCYCLE ! Type of multilevel correction: ADD MULT
1 ! Number of outer sweeps
-3 ! Max Number of levels in a multilevel preconditioner; if <0, lib default
-3 ! Target coarse matrix size; if <0, lib default
SMOOTHED ! Type of aggregation: SMOOTHED NONSMOOTHED
DEC ! Parallel aggregation: DEC, SYMDEC
NATURAL ! Ordering of aggregation NATURAL DEGREE
NOFILTER ! Filtering of matrix ? FILTER NOFILTER
-1.5 ! Coarsening ratio, if < 0 use library default
2 ! Number of thresholds in vector, next line ignored if <= 0
0.05 0.025 ! Thresholds
0.0100d0 ! Smoothed aggregation threshold: >= 0.0
EIG_EST ! Omega algorithm: EIG_EST USER_CHOICE
A_NORMI ! Estimate procedure if EIG_EST
1.0 ! Estimate value (if USER_CHOICE)
FBGS ! Smoother type JACOBI BJAC AS ignored for non-ML
1 ! Number of sweeps for (pre) smoother
0 ! Number of overlap layers for AS preconditioner
HALO ! AS restriction operator: NONE HALO
NONE ! AS prolongation operator: NONE SUM AVG
DSCALE ! AS subdomain solver: DSCALE ILU MILU ILUT UMF SLU MUMPS
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 ! Number of Jacobi sweeps for base smoother
-3 ! Number of levels in a multilevel preconditioner; if <0, lib default
FBGS ! Smoother type JACOBI BJAC AS ignored for non-ML
SMOOTHED ! Type of aggregation: SMOOTHED NONSMOOTHED
DEC ! Type of aggregation: DEC
NATURAL ! Ordering of aggregation NATURAL DEGREE
VCYCLE ! Type of multilevel correction: ADD MULT
TWOSIDE ! Side of multiplicative correction PRE POST TWOSIDE (ignored for ADD)
NONE ! Second (post) smoother, ignored if NONE
1 ! Number of sweeps for (post) smoother
0 ! Number of overlap layers for AS preconditioner
HALO ! AS restriction operator: NONE HALO
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)
SLUDIST ! Coarsest-level solver: JACOBI BJAC UMF SLU SLUDIST MUMPS
DIST ! Coarsest-level matrix distribution: DIST REPL
MUMPS ! Coarsest-level solver: JACOBI BJAC UMF SLU SLUDIST MUMPS
MUMPS ! Coarsest-level subsolver: ILU UMF SLU MUMPS SLUDIST
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
0.0100d0 ! Smoothed aggregation threshold: >= 0.0
1.0 ! Smoothed aggregation scaling factor.

@ -1,35 +1,52 @@
young1r.mtx ! This matrix (and others) from: http://math.nist.gov/MatrixMarket/ or
NONE ! rhs | http://www.cise.ufl.edu/research/sparse/matrices/index.html
MM ! File format: MM (Matrix Market) HB (Harwell-Boeing).
BICGSTAB ! Iterative method: BiCGSTAB BiCG CGS RGMRES BiCGSTABL CG
A1M-hetero3D.mtx ! This matrix (and others) from: http://math.nist.gov/MatrixMarket/ or
B1M-hetero3D.mtx ! rhs | http://www.cise.ufl.edu/research/sparse/matrices/index.html
NONE ! Initial guess
NONE ! Reference solution
MM ! File format: MatrixMarket or Harwell-Boeing
CSR ! Storage format: CSR COO JAD
0 ! IPART (partition method): 0 (block) 2 (graph, with Metis)
2 ! IPART (partition method): 0 (block) 2 (graph, with Metis)
FCG ! Iterative method: BiCGSTAB BiCG CGS RGMRES BiCGSTABL CG
2 ! ISTOPC
01000 ! ITMAX
-1 ! ITRACE
00500 ! ITMAX
1 ! ITRACE
30 ! IRST (restart for RGMRES and BiCGSTABL)
1.d-5 ! EPS
3L-M-RAS-I-D4 ! Longer descriptive name for preconditioner (up to 20 chars)
1.d-6 ! EPS
ML-VCYCLE-FBGS-MUMPS ! Longer descriptive name for preconditioner (up to 20 chars)
ML ! Preconditioner type: NONE JACOBI BJAC AS ML
VCYCLE ! Type of multilevel correction: ADD MULT
1 ! Number of outer sweeps
-3 ! Max Number of levels in a multilevel preconditioner; if <0, lib default
-3 ! Target coarse matrix size; if <0, lib default
SMOOTHED ! Type of aggregation: SMOOTHED NONSMOOTHED
DEC ! Parallel aggregation: DEC, SYMDEC
NATURAL ! Ordering of aggregation NATURAL DEGREE
NOFILTER ! Filtering of matrix ? FILTER NOFILTER
-1.5 ! Coarsening ratio, if < 0 use library default
2 ! Number of thresholds in vector, next line ignored if <= 0
0.05 0.025 ! Thresholds
0.0100d0 ! Smoothed aggregation threshold: >= 0.0
EIG_EST ! Omega algorithm: EIG_EST USER_CHOICE
A_NORMI ! Estimate procedure if EIG_EST
1.0 ! Estimate value (if USER_CHOICE)
FBGS ! Smoother type JACOBI BJAC AS ignored for non-ML
1 ! Number of sweeps for (pre) smoother
0 ! Number of overlap layers for AS preconditioner
HALO ! AS restriction operator: NONE HALO
NONE ! AS prolongation operator: NONE SUM AVG
ILU ! AS subdomain solver: DSCALE ILU MILU ILUT UMF SLU MUMPS
1 ! Fill level P for ILU(P) and ILU(T,P)
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)
4 ! Number of Jacobi sweeps for base smoother
4 ! Number of levels in a multilevel preconditioner
BJAC ! Smoother type JACOBI BJAC AS ignored for non-ML
SMOOTHED ! Type of aggregation: SMOOTHED NONSMOOTHED
DEC ! Type of aggregation: DEC
NATURAL ! Ordering of aggregation NATURAL DEGREE
MULT ! Type of multilevel correction: ADD MULT
POST ! Side of multiplicative correction PRE POST TWOSIDE (ignored for ADD)
NONE ! Second (post) smoother, ignored if NONE
1 ! Number of sweeps for (post) smoother
0 ! Number of overlap layers for AS preconditioner
HALO ! AS restriction operator: NONE HALO
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)
SLU ! Coarsest-level solver: JACOBI BJAC UMF SLU SLUDIST MUMPS
REPL ! Coarsest-level matrix distribution: DIST REPL
BJAC ! Coarsest-level solver: JACOBI BJAC UMF SLU SLUDIST MUMPS
ILU ! Coarsest-level subsolver: ILU UMF SLU MUMPS SLUDIST (DSCALE for JACOBI)
0 ! Coarsest-level fillin P for ILU(P) and ILU(T,P)
SLU ! 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)
4 ! Number of Jacobi sweeps for BJAC/PJAC coarsest-level solver
0.0125d0 ! Smoothed aggregation threshold: >= 0.0
0.5 ! Smoothed aggregation scaling factor.
1 ! Number of Jacobi sweeps for BJAC/PJAC coarsest-level solver

@ -1,35 +1,52 @@
young1c.mtx ! This matrix (and others) from: http://math.nist.gov/MatrixMarket/ or
NONE ! rhs | http://www.cise.ufl.edu/research/sparse/matrices/index.html
MM ! File format: MM (Matrix Market) HB (Harwell-Boeing).
BICGSTAB ! Iterative method: BiCGSTAB BiCG CGS RGMRES BiCGSTABL CG
A1M-hetero3D.mtx ! This matrix (and others) from: http://math.nist.gov/MatrixMarket/ or
B1M-hetero3D.mtx ! rhs | http://www.cise.ufl.edu/research/sparse/matrices/index.html
NONE ! Initial guess
NONE ! Reference solution
MM ! File format: MatrixMarket or Harwell-Boeing
CSR ! Storage format: CSR COO JAD
0 ! IPART (partition method): 0 (block) 2 (graph, with Metis)
2 ! IPART (partition method): 0 (block) 2 (graph, with Metis)
FCG ! Iterative method: BiCGSTAB BiCG CGS RGMRES BiCGSTABL CG
2 ! ISTOPC
00200 ! ITMAX
02 ! ITRACE
00500 ! ITMAX
1 ! ITRACE
30 ! IRST (restart for RGMRES and BiCGSTABL)
1.d-5 ! EPS
3L-M-RAS-I-D4 ! Longer descriptive name for preconditioner (up to 20 chars)
1.d-6 ! EPS
ML-VCYCLE-FBGS-MUMPS ! Longer descriptive name for preconditioner (up to 20 chars)
ML ! Preconditioner type: NONE JACOBI BJAC AS ML
VCYCLE ! Type of multilevel correction: ADD MULT
1 ! Number of outer sweeps
-3 ! Max Number of levels in a multilevel preconditioner; if <0, lib default
-3 ! Target coarse matrix size; if <0, lib default
SMOOTHED ! Type of aggregation: SMOOTHED NONSMOOTHED
DEC ! Parallel aggregation: DEC, SYMDEC
NATURAL ! Ordering of aggregation NATURAL DEGREE
NOFILTER ! Filtering of matrix ? FILTER NOFILTER
-1.5 ! Coarsening ratio, if < 0 use library default
2 ! Number of thresholds in vector, next line ignored if <= 0
0.05 0.025 ! Thresholds
0.0100d0 ! Smoothed aggregation threshold: >= 0.0
EIG_EST ! Omega algorithm: EIG_EST USER_CHOICE
A_NORMI ! Estimate procedure if EIG_EST
1.0 ! Estimate value (if USER_CHOICE)
FBGS ! Smoother type JACOBI BJAC AS ignored for non-ML
1 ! Number of sweeps for (pre) smoother
0 ! Number of overlap layers for AS preconditioner
HALO ! AS restriction operator: NONE HALO
NONE ! AS prolongation operator: NONE SUM AVG
ILU ! AS subdomain solver: DSCALE ILU MILU ILUT UMF SLU MUMPS
1 ! Fill level P for ILU(P) and ILU(T,P)
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)
4 ! Number of Jacobi sweeps for base smoother
4 ! Number of levels in a multilevel preconditioner
BJAC ! Smoother type JACOBI BJAC AS ignored for non-ML
SMOOTHED ! Type of aggregation: SMOOTHED NONSMOOTHED
DEC ! Type of aggregation: DEC
NATURAL ! Ordering of aggregation NATURAL DEGREE
MULT ! Type of multilevel correction: ADD MULT
POST ! Side of multiplicative correction PRE POST TWOSIDE (ignored for ADD)
REPL ! Coarsest-level matrix distribution: DIST REPL
BJAC ! Coarsest-level solver: JACOBI BJAC UMF SLU SLUDIST MUMPS
ILU ! Coarsest-level subsolver: ILU UMF SLU MUMPS SLUDIST (DSCALE for JACOBI)
0 ! Coarsest-level fillin P for ILU(P) and ILU(T,P)
NONE ! Second (post) smoother, ignored if NONE
1 ! Number of sweeps for (post) smoother
0 ! Number of overlap layers for AS preconditioner
HALO ! AS restriction operator: NONE HALO
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)
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)
4 ! Number of Jacobi sweeps for BJAC/PJAC coarsest-level solver
0.0125d0 ! Smoothed aggregation threshold: >= 0.0
0.5 ! Smoothed aggregation scaling factor.
1 ! Number of Jacobi sweeps for BJAC/PJAC coarsest-level solver

Loading…
Cancel
Save