<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">Ajit :<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div style="font-family:arial,helvetica,sans-serif">I am trying to use PETSc-MUMPS solver to solve linear problem of type "A x = b " </div><div style="font-family:arial,helvetica,sans-serif">I have wrote a subroutine in Fortran 90 for uni-processor. given below.</div><div style="font-family:arial,helvetica,sans-serif">I am calling this subroutine inside iterative solver. </div></div></blockquote><div>Code looks fine. </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div style="font-family:arial,helvetica,sans-serif"><br></div><div style="font-family:arial,helvetica,sans-serif">This solver is very fast for first few iterations but then becomes slow </div></div></blockquote><div>Run your code with runtime option '-log_summary', which displays which routine dominates computation.</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 style="font-family:arial,helvetica,sans-serif">and if matrix is of large-scale, it becomes very-very slow.</div></div></blockquote><div>Direct solvers are not scalable in general. Matrix factors might become very dense. You may experiment different matrix orderings. Again, run with '-log_summary'.</div><div><br></div><div>Hong </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div style="font-family:arial,helvetica,sans-serif"><br></div><div style="font-family:arial,helvetica,sans-serif">If somebody can help me to understand, if I am doing something wrong here?</div><div style="font-family:arial,helvetica,sans-serif"><br></div><div style="font-family:arial,helvetica,sans-serif">Thanks you. </div><div style="font-family:arial,helvetica,sans-serif"><br></div><div style="font-family:arial,helvetica,sans-serif"><div><p style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo;color:rgb(207,135,36)">!!!*************************************************</p>
<p style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo;color:rgb(207,135,36)">!!! Subroutine</p>
<p style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo"><span style="color:rgb(53,86,138)">SUBROUTINE</span> PETScMUMPS(ksp,pc,A,x,b,ierr)</p>
<p style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo;min-height:16px"><br></p>
<p style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo">#<span style="color:rgb(53,86,138)">include</span> <petsc/finclude/petscsys.h></p>
<p style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo">#<span style="color:rgb(53,86,138)">include</span> <petsc/finclude/petscvec.h></p>
<p style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo">#<span style="color:rgb(53,86,138)">include</span> <petsc/finclude/petscmat.h></p>
<p style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo">#<span style="color:rgb(53,86,138)">include</span> <petsc/finclude/petscksp.h></p>
<p style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo">#<span style="color:rgb(53,86,138)">include</span> <petsc/finclude/petscpc.h></p>
<p style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo;min-height:16px"><br></p>
<p style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo">Vec x,b</p>
<p style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo">Mat A</p>
<p style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo">KSP ksp</p>
<p style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo">PC pc</p>
<p style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo;min-height:16px"><br></p>
<p style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo">Mat F</p>
<p style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo">PetscInt ival,icntl</p>
<p style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo;min-height:16px"><br></p>
<p style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo">PetscErrorCode ierr</p>
<p style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo;min-height:16px"><br></p>
<p style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo"> <span style="color:rgb(53,86,138)">call</span> KSPCreate(PETSC_COMM_SELF,ksp,ierr)</p>
<p style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo"> <span style="color:rgb(53,86,138)">call</span> KSPSetOperators(ksp,A,A,ierr)</p>
<p style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo"> <span style="color:rgb(53,86,138)">call</span> KSPSetType(ksp,KSPPREONLY,ierr)</p>
<p style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo"> <span style="color:rgb(53,86,138)">call</span> KSPGetPC(ksp,pc,ierr)</p>
<p style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo;min-height:16px"><br></p>
<p style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo;color:rgb(207,135,36)"><span style="color:rgb(0,0,0)"> </span>!call PCSetType(pc,PCLU,ierr) !! LU Factorization</p>
<p style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo"> <span style="color:rgb(53,86,138)">call</span> PCSetType(pc,PCCHOLESKY,ierr) <span style="color:rgb(207,135,36)">!! Cholesky Factorization</span></p>
<p style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo;min-height:16px"><br></p>
<p style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo"> <span style="color:rgb(53,86,138)">call</span> PCFactorSetMatSolverPackage(pc,MATSOLVERMUMPS,ierr)</p>
<p style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo"> <span style="color:rgb(53,86,138)">call</span> PCFactorSetUpMatSolverPackage(pc,ierr)</p>
<p style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo"> <span style="color:rgb(53,86,138)">call</span> PCFactorGetMatrix(pc,F,ierr)</p>
<p style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo;min-height:16px"><br></p>
<p style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo;color:rgb(207,135,36)"><span style="color:rgb(0,0,0)"> </span>!! sequential ordering</p>
<p style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo"> icntl = <span style="color:rgb(53,86,138)">7</span></p>
<p style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo"> ival = <span style="color:rgb(53,86,138)">2</span></p>
<p style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo"> <span style="color:rgb(53,86,138)">call</span> MatMumpsSetIcntl(F,icntl,ival,ierr)</p>
<p style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo;min-height:16px"><br></p>
<p style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo"> <span style="color:rgb(53,86,138)">call</span> KSPSetFromOptions(ksp,ierr)</p>
<p style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo"> <span style="color:rgb(53,86,138)">call</span> KSPGetPC(ksp,pc,ierr)</p>
<p style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo;min-height:16px"><br></p>
<p style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo"> <span style="color:rgb(53,86,138)">call</span> KSPSolve(ksp,x,b,ierr)</p>
<p style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo;min-height:16px"><br></p>
<p style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo;color:rgb(53,86,138)">END<span style="color:rgb(0,0,0)"> </span>SUBROUTINE<span style="color:rgb(0,0,0)"> PETScMUMPS</span></p>
<p style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo;color:rgb(207,135,36)">!!!*************************************************</p><span class="HOEnZb"><font color="#888888"><div><br></div><div><br></div></font></span></div></div><span class="HOEnZb"><font color="#888888"><div><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div><b><font face="verdana, sans-serif">Ajit Desai</font><br></b></div></div><div><b><font face="verdana, sans-serif" size="1">--</font></b></div><div><font face="georgia, serif"><b> PhD Scholar, Carleton University </b></font></div><div><font face="georgia, serif"><b> Ottawa, Canada</b></font></div><div><font face="georgia, serif"><b></b></font></div><span style="font-family:verdana,sans-serif"><span style="font-family:'times new roman',serif"></span></span></div></div></div></div></div></div></div></div></div></div></div>
</font></span></div>
</blockquote></div><br></div></div>