<div dir="ltr">Hi Jose,<div><br></div><div>Sorry, it took me a while to test these settings in the new builds. I am getting good improvement in performance using the preconditioned solvers, so thanks for the suggestions! But I have some questions related to the usage.</div><div><br></div><div>We are using SLEPc to solve the acoustic modal eigenvalue problem. Attached is a simple standalone program that computes acoustic modes in a simple rectangular box. This program illustrates the general setup I am using, though here the shell matrix and the preconditioner matrix are the same, while in my actual program the shell matrix computes A*x without explicitly forming A, and the preconditioner is a 0th order approximation of A.</div><div><br></div><div>In the attached program I have tested both</div><div>1) the Krylov-Schur with inexact shift-and-invert (implemented under the option <font face="monospace">sinvert</font>);</div><div>2) the JD solver with preconditioner (implemented under the option <font face="monospace">usejd</font>)</div><div><br></div><div>Both the solvers seem to work decently, compared to no preconditioning. This is how I run the two solvers (for a mesh size of 1600x400):</div><div><font face="monospace">$ ./acoustic_box_test.o -nx 1600 -ny 400 -usejd 1 -deflate 1 -eps_target 0<br></font></div><div><font face="monospace">$ ./acoustic_box_test.o -nx 1600 -ny 400 -sinvert 1 -deflate 1 -eps_target 0</font><br></div><div><span style="font-family:arial,sans-serif">Both finish in about ~10 minutes on my system in serial. JD seems to be slightly faster and more accurate (for the imaginary part of eigenvalue).</span><br></div><div><span style="font-family:arial,sans-serif">The program also runs in parallel using mpiexec. I use complex builds, as in my main program the matrix can be complex.</span></div><div><span style="font-family:arial,sans-serif"><br></span></div><div><span style="font-family:arial,sans-serif">Now here are my questions:</span></div><div><span style="font-family:arial,sans-serif">1) For this particular problem type, could you please check if these are the best settings that one could use? I have tried different combinations of KSP/PC types e.g. GMRES, GAMG, etc, but BCGSL + BJACOBI seems to work the best in serial and parallel.</span></div><div><span style="font-family:arial,sans-serif"><br></span></div><div><font face="arial, sans-serif">2) When I tested these settings in my main program, for some reason the JD solver was not converging. After further testing, I found the issue was related to the setting of "</font><font face="monospace" style="">-eps_target 0</font><font face="arial, sans-serif">". I have included "</font><font face="monospace">EPSSetTarget(eps,0.0);</font>" in the program and I assumed this is equivalent to passing "<font face="monospace">-eps_target 0</font>" from the command line, but that doesn't seem to be the case. For instance, if I run the attached program without "-eps_target 0" in the command line then it doesn't converge.</div><div>$ <span style="font-family:monospace">./acoustic_box_test.o -nx 1600 -ny 400 -usejd 1 -deflate 1 -eps_target 0</span></div><div><span style="font-family:monospace"> the above finishes in about 10 minutes</span></div><div><span style="font-family:monospace">$ </span><span style="font-family:monospace">./acoustic_box_test.o -nx 1600 -ny 400 -usejd 1 -deflate 1</span></div><div><span style="font-family:monospace"> the above doesn't converge even though "</span><span style="font-family:monospace">EPSSetTarget(eps,0.0);" is included in the code</span></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">This only seems to affect the JD solver, not the Krylov shift-and-invert (-sinvert 1) option. So is there any difference between passing "</font><font face="monospace">-eps_target 0</font><font face="arial, sans-serif">" from the command line vs using </font><span style="font-family:arial,sans-serif">"</span><font face="monospace">EPSSetTarget(eps,0.0);</font>" in the code? I cannot pass any command line arguments in my actual program, so need to set everything internally.</div><div><br></div><div>3) Also, another minor related issue. While using the inexact shift-and-invert option, I was running into the following error:</div><div><br></div><div>""</div><div><font face="monospace">Missing or incorrect user input</font></div><div><font face="monospace">Shift-and-invert requires a target 'which' (see EPSSetWhichEigenpairs), for instance -st_type sinvert -eps_target 0 -eps_target_magnitude</font></div><div>""<br></div><div><br></div><div>I already have the below two lines in the code:</div><div><font face="monospace">EPSSetWhichEigenpairs(eps,EPS_SMALLEST_MAGNITUDE);<br></font></div><div><font face="monospace">EPSSetTarget(eps,0.0);</font><br></div><div><font face="monospace"><br></font></div><div><font face="arial, sans-serif">so shouldn't these be enough? If I comment out the first line "EPSSetWhichEigenpairs", then the code works fine.</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">I have some more questions regarding setting the preconditioner for a quadratic eigenvalue problem, which I will ask in a follow-up email.</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">Thanks for your help!</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">-Varun</font></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jul 1, 2021 at 5:01 AM Varun Hiremath <<a href="mailto:varunhiremath@gmail.com" target="_blank">varunhiremath@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto"><div>Thank you very much for these suggestions! We are currently using version 3.12, so I'll try to update to the latest version and try your suggestions. Let me get back to you, thanks!<br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jul 1, 2021, 4:45 AM Jose E. Roman <<a href="mailto:jroman@dsic.upv.es" target="_blank">jroman@dsic.upv.es</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Then I would try Davidson methods <a href="https://doi.org/10.1145/2543696" rel="noreferrer noreferrer" target="_blank">https://doi.org/10.1145/2543696</a><br>
You can also try Krylov-Schur with "inexact" shift-and-invert, for instance, with preconditioned BiCGStab or GMRES, see section 3.4.1 of the users manual.<br>
<br>
In both cases, you have to pass matrix A in the call to EPSSetOperators() and the preconditioner matrix via STSetPreconditionerMat() - note this function was introduced in version 3.15.<br>
<br>
Jose<br>
<br>
<br>
<br>
> El 1 jul 2021, a las 13:36, Varun Hiremath <<a href="mailto:varunhiremath@gmail.com" rel="noreferrer" target="_blank">varunhiremath@gmail.com</a>> escribió:<br>
> <br>
> Thanks. I actually do have a 1st order approximation of matrix A, that I can explicitly compute and also invert. Can I use that matrix as preconditioner to speed things up? Is there some example that explains how to setup and call SLEPc for this scenario? <br>
> <br>
> On Thu, Jul 1, 2021, 4:29 AM Jose E. Roman <<a href="mailto:jroman@dsic.upv.es" rel="noreferrer" target="_blank">jroman@dsic.upv.es</a>> wrote:<br>
> For smallest real parts one could adapt ex34.c, but it is going to be costly <a href="https://slepc.upv.es/documentation/current/src/eps/tutorials/ex36.c.html" rel="noreferrer noreferrer" target="_blank">https://slepc.upv.es/documentation/current/src/eps/tutorials/ex36.c.html</a><br>
> Also, if eigenvalues are clustered around the origin, convergence may still be very slow.<br>
> <br>
> It is a tough problem, unless you are able to compute a good preconditioner of A (no need to compute the exact inverse).<br>
> <br>
> Jose<br>
> <br>
> <br>
> > El 1 jul 2021, a las 13:23, Varun Hiremath <<a href="mailto:varunhiremath@gmail.com" rel="noreferrer" target="_blank">varunhiremath@gmail.com</a>> escribió:<br>
> > <br>
> > I'm solving for the smallest eigenvalues in magnitude. Though is it cheaper to solve smallest in real part, as that might also work in my case? Thanks for your help.<br>
> > <br>
> > On Thu, Jul 1, 2021, 4:08 AM Jose E. Roman <<a href="mailto:jroman@dsic.upv.es" rel="noreferrer" target="_blank">jroman@dsic.upv.es</a>> wrote:<br>
> > Smallest eigenvalue in magnitude or real part?<br>
> > <br>
> > <br>
> > > El 1 jul 2021, a las 11:58, Varun Hiremath <<a href="mailto:varunhiremath@gmail.com" rel="noreferrer" target="_blank">varunhiremath@gmail.com</a>> escribió:<br>
> > > <br>
> > > Sorry, no both A and B are general sparse matrices (non-hermitian). So is there anything else I could try?<br>
> > > <br>
> > > On Thu, Jul 1, 2021 at 2:43 AM Jose E. Roman <<a href="mailto:jroman@dsic.upv.es" rel="noreferrer" target="_blank">jroman@dsic.upv.es</a>> wrote:<br>
> > > Is the problem symmetric (GHEP)? In that case, you can try LOBPCG on the pair (A,B). But this will likely be slow as well, unless you can provide a good preconditioner.<br>
> > > <br>
> > > Jose<br>
> > > <br>
> > > <br>
> > > > El 1 jul 2021, a las 11:37, Varun Hiremath <<a href="mailto:varunhiremath@gmail.com" rel="noreferrer" target="_blank">varunhiremath@gmail.com</a>> escribió:<br>
> > > > <br>
> > > > Hi All,<br>
> > > > <br>
> > > > I am trying to compute the smallest eigenvalues of a generalized system A*x= lambda*B*x. I don't explicitly know the matrix A (so I am using a shell matrix with a custom matmult function) however, the matrix B is explicitly known so I compute inv(B)*A within the shell matrix and solve inv(B)*A*x = lambda*x.<br>
> > > > <br>
> > > > To compute the smallest eigenvalues it is recommended to solve the inverted system, but since matrix A is not explicitly known I can't invert the system. Moreover, the size of the system can be really big, and with the default Krylov solver, it is extremely slow. So is there a better way for me to compute the smallest eigenvalues of this system?<br>
> > > > <br>
> > > > Thanks,<br>
> > > > Varun<br>
> > > <br>
> > <br>
> <br>
<br>
</blockquote></div></div></div>
</blockquote></div>