|
|
|
@ -37,7 +37,7 @@
|
|
|
|
|
!
|
|
|
|
|
! File: amg_cexample_ml.f90
|
|
|
|
|
!
|
|
|
|
|
! This sample program solves a linear system by using CG coupled with
|
|
|
|
|
! This sample program solves a linear system by using FCG coupled with
|
|
|
|
|
! one of the following multi-level preconditioner, as explained in Section 4.1
|
|
|
|
|
! of the AMG4PSBLAS User's and Reference Guide:
|
|
|
|
|
!
|
|
|
|
@ -50,8 +50,8 @@
|
|
|
|
|
! (with ILU(0) on the blocks) as pre- and post-smoother, and 8 block-Jacobi
|
|
|
|
|
! sweeps (with ILU(0) on the blocks) as coarsest-level solver (Sec. 4.1, Listing 2)
|
|
|
|
|
!
|
|
|
|
|
! - choice = 3, W-cycle preconditioner based on the coupled aggregation relying on matching,
|
|
|
|
|
! with maximum size of aggregates equal to 8 and smoothed prolongators,
|
|
|
|
|
! - choice = 3, W-cycle preconditioner based on the coupled aggregation relying
|
|
|
|
|
! on matching, with maximum size of aggregates equal to 8 and smoothed prolongators,
|
|
|
|
|
! 2 hybrid forward/backward GS sweeps as pre/post-smoother, a distributed coarsest
|
|
|
|
|
! matrix, and preconditioned Flexible Conjugate Gradient as coarsest-level solver
|
|
|
|
|
! (Sec. 4.1, Listing 3)
|
|
|
|
@ -103,7 +103,8 @@ program amg_cexample_ml
|
|
|
|
|
integer :: ierr, ircode
|
|
|
|
|
real(psb_spk_) :: resmx, resmxp
|
|
|
|
|
real(psb_dpk_) :: t1, t2, tprec
|
|
|
|
|
character(len=20) :: name, kmethod
|
|
|
|
|
character(len=20) :: name
|
|
|
|
|
character(len=20), parameter :: kmethod='FCG'
|
|
|
|
|
integer, parameter :: iunit=12
|
|
|
|
|
|
|
|
|
|
! initialize the parallel environment
|
|
|
|
@ -216,7 +217,6 @@ program amg_cexample_ml
|
|
|
|
|
! solver
|
|
|
|
|
|
|
|
|
|
call P%init(ctxt,'ML',info)
|
|
|
|
|
kmethod = 'CG'
|
|
|
|
|
|
|
|
|
|
case(2)
|
|
|
|
|
|
|
|
|
@ -227,15 +227,16 @@ program amg_cexample_ml
|
|
|
|
|
call P%init(ctxt,'ML',info)
|
|
|
|
|
call P%set('SMOOTHER_TYPE','BJAC',info)
|
|
|
|
|
call P%set('COARSE_SOLVE','BJAC',info)
|
|
|
|
|
call P%set('COARSE_SUBSOLVE','ILU',info)
|
|
|
|
|
call P%set('COARSE_SWEEPS',8,info)
|
|
|
|
|
kmethod = 'CG'
|
|
|
|
|
|
|
|
|
|
case(3)
|
|
|
|
|
|
|
|
|
|
! initialize a W-cycle preconditioner based on the coupled aggregation relying on matching,
|
|
|
|
|
! with maximum size of aggregates equal to 8 and smoothed prolongators,
|
|
|
|
|
! 2 hybrid forward/backward GS sweeps as pre/post-smoother, a distributed coarsest
|
|
|
|
|
! matrix, and preconditioned Flexible Conjugate Gradient as coarsest-level solver
|
|
|
|
|
! initialize a W-cycle preconditioner based on the coupled aggregation
|
|
|
|
|
! relying on matching, with maximum size of aggregates equal to 8
|
|
|
|
|
! and smoothed prolongators, 2 hybrid forward/backward GS sweeps
|
|
|
|
|
! as pre/post-smoother, a distributed coarsest matrix,
|
|
|
|
|
! and preconditioned Flexible Conjugate Gradient as coarsest-level solver
|
|
|
|
|
|
|
|
|
|
call P%init(ctxt,'ML',info)
|
|
|
|
|
call P%set('PAR_AGGR_ALG','COUPLED',info)
|
|
|
|
@ -244,10 +245,10 @@ program amg_cexample_ml
|
|
|
|
|
call P%set('ML_CYCLE','WCYCLE',info)
|
|
|
|
|
call P%set('SMOOTHER_SWEEPS',2,info)
|
|
|
|
|
call P%set('COARSE_SOLVE','KRM',info)
|
|
|
|
|
kmethod = 'CG'
|
|
|
|
|
end select
|
|
|
|
|
call P%set('COARSE_MAT','DIST',info)
|
|
|
|
|
call P%set('KRM_METHOD','FCG',info)
|
|
|
|
|
|
|
|
|
|
! build the preconditioner
|
|
|
|
|
end select
|
|
|
|
|
|
|
|
|
|
call psb_barrier(ctxt)
|
|
|
|
|
t1 = psb_wtime()
|
|
|
|
@ -269,7 +270,7 @@ program amg_cexample_ml
|
|
|
|
|
call x%zero()
|
|
|
|
|
call psb_geasb(x,desc_A,info)
|
|
|
|
|
|
|
|
|
|
! solve Ax=b with preconditioned CG
|
|
|
|
|
! solve Ax=b with preconditioned Krylov method
|
|
|
|
|
|
|
|
|
|
call psb_barrier(ctxt)
|
|
|
|
|
t1 = psb_wtime()
|
|
|
|
|