From 6321f680cbe9ea7d0ca987573806742edc7bce3a Mon Sep 17 00:00:00 2001 From: Salvatore Filippone Date: Mon, 16 May 2016 16:45:17 +0000 Subject: [PATCH] mld2p4-smooth-2side: mlprec/impl/mld_dmlprec_aply.f90 tests/fileread/runs/dfs.inp tests/pdegen/runs/ppde.inp Fixed bug in applicaoitn of two-sided. --- mlprec/impl/mld_dmlprec_aply.f90 | 68 ++++++++++++++++---------------- tests/fileread/runs/dfs.inp | 20 +++++----- tests/pdegen/runs/ppde.inp | 4 +- 3 files changed, 47 insertions(+), 45 deletions(-) diff --git a/mlprec/impl/mld_dmlprec_aply.f90 b/mlprec/impl/mld_dmlprec_aply.f90 index a5cceced..dd2938d5 100644 --- a/mlprec/impl/mld_dmlprec_aply.f90 +++ b/mlprec/impl/mld_dmlprec_aply.f90 @@ -434,7 +434,6 @@ contains ictxt = p%precv(level)%base_desc%get_context() call psb_info(ictxt, me, np) - if (level > 1) then nc2l = p%precv(level)%base_desc%get_local_cols() nr2l = p%precv(level)%base_desc%get_local_rows() @@ -584,7 +583,7 @@ contains else ! Here at coarse level sweeps = p%precv(level)%parms%sweeps - call p%precv(level)%sm2%apply(done,& + call p%precv(level)%sm%apply(done,& & mlprec_wrk(level)%x2l,dzero,mlprec_wrk(level)%y2l,& & p%precv(level)%base_desc, trans,& & sweeps,work,info) @@ -621,13 +620,17 @@ contains ! if (level < nlev) then sweeps = p%precv(level)%parms%sweeps_post + call p%precv(level)%sm2%apply(done,& + & mlprec_wrk(level)%x2l,dzero,mlprec_wrk(level)%y2l,& + & p%precv(level)%base_desc, trans,& + & sweeps,work,info) else sweeps = p%precv(level)%parms%sweeps + call p%precv(level)%sm%apply(done,& + & mlprec_wrk(level)%x2l,dzero,mlprec_wrk(level)%y2l,& + & p%precv(level)%base_desc, trans,& + & sweeps,work,info) end if - call p%precv(level)%sm2%apply(done,& - & mlprec_wrk(level)%x2l,dzero,mlprec_wrk(level)%y2l,& - & p%precv(level)%base_desc, trans,& - & sweeps,work,info) if (info /= psb_success_) then call psb_errpush(psb_err_internal_error_,name,& @@ -948,12 +951,12 @@ contains end if if (trans == 'N') then if (info == psb_success_) call p%precv(level)%sm2%apply(done,& - & mlprec_wrk(level)%x2l,dzero,mlprec_wrk(level)%y2l,& + & mlprec_wrk(level)%tx,done,mlprec_wrk(level)%y2l,& & p%precv(level)%base_desc, trans,& & sweeps,work,info) else if (info == psb_success_) call p%precv(level)%sm%apply(done,& - & mlprec_wrk(level)%x2l,dzero,mlprec_wrk(level)%y2l,& + & mlprec_wrk(level)%tx,done,mlprec_wrk(level)%y2l,& & p%precv(level)%base_desc, trans,& & sweeps,work,info) end if @@ -1115,7 +1118,7 @@ contains ! Arguments integer(psb_ipk_) :: level - type(mld_dprec_type), intent(inout) :: p + type(mld_dprec_type), target, intent(inout) :: p type(mld_mlprec_wrk_type), intent(inout) :: mlprec_wrk(:) character, intent(in) :: trans real(psb_dpk_),target :: work(:) @@ -1261,7 +1264,7 @@ contains & a_err='Error during prolongation') goto 9999 end if - + ! ! Compute the residual ! @@ -1285,7 +1288,7 @@ contains & a_err='Error during smoother_apply') goto 9999 end if - + else sweeps = p%precv(level)%parms%sweeps call p%precv(level)%sm2%apply(done,& @@ -1297,7 +1300,7 @@ contains & a_err='Error during smoother_apply') goto 9999 end if - + end if case('T','C') @@ -1358,7 +1361,7 @@ contains & a_err='Error in recursive call') goto 9999 end if - + call psb_map_Y2X(done,mlprec_wrk(level+1)%vy2l,& & done,mlprec_wrk(level)%vy2l,& @@ -1436,7 +1439,7 @@ contains & a_err='Error in recursive call') goto 9999 end if - + call psb_map_Y2X(done,mlprec_wrk(level+1)%vy2l,& & done,mlprec_wrk(level)%vy2l,& @@ -1477,7 +1480,7 @@ contains & a_err='Error in recursive call') goto 9999 end if - + ! ! Apply the prolongator ! @@ -1489,7 +1492,7 @@ contains & a_err='Error during prolongation') goto 9999 end if - + ! ! Compute the residual ! @@ -1556,29 +1559,30 @@ contains if (level < nlev) then if (trans == 'N') then sweeps = p%precv(level)%parms%sweeps_pre + if (info == psb_success_) call p%precv(level)%sm%apply(done,& + & mlprec_wrk(level)%vx2l,dzero,mlprec_wrk(level)%vy2l,& + & p%precv(level)%base_desc, trans,& + & sweeps,work,info) else sweeps = p%precv(level)%parms%sweeps_post + if (info == psb_success_) call p%precv(level)%sm2%apply(done,& + & mlprec_wrk(level)%vx2l,dzero,mlprec_wrk(level)%vy2l,& + & p%precv(level)%base_desc, trans,& + & sweeps,work,info) end if else sweeps = p%precv(level)%parms%sweeps - end if - if (trans == 'N') then if (info == psb_success_) call p%precv(level)%sm%apply(done,& & mlprec_wrk(level)%vx2l,dzero,mlprec_wrk(level)%vy2l,& & p%precv(level)%base_desc, trans,& & sweeps,work,info) - else - if (info == psb_success_) call p%precv(level)%sm2%apply(done,& - & mlprec_wrk(level)%vx2l,dzero,mlprec_wrk(level)%vy2l,& - & p%precv(level)%base_desc, trans,& - & sweeps,work,info) end if if (info /= psb_success_) then call psb_errpush(psb_err_internal_error_,name,& & a_err='Error during 1st smoother_apply') goto 9999 end if - + ! ! Compute the residual (at all levels but the coarsest one) ! and call recursively @@ -1604,7 +1608,7 @@ contains & a_err='Error in recursive call') goto 9999 end if - + ! ! Apply the prolongator @@ -1612,13 +1616,13 @@ contains call psb_map_Y2X(done,mlprec_wrk(level+1)%vy2l,& & done,mlprec_wrk(level)%vy2l,& & p%precv(level+1)%map,info,work=work) - + if (info /= psb_success_) then call psb_errpush(psb_err_internal_error_,name,& & a_err='Error during prolongation') goto 9999 end if - + ! ! Compute the residual ! @@ -1635,20 +1639,18 @@ contains ! if (trans == 'N') then sweeps = p%precv(level)%parms%sweeps_post - else - sweeps = p%precv(level)%parms%sweeps_pre - end if - if (trans == 'N') then if (info == psb_success_) call p%precv(level)%sm2%apply(done,& - & mlprec_wrk(level)%vx2l,dzero,mlprec_wrk(level)%vy2l,& + & mlprec_wrk(level)%vtx,done,mlprec_wrk(level)%vy2l,& & p%precv(level)%base_desc, trans,& & sweeps,work,info) else + sweeps = p%precv(level)%parms%sweeps_pre if (info == psb_success_) call p%precv(level)%sm%apply(done,& - & mlprec_wrk(level)%vx2l,dzero,mlprec_wrk(level)%vy2l,& + & mlprec_wrk(level)%vtx,done,mlprec_wrk(level)%vy2l,& & p%precv(level)%base_desc, trans,& & sweeps,work,info) end if + if (info /= psb_success_) then call psb_errpush(psb_err_internal_error_,name,& & a_err='Error during 2nd smoother_apply') diff --git a/tests/fileread/runs/dfs.inp b/tests/fileread/runs/dfs.inp index ed274e1d..1f8cd7a0 100644 --- a/tests/fileread/runs/dfs.inp +++ b/tests/fileread/runs/dfs.inp @@ -1,29 +1,29 @@ DATIAMBRA/matrix.mm ! This matrix (and others) from: http://math.nist.gov/MatrixMarket/ or DATIAMBRA/rhs.mm ! rhs | http://www.cise.ufl.edu/research/sparse/matrices/index.html MM ! -CG ! Iterative method: BiCGSTAB BiCG CGS RGMRES BiCGSTABL CG +BICGSTAB ! Iterative method: BiCGSTAB BiCG CGS RGMRES BiCGSTABL CG CSR ! Storage format: CSR COO JAD 0 ! IPART (partition method): 0 (block) 2 (graph, with Metis) 2 ! ISTOPC -01500 ! ITMAX -10 ! ITRACE +00100 ! ITMAX +01 ! ITRACE 30 ! IRST (restart for RGMRES and BiCGSTABL) 1.d-6 ! EPS -4L-M-RAS-I-UR ! Longer descriptive name for preconditioner (up to 20 chars) +5L-M-RAS-I-UR ! Longer descriptive name for preconditioner (up to 20 chars) ML ! Preconditioner type: NONE JACOBI BJAC AS ML 1 ! Number of overlap layers for AS preconditioner HALO ! AS restriction operator: NONE HALO NONE ! AS prolongation operator: NONE SUM AVG -GS ! AS subdomain solver: DSCALE ILU MILU ILUT UMF SLU MUMPS -4 ! Fill level P for ILU(P) and ILU(T,P) +ILU ! AS 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 -5 ! Number of levels in a multilevel preconditioner +4 ! Number of levels in a multilevel preconditioner AS ! Smoother type JACOBI BJAC AS ignored for non-ML -UNSMOOTHED ! Type of aggregation: SMOOTHED NONSMOOTHED +SMOOTHED ! Type of aggregation: SMOOTHED NONSMOOTHED DEC ! Type of aggregation: DEC -MULT ! Type of multilevel correction: ADD MULT -TWOSIDE ! Side of correction PRE POST TWOSIDE (ignored for ADD) +ADD ! Type of multilevel correction: ADD MULT +PRE ! Side of correction PRE POST TWOSIDE (ignored for ADD) DIST ! Coarsest-level matrix distribution: DIST REPL BJAC ! Coarsest-level solver: JACOBI BJAC UMF SLU MUMPS SLUDIST ILU ! Coarsest-level subsolver: ILU UMF SLU MUMPS SLUDIST (DSCALE for JACOBI) diff --git a/tests/pdegen/runs/ppde.inp b/tests/pdegen/runs/ppde.inp index 869bb17d..560987bb 100644 --- a/tests/pdegen/runs/ppde.inp +++ b/tests/pdegen/runs/ppde.inp @@ -1,4 +1,4 @@ -BICGSTAB ! Iterative method: BiCGSTAB BiCG CGS RGMRES BiCGSTABL CG +CG ! Iterative method: BiCGSTAB BiCG CGS RGMRES BiCGSTABL CG CSR ! Storage format CSR COO JAD 0040 ! IDIM; domain size is idim**3 2 ! ISTOPC @@ -20,7 +20,7 @@ BJAC ! Smoother type JACOBI BJAC AS; ignored for non-ML 2 ! Number of levels in a multilevel preconditioner SMOOTHED ! Kind of aggregation: SMOOTHED, NONSMOOTHED, MINENERGY DEC ! Type of aggregation DEC SYMDEC GLB -DEGREE ! Ordering of aggregation NATURAL DEGREE +NATURAL ! Ordering of aggregation NATURAL DEGREE MULT ! Type of multilevel correction: ADD MULT TWOSIDE ! Side of correction PRE POST TWOSIDE (ignored for ADD) DIST ! Coarse level: matrix distribution DIST REPL