<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><br><div><br><blockquote type="cite"><div>On Jul 5, 2023, at 1:18 PM, Khurana, Parv <p.khurana22@imperial.ac.uk> wrote:</div><br class="Apple-interchange-newline"><div><meta charset="UTF-8"><div class="WordSection1" style="page: WordSection1; caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;"><span>Hi Barry,<span class="Apple-converted-space"> </span><o:p></o:p></span></div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;"><span><o:p> </o:p></span></div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;"><span>Using<span class="Apple-converted-space"> </span></span>-<span style="font-family: "Courier New";">ksp_type preonly,</span><span>and tweaking -pc_hypre_boomeramg_max_iter <it> and -pc_hypre_boomeramg_tol <tol> according to my needs seems to have done the trick for me.<span class="Apple-converted-space"> </span></span></div></div></div></blockquote><div><br></div>  Sure, but there is no particular advantage (or disadvantage that I know of) in doing it this way. It is just a question of whether PETSc (via -ksp_type richardson) or hypre (via <span style="font-family: Calibri, sans-serif;">-pc_hypre_boomeramg_max_iter</span><span style="font-family: Calibri, sans-serif;"> ) controls the simple iteration (what we call Richardson in PETSc) that wraps around the V-cycle.  I would be surprised if the solve time between -ksp_typre richardson and </span><span style="font-family: Calibri, sans-serif;">-pc_hypre_boomeramg_max_iter <it> and -pc_hypre_boomeramg_tol <tol> with similar tolerances was different significantly.</span></div><div><font face="Calibri, sans-serif"><span style="font-size: 14.666667px;"><br></span></font><blockquote type="cite"><div><div class="WordSection1" style="page: WordSection1; caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;"><span><o:p></o:p></span></div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;"><span><o:p> </o:p></span></div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;"><span>Credit:<span class="Apple-converted-space"> </span><a href="https://petsc.org/release/faq/#i-want-to-use-hypre-boomeramg-without-gmres-but-when-i-run-pc-type-hypre-pc-hypre-type-boomeramg-ksp-type-preonly-i-don-t-get-a-very-accurate-answer" style="color: blue; text-decoration: underline;">https://petsc.org/release/faq/#i-want-to-use-hypre-boomeramg-without-gmres-but-when-i-run-pc-type-hypre-pc-hypre-type-boomeramg-ksp-type-preonly-i-don-t-get-a-very-accurate-answer</a><o:p></o:p></span></div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;"><span><o:p> </o:p></span></div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;"><span>Best<o:p></o:p></span></div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;"><span>Parv<o:p></o:p></span></div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;"><span><o:p> </o:p></span></div><div><div style="border-width: 1pt medium medium; border-style: solid none none; border-color: rgb(225, 225, 225) currentcolor currentcolor; border-image: none; padding: 3pt 0cm 0cm;"><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;"><b><span lang="EN-US">From:</span></b><span lang="EN-US"><span class="Apple-converted-space"> </span>petsc-users <<a href="mailto:petsc-users-bounces@mcs.anl.gov" style="color: blue; text-decoration: underline;">petsc-users-bounces@mcs.anl.gov</a>><span class="Apple-converted-space"> </span><b>On Behalf Of<span class="Apple-converted-space"> </span></b>Khurana, Parv<br><b>Sent:</b><span class="Apple-converted-space"> </span>05 July 2023 17:09<br><b>To:</b><span class="Apple-converted-space"> </span>Barry Smith <<a href="mailto:bsmith@petsc.dev" style="color: blue; text-decoration: underline;">bsmith@petsc.dev</a>><br><b>Cc:</b><span class="Apple-converted-space"> </span><a href="mailto:petsc-users@mcs.anl.gov" style="color: blue; text-decoration: underline;">petsc-users@mcs.anl.gov</a><br><b>Subject:</b><span class="Apple-converted-space"> </span>Re: [petsc-users] Running AMG libraries as standalone solvers<o:p></o:p></span></div></div></div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;"><o:p> </o:p></div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;"><span>Thank you Mark, Barry for the advice.<o:p></o:p></span></div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;"><span><o:p> </o:p></span></div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;">-ksp_type richardson may be what I am looking for. I wanted a simple iterative scheme that allows AMG to be the main work horse – this allows that.<o:p></o:p></div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;"><o:p> </o:p></div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;">On using -<span style="font-family: "Courier New";">ksp_type preonly</span>, I observed only 1 KSP iteration and it does not drop the residual norm to my desired level<span class="Apple-converted-space"> </span><span style="font-family: "Courier New";">(-ksp_rtol 1e-7</span>). Whereas when I use gmres or Richardson I see 6-10 ksp iterations and the desired residual drop. Is it possible to increase (and fix) the number of KSP iterations with preonly? You mentioned below that it gives only one cycle so I presume it is not possible.<o:p></o:p></div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;"><o:p> </o:p></div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;">Geometric mg is not a feasible option for my application as I will be ultimately dealing with 3D, unstructured meshes for hp-finite element methods. Some clever tweaks may allow it (like having sub-structured meshes) but not as of now.<o:p></o:p></div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;"><o:p> </o:p></div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;">Best<o:p></o:p></div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;">Parv<o:p></o:p></div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;"><span><o:p> </o:p></span></div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;"><span><o:p> </o:p></span></div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;"><span><o:p> </o:p></span></div><div><div style="border-width: 1pt medium medium; border-style: solid none none; border-color: rgb(225, 225, 225) currentcolor currentcolor; border-image: none; padding: 3pt 0cm 0cm;"><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;"><b><span lang="EN-US">From:</span></b><span lang="EN-US"><span class="Apple-converted-space"> </span>Barry Smith <<a href="mailto:bsmith@petsc.dev" style="color: blue; text-decoration: underline;">bsmith@petsc.dev</a>><span class="Apple-converted-space"> </span><br><b>Sent:</b><span class="Apple-converted-space"> </span>05 July 2023 16:51<br><b>To:</b><span class="Apple-converted-space"> </span>Khurana, Parv <<a href="mailto:p.khurana22@imperial.ac.uk" style="color: blue; text-decoration: underline;">p.khurana22@imperial.ac.uk</a>><br><b>Cc:</b><span class="Apple-converted-space"> </span><a href="mailto:petsc-users@mcs.anl.gov" style="color: blue; text-decoration: underline;">petsc-users@mcs.anl.gov</a><br><b>Subject:</b><span class="Apple-converted-space"> </span>Re: [petsc-users] Running AMG libraries as standalone solvers<o:p></o:p></span></div></div></div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;"><o:p> </o:p></div><table class="MsoNormalTable" border="1" cellspacing="0" cellpadding="0"><tbody><tr><td style="border: medium; background: rgb(255, 255, 204); padding: 0cm;"><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 10pt; font-family: Arial, sans-serif;">This email from<span class="Apple-converted-space"> </span><a href="mailto:bsmith@petsc.dev" style="color: blue; text-decoration: underline;">bsmith@petsc.dev</a><span class="Apple-converted-space"> </span>originates from outside Imperial. Do not click on links and attachments unless you recognise the sender. If you trust the sender, add them to your<span class="Apple-converted-space"> </span><a href="https://spam.ic.ac.uk/SpamConsole/Senders.aspx" style="color: blue; text-decoration: underline;">safe senders list</a><span class="Apple-converted-space"> </span>to disable email stamping for this address.</span><o:p></o:p></div></td></tr></tbody></table><p> <o:p></o:p></p><div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;"><o:p> </o:p></div></div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;">   BTW: in my experience<o:p></o:p></div><div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;"><o:p> </o:p></div></div><div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;">Geometric multigrid generally works great as a standalone solver, that is accelerating it with a Krylov method is not needed, and while it may improve the convergence rate slightly, it may end up taking a bit more time then not using the Krylov solver (due to the extra Krylov solver overhead).<o:p></o:p></div></div><div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;"><o:p> </o:p></div></div><div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;">Algebraic multigrid is usually run with a Krylov solver and running without a Krylov solver, as far as I am aware, generally performs poorly.<o:p></o:p></div><div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;"><o:p> </o:p></div><div><p class="MsoNormal" style="margin: 0cm 0cm 12pt; font-size: 11pt; font-family: Calibri, sans-serif;"><o:p> </o:p></p><blockquote style="margin-top: 5pt; margin-bottom: 5pt;"><div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;">On Jul 5, 2023, at 11:46 AM, Barry Smith <<a href="mailto:bsmith@petsc.dev" style="color: blue; text-decoration: underline;">bsmith@petsc.dev</a>> wrote:<o:p></o:p></div></div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;"><o:p> </o:p></div><div><div><div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;"><o:p> </o:p></div></div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;">  -ksp_type richardson<o:p></o:p></div><div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;"><o:p> </o:p></div></div><div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;">  If you use -ksp_typre preonly you effectively get one V-cycle (or whatever cycle type you may have selected) which in general, will give you a more or less garbage answer<o:p></o:p></div></div><div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;"><o:p> </o:p></div></div><div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;"><o:p> </o:p></div><div><p class="MsoNormal" style="margin: 0cm 0cm 12pt; font-size: 11pt; font-family: Calibri, sans-serif;"><o:p> </o:p></p><blockquote style="margin-top: 5pt; margin-bottom: 5pt;"><div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;">On Jul 5, 2023, at 11:28 AM, Khurana, Parv <<a href="mailto:p.khurana22@imperial.ac.uk" style="color: blue; text-decoration: underline;">p.khurana22@imperial.ac.uk</a>> wrote:<o:p></o:p></div></div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;"><o:p> </o:p></div><div><div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;">Hello PETSc users,<o:p></o:p></div></div><div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;"> <o:p></o:p></div></div><div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;">I am fairly inexperienced with PETSc as of now and am new to the mailing list! Thanks for running this channel.<o:p></o:p></div></div><div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;"> <o:p></o:p></div></div><div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;">I seek basic help regarding running AMG routines (BoomerAMG/ML/GAMG). I am trying to compare the performance of solving a Poisson problem using a AMG Preconditioned GMRES iterative solve vs using AMG as the solver. I use PETSc options using the options database keys as of now, and it is connected to a flow solver (Nektar++) I use for my research.<o:p></o:p></div></div><div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;"> <o:p></o:p></div></div><div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;">I currently run the AMG Preconditioned GMRES iterative solve by setting<span class="apple-converted-space"> </span><span style="font-family: "Courier New";">-ksp_type gmres</span><span class="apple-converted-space"> </span>and then specifying the preconditioner I want using, for e.g, -<span style="font-family: "Courier New";">pc_type hypre -pc_hypre_type boomeramg</span>. If I want to use the AMG routine, I am currently setting<span class="apple-converted-space"> </span><span style="font-family: "Courier New";">-ksp_type preonly</span><span class="apple-converted-space"> </span>and the same<span class="apple-converted-space"> </span><span style="font-family: "Courier New";">-pc_type</span>. However, I am not sure if this is correct way to go about it due to two reasons:  a) my solution using AMG as a solver with these options has a larger error than AMG Preconditioned GMRES (which could still be acceptable), and b) I could not find any clear documentation regarding how to use AMG directly as a solver. I saw some hints in the examples here<a href="https://petsc.org/main/tutorials/handson/" style="color: blue; text-decoration: underline;"><span style="color: rgb(5, 99, 193);">https://petsc.org/main/tutorials/handson/#</span></a>, but it hasn’t helped me.<o:p></o:p></div></div><div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;"> <o:p></o:p></div></div><div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;">Any hints on how to use AMG directly as a solver?<o:p></o:p></div></div><div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;"> <o:p></o:p></div></div><div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;">Best<o:p></o:p></div></div><div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;">Parv</div></div></div></blockquote></div></div></div></div></blockquote></div></div></div></div></div></blockquote></div><br></body></html>