<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 7 Nov 2019, at 5:32 AM, Smith, Barry F. <<a href="mailto:bsmith@mcs.anl.gov" class="">bsmith@mcs.anl.gov</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><br class=""> Some idiot logged what they did, but not why they did it.<br class=""><br class="">commit bf108f309acab50613e150419c680842cf4b8a05 (HEAD)<br class="">Author: Barry Smith <<a href="mailto:bsmith@mcs.anl.gov" class="">bsmith@mcs.anl.gov</a>><br class="">Date: Thu Mar 18 20:40:53 2004 -0600<br class=""><br class=""> bk-changeset-1.2063.1.1<br class=""> <a href="mailto:barrysmith@barry-smiths-computer.local" class="">barrysmith@barry-smiths-computer.local</a>|ChangeSet|20040319024053|12244<br class=""> ChangeSet<br class=""> 1.2063.1.1 04/03/18 20:40:53 <a href="mailto:barrysmith@barry-smiths-computer.local" class="">barrysmith@barry-smiths-computer.local</a> +5 -0<br class=""> if matrix is symmetric try to use preconditioner options for symmetric matrices<br class=""><br class=""><br class=""> Here is my guess as to this guys reasoning 15 years ago: if the user knows their problem is SPD and they thus switch to CG they will get garbage using the default ASM type, they will be confused and unhappy with the result not realizing that it is due to an inappropriate preconditioner default when using CG. The penalty is, of course, someone using GMRES will get slower convergence than they should as you point out.<br class=""><br class=""> Today I think we could do better. We could introduce the concept of a "symmetric" preconditioner PCIsSymmetric() PCIsSymmetricKnown() and then CG/all KSP that require symmetric preconditioners could query this information and error immediately if the PC indicates it is NOT symmetric.</div></div></blockquote><div><br class=""></div><div>Don’t forget about PCIsHermitian() and PCIsHermitianKnown().</div><div>But what you suggest goes along what Matt answered earlier.</div><div>All this is OK for me.</div><div>Though, in the meantime, I’ll force the type to RESTRICT in my PC (<a href="https://gitlab.com/petsc/petsc/commit/7e2068805d975b7ad588c59b62e2c0b3e60cd4af#2c7d367ac831f3b0c5fb767c0eb16c1ea7ae7fe0_720_722" class="">https://gitlab.com/petsc/petsc/commit/7e2068805d975b7ad588c59b62e2c0b3e60cd4af#2c7d367ac831f3b0c5fb767c0eb16c1ea7ae7fe0_720_722</a>), because I don’t think it’s OK to go from a convergence in 9 iterations:</div><div>[…]</div><div> 9 KSP Residual norm 3.632028841798e-05</div><div>[…]</div><div><div> PC Object: (pc_hpddm_levels_1_) 4 MPI processes</div><div> type: asm</div><div> total subdomain blocks = 4, user-defined overlap</div><div> restriction/interpolation type - RESTRICT</div><div>[…]</div></div><div>To a convergence in 26 iterations:</div><div>[…]</div><div> 26 KSP Residual norm 1.548760754380e-04</div><div>[…]</div><div> PC Object: (pc_hpddm_levels_1_) 4 MPI processes</div><div> type: asm</div><div> total subdomain blocks = 4, user-defined overlap</div><div> restriction/interpolation type - BASIC</div><div>[…]</div><div>For a Helmholtz equation with only 4 subdomains. But that’s just my opinion of course.</div><div><br class=""></div><div>Thanks,</div><div>Pierre</div><br class=""><blockquote type="cite" class=""><div class=""><div class=""> Or we could have PCSetSymmetric() which turns on whatever PC type specific options are needed to make the preconditioner symmetric and the symmetric requiring KSP could turn on this option. One has to be careful but because if the user specifically set RAS then it should not be overruled and changed without their knowledge. Note that in asm.c it has the code if (!osm->type_set) { so if the user set RAS it will not change it. <br class=""><br class=""> I am not sure that there is a perfect solution that satisfies all use cases but I agree the current behavior is questionable and could be replaced with better behavior that still prevents tragedies of failure of ASM with CG due to the defaults.<br class=""><br class=""> Barry<br class=""><br class=""><br class=""><br class=""><br class=""><blockquote type="cite" class="">On Nov 6, 2019, at 12:12 PM, Pierre Jolivet <<a href="mailto:pierre.jolivet@enseeiht.fr" class="">pierre.jolivet@enseeiht.fr</a>> wrote:<br class=""><br class="">I need to figure this out myself first.<br class="">In the meantime, here is another (PCASM related) question for you: why is PCASMType switched to BASIC when using a symmetric Pmat? (I guess I don’t have to tell you about the performance of RAS vs. ASM)<br class="">To me, that would make sense if the default KSP was also switched to CG instead of GMRES if the Pmat and Amat were symmetric, but I don’t think this is the case.<br class=""><br class="">Thanks,<br class="">Pierre<br class=""><br class=""><blockquote type="cite" class="">On 24 Oct 2019, at 5:40 PM, Smith, Barry F. <<a href="mailto:bsmith@mcs.anl.gov" class="">bsmith@mcs.anl.gov</a>> wrote:<br class=""><br class=""><br class="">Send the code and exact instructions to run a "good" and a "bad" ASM <br class=""><br class=""> Barry<br class=""><br class=""><br class=""><blockquote type="cite" class="">On Oct 14, 2019, at 10:44 AM, Pierre Jolivet <<a href="mailto:pierre.jolivet@enseeiht.fr" class="">pierre.jolivet@enseeiht.fr</a>> wrote:<br class=""><br class="">Here are the three logs.<br class="">FGMRES also gives a wrong first iterate.<br class="">I think Mark was right in the sense that the problem is _most likely_ in my RHS.<br class="">But I need to figure out why I only get this problem with right-preconditioned KSPs with restrict or none.<br class=""><br class="">Thanks,<br class="">Pierre<br class=""><br class=""><br class=""><br class=""><blockquote type="cite" class="">On 13 Oct 2019, at 8:16 PM, Smith, Barry F. <<a href="mailto:bsmith@mcs.anl.gov" class="">bsmith@mcs.anl.gov</a>> wrote:<br class=""><br class=""><br class="">Is this one process with one subdomain? (And hence no meaningful overlap since there is nothing to overlap?) And you expect to get the "exact" answer on one iteration? <br class=""><br class="">Please run the right preconditioned GMRES with -pc_asm_type [restrict and basic and none] -ksp_monitor_true_solution and send the output for the three cases.<br class=""><br class="">For kicks you can also try FGMRES (which always uses right preconditioning) to see if the same problem appears.<br class=""><br class="">Barry<br class=""><br class=""><br class=""><blockquote type="cite" class="">On Oct 13, 2019, at 2:41 AM, Pierre Jolivet via petsc-dev <<a href="mailto:petsc-dev@mcs.anl.gov" class="">petsc-dev@mcs.anl.gov</a>> wrote:<br class=""><br class="">Hello,<br class="">I’m struggling to understand the following weirdness with PCASM with exact subdomain solvers.<br class="">I’m dealing with a very simple Poisson problem with Dirichlet + Neumann BCs.<br class="">If I use PCBJACOBI + KSPPREONLY or 1 iteration of GMRES either preconditioned on the right or on the left, I get the expected result, cf. attached screenshot.<br class="">If I use PCASM + KSPPREONLY or 1 iteration of GMRES preconditioned on the left, I get the expected result as well.<br class="">However, with PCASM + 1 iteration of GMRES preconditioned on the right, I don’t get what I should (I believe).<br class="">Furthermore, this problem is specific to -pc_asm_type restrict,none (I get the expected result with basic,interpolate).<br class=""><br class="">Any hint?<br class=""><br class="">Thanks,<br class="">Pierre<br class=""><br class="">$ -sub_pc_type lu -ksp_max_it 1 -ksp_type gmres -pc_type bjacobi -ksp_pc_side right -> bjacobi_OK<br class="">$ -sub_pc_type lu -ksp_max_it 1 -ksp_type gmres -pc_type asm -ksp_pc_side left -> asm_OK<br class="">$ -sub_pc_type lu -ksp_max_it 1 -ksp_type gmres -pc_type asm -ksp_pc_side right -> asm_KO<br class=""><br class=""><bjacobi_OK.png><asm_OK.png><asm_KO.png><br class=""></blockquote><br class=""></blockquote><br class=""><dump-basic><dump-none><dump-restrict><br class=""></blockquote><br class=""></blockquote><br class=""></blockquote><br class=""></div></div></blockquote></div><br class=""></body></html>