<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Dec 5, 2014 at 2:11 PM, Evan Um <span dir="ltr"><<a href="mailto:evanum@gmail.com" target="_blank">evanum@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Dear PETSC Users,</div><div><br></div><div>I tried to use a Cholesky factor (MUMPS results) as a preconditioner for KSPSolve(). An example code is pasted below. When the code runs, the log file indicates that Job=3 (i.e. backward/forward substitution) of MUMPS is called every time inside the loop. Is there anyway to avoid JOB=3 of MUMPS and use the factor as a pure preconditioner for the CG solver inside KSPSOLVE()? On my cluster, JOB=3 shows unexpected slow performance (see Vol72, Issue 35) and should be avoided. In advance, thanks for </div></div></blockquote><div><br></div><div>What do you mean by the above sentence. When you Cholesky factor a matrix A, you get</div><div><br></div><div>  A = L^T L</div><div><br></div><div>When you use this factorization as a preconditioner, you modify your original problem to</div><div><br></div><div>  (L^T L)^{-1} A x = (L^T L)^{-1} b</div><div><br></div><div>When you use a Krylov method like CG, this means that at every iterate you must apply</div><div>(L^T L){-1} which entails a forward and backward solve.</div><div><br></div><div>If you mean, you only want to apply (L^T L)^{-1} and not run CG, then use -ksp_type preonly</div><div><br></div><div>  Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>your help.</div><div><br></div><div>Regards,</div><div>Evan<br></div><div><br></div><div><br></div><div><div>Code:</div><div>KSPCreate(PETSC_COMM_WORLD, &ksp_fetd_dt);<br>KSPSetOperators(ksp_fetd_dt, A_dt, A_dt);<br>KSPSetType (ksp_fetd_dt, KSPPREONLY);<br>KSPGetPC(ksp_fetd_dt, &pc_fetd_dt);<br>MatSetOption(A_dt, MAT_SPD, PETSC_TRUE);<br>PCSetType(pc_fetd_dt, PCCHOLESKY);<br>PCFactorSetMatSolverPackage(pc_fetd_dt, MATSOLVERMUMPS);<br>PCFactorSetUpMatSolverPackage(pc_fetd_dt);<br>PCFactorGetMatrix(pc_fetd_dt, &F_dt);</div><div>MatMumpsSetIcntl(F_dt, 4, 1); // Turn on MUMPS's log file.<br>KSPSetType(ksp_fetd_dt, KSPCG); <br>KSPSetTolerances(ksp_fetd_dt, 1e-9, 1.0e-50, 1.0e10, ksp_iter);<br></div><div>for (int i=0; i<1000; i++) {<br>// Create a new RHS vector B_dt<br>KSPSolve(ksp_fetd_dt,B_dt,solution); <br>// Output solution time=time2-time1;<br>} </div></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div>
</div></div>