From 12704981701a5d3b510e21257f64f0c6da0ae3e9 Mon Sep 17 00:00:00 2001 From: Salvatore Filippone Date: Fri, 16 Jul 2021 09:16:44 +0200 Subject: [PATCH] Fix examples --- samples/simple/fileread/amg_cexample_ml.f90 | 29 +++++++++++---------- samples/simple/fileread/amg_dexample_ml.f90 | 29 +++++++++++---------- samples/simple/fileread/amg_sexample_ml.f90 | 29 +++++++++++---------- samples/simple/fileread/amg_zexample_ml.f90 | 29 +++++++++++---------- samples/simple/pdegen/amg_dexample_ml.f90 | 2 +- samples/simple/pdegen/amg_sexample_ml.f90 | 2 +- 6 files changed, 62 insertions(+), 58 deletions(-) diff --git a/samples/simple/fileread/amg_cexample_ml.f90 b/samples/simple/fileread/amg_cexample_ml.f90 index e22734dc..7a05c4b3 100644 --- a/samples/simple/fileread/amg_cexample_ml.f90 +++ b/samples/simple/fileread/amg_cexample_ml.f90 @@ -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() diff --git a/samples/simple/fileread/amg_dexample_ml.f90 b/samples/simple/fileread/amg_dexample_ml.f90 index a8a4b4d3..ddc1c021 100644 --- a/samples/simple/fileread/amg_dexample_ml.f90 +++ b/samples/simple/fileread/amg_dexample_ml.f90 @@ -37,7 +37,7 @@ ! ! File: amg_dexample_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_dexample_ml integer :: ierr, ircode real(psb_dpk_) :: 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_dexample_ml ! solver call P%init(ctxt,'ML',info) - kmethod = 'CG' case(2) @@ -227,15 +227,16 @@ program amg_dexample_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_dexample_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_dexample_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() diff --git a/samples/simple/fileread/amg_sexample_ml.f90 b/samples/simple/fileread/amg_sexample_ml.f90 index 8f9b3f1c..3f3e3071 100644 --- a/samples/simple/fileread/amg_sexample_ml.f90 +++ b/samples/simple/fileread/amg_sexample_ml.f90 @@ -37,7 +37,7 @@ ! ! File: amg_sexample_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_sexample_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_sexample_ml ! solver call P%init(ctxt,'ML',info) - kmethod = 'CG' case(2) @@ -227,15 +227,16 @@ program amg_sexample_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_sexample_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_sexample_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() diff --git a/samples/simple/fileread/amg_zexample_ml.f90 b/samples/simple/fileread/amg_zexample_ml.f90 index 265f2931..e6c48d79 100644 --- a/samples/simple/fileread/amg_zexample_ml.f90 +++ b/samples/simple/fileread/amg_zexample_ml.f90 @@ -37,7 +37,7 @@ ! ! File: amg_zexample_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_zexample_ml integer :: ierr, ircode real(psb_dpk_) :: 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_zexample_ml ! solver call P%init(ctxt,'ML',info) - kmethod = 'CG' case(2) @@ -227,15 +227,16 @@ program amg_zexample_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_zexample_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_zexample_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() diff --git a/samples/simple/pdegen/amg_dexample_ml.f90 b/samples/simple/pdegen/amg_dexample_ml.f90 index c9c18fbd..757d19ec 100644 --- a/samples/simple/pdegen/amg_dexample_ml.f90 +++ b/samples/simple/pdegen/amg_dexample_ml.f90 @@ -173,7 +173,7 @@ program amg_dexample_ml case(1) ! initialize the default multi-level preconditioner, i.e. V-cycle - ! with basic smoothed aggregation, 1 hybrid forward/backward + ! with decoupled smoothed aggregation, 1 hybrid forward/backward ! GS sweep as pre/post-smoother and UMFPACK as coarsest-level ! solver diff --git a/samples/simple/pdegen/amg_sexample_ml.f90 b/samples/simple/pdegen/amg_sexample_ml.f90 index e3d023e1..8a00af88 100644 --- a/samples/simple/pdegen/amg_sexample_ml.f90 +++ b/samples/simple/pdegen/amg_sexample_ml.f90 @@ -173,7 +173,7 @@ program amg_sexample_ml case(1) ! initialize the default multi-level preconditioner, i.e. V-cycle - ! with basic smoothed aggregation, 1 hybrid forward/backward + ! with decoupled smoothed aggregation, 1 hybrid forward/backward ! GS sweep as pre/post-smoother and UMFPACK as coarsest-level ! solver