So. All memory and time issues appeared because of my KSPConvergedTest function, which calls KSPBuildResidual to monitor true residual.KSPBuildResidual incorrectly works with memory.As soon as I've commented the line with KSPBuildResidual, all troubles gone.So now I use default monitor andhave to monitor preconditioned residual. This is inconvenient for me, but I cant figure out, how can I set up using true monitor for all methods without any memory or performance leaks. I'll try to get used t deal with preconditioned norm.<div>
<br></div><div><span class="Apple-style-span" style="font-family: 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Helvetica, Arial, Verdana, sans-serif; font-size: 14px; line-height: 19px; background-color: rgb(255, 255, 255); ">Thank you very much for taking the time to reply to me.</span></div>
<div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 14px; "><br class="Apple-interchange-newline">--<br><span style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; "><div>
<span style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; "><div>Best regards,</div><div>Alexey Ryazanov</div><div>______________________________________</div><div><span style="color: rgb(51, 51, 51); font-family: Arial, Helvetica, sans-serif; "><font size="1">Nuclear Safety Institute of Russian Academy of Sciences</font></span></div>
<div><span style="color: rgb(51, 51, 51); font-family: Arial, Helvetica, sans-serif; "><font size="1"><br></font></span></div></span></div></span></span><div><br><div class="gmail_quote">27 ΑΧΗΥΣΤΑ 2011Η. 17:32 ΠΟΜΨΪΟΧΑΤΕΜΨ αΜΕΛΣΕΚ ςΡΪΑΞΟΧ <span dir="ltr"><<a href="mailto:ram@ibrae.ac.ru">ram@ibrae.ac.ru</a>></span> ΞΑΠΙΣΑΜ:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Oh BOY! It was all fault of my MyKSPConvergedTest.<br><br><div class="gmail_quote">27 ΑΧΗΥΣΤΑ 2011Η. 1:29 ΠΟΜΨΪΟΧΑΤΕΜΨ αΜΕΛΣΕΚ ςΡΪΑΞΟΧ <span dir="ltr"><<a href="mailto:ram@ibrae.ac.ru" target="_blank">ram@ibrae.ac.ru</a>></span> ΞΑΠΙΣΑΜ:<div>
<div></div><div class="h5"><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I have also checked KSPSolve behavior in my other PETSc programs and found the same memory lack<br><br><div class="gmail_quote">
27 ΑΧΗΥΣΤΑ 2011Η. 0:57 ΠΟΜΨΪΟΧΑΤΕΜΨ αΜΕΛΣΕΚ ςΡΪΑΞΟΧ <span dir="ltr"><<a href="mailto:ram@ibrae.ac.ru" target="_blank">ram@ibrae.ac.ru</a>></span> ΞΑΠΙΣΑΜ:<div><div></div><div><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="text-align:left"><br></div><div>Thank you for your response!</div><div><br></div><div>I have the memory leak in both my programs. But I don't create plenty of vectors.</div>
<div><br></div><div>My code looks like:</div>
<div><font color="#666666"><br></font></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><font color="#333333"> ***INIT_ALL***</font></div>
<div><font color="#333333"> PetscLogStageRegister("Iteration :", &StageNum1);</font></div><div><div><div><font color="#333333"> PetscLogStagePush(StageNum1); </font></div>
</div><div><div><font color="#333333"> KSPSolve(dKSP, dvec_origRHS, dvec_Solution);</font></div></div><div><div><font color="#333333"> PetscLogStagePop();</font></div></div>
</div><div><font color="#333333"> ***DESTROY_ALL***</font></div></blockquote><div><br></div><div>And when I comment (or delete) KSPSolve, the log_summary output is:</div><div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px">
<div><font color="#333333">=====================================================</font></div><div><font color="#333333">Memory usage is given in bytes:</font></div><div><font color="#333333"><br>
</font></div><div><font color="#333333">Creations Destructions Memory Descendants' MemObject Type </font></div><div><font color="#333333">Reports information only for process 0.</font></div>
<div style="text-align:left"><font color="#333333"><br></font></div><div style="text-align:left"><font color="#333333">--- Event Stage 0: Main Stage</font></div><div style="text-align:left">
<font color="#333333">1 1 729472 0 Application Order </font></div><div style="text-align:left"><font color="#333333">1 1 225452 0 Distributed array </font></div>
<div style="text-align:left"><font color="#333333">8 8 1533424 0 Vec </font></div><div style="text-align:left"><font color="#333333">3 3 2604 0 Vec Scatter </font></div>
<div style="text-align:left"><font color="#333333">8 8 613852 0 Index Set </font></div><div style="text-align:left"><font color="#333333">1 1 221304 0 IS L to G Mapping </font></div>
<div style="text-align:left"><font color="#333333">3 3 16603440 0 Matrix </font></div><div style="text-align:left"><font color="#333333">1 1 832 0 Krylov Solver </font></div>
<div style="text-align:left"><font color="#333333">1 1 688 0 Preconditioner </font></div><div style="text-align:left"><font color="#333333">1 1 448 0 PetscRandom </font></div>
<div><font color="#333333"><br></font></div><div><font color="#333333">--- Event Stage 1: Iteration :</font></div><div><font color="#333333">=====================================================</font></div>
<div><br></div></blockquote>When I run the code with KSPSolve instruction, it gives me:<br><div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><font color="#333333">=====================================================</font></div>
<div><div><font color="#333333">Memory usage is given in bytes:</font></div></div><div><div><font color="#333333">Creations Destructions Memory Descendants' MemObject Type </font></div>
</div><div><div><font color="#333333">Reports information only for process 0.</font></div></div><div><div><font color="#333333"><br></font></div></div><div style="text-align:left">
<font color="#333333">--- Event Stage 0: Main Stage</font></div><div style="text-align:left"><font color="#333333">1 0 0 0 Application Order </font></div>
<div style="text-align:left"><font color="#333333">1 0 0 0 Distributed array </font></div><div style="text-align:left"><font color="#333333">8 17 4963592 0 Vec </font></div>
<div style="text-align:left"><font color="#333333">3 2 1736 0 Vec Scatter </font></div><div style="text-align:left"><font color="#333333">8 12 1425932 0 Index Set </font></div>
<div style="text-align:left"><font color="#333333">1 0 0 0 IS L to G Mapping </font></div><div style="text-align:left"><font color="#333333">3 5 50158132 0 Matrix </font></div>
<div style="text-align:left"><font color="#333333">1 2 1664 0 Krylov Solver </font></div><div style="text-align:left"><font color="#333333">1 2 1440 0 Preconditioner </font></div>
<div style="text-align:left"><font color="#333333">1 1 448 0 PetscRandom </font></div><div style="text-align:left"><font color="#333333">0 1 544 0 Viewer </font></div>
<div style="text-align:left"><font color="#333333"><br></font></div><div style="text-align:left"><font color="#333333">--- Event Stage 1: Iteration :</font></div><div style="text-align:left">
<font color="#333333">355 173 64692312 0 Vec </font></div><div style="text-align:left"><font color="#333333">1 0 0 0 Vec Scatter </font></div>
<div style="text-align:left"><font color="#333333">6 2 1024 0 Index Set </font></div><div style="text-align:left"><font color="#333333">2 0 0 0 Matrix </font></div>
<div style="text-align:left"><font color="#333333">1 0 0 0 Krylov Solver </font></div><div style="text-align:left"><font color="#333333">1 0 0 0 Preconditioner </font></div>
<div><div style="text-align:left"><font color="#333333">2 1 544 0 Viewer </font></div></div><div><div><font color="#333333">=====================================================</font></div>
</div></blockquote><div><div></div><div><div><br></div><div><br></div><br><div class="gmail_quote">2011/8/25 Jed Brown <span dir="ltr"><<a href="mailto:jedbrown@mcs.anl.gov" target="_blank">jedbrown@mcs.anl.gov</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div class="gmail_quote">On Tue, Aug 23, 2011 at 02:37, αΜΕΛΣΕΚ ςΡΪΑΞΟΧ <span dir="ltr"><<a href="mailto:ram@ibrae.ac.ru" target="_blank">ram@ibrae.ac.ru</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="gmail_quote"><font face="arial, helvetica, sans-serif">When i delete the 4-5-6 part of 2nd, 1-2-3 works great! with exact like 1st results.</font></div>
<div class="gmail_quote"><font face="arial, helvetica, sans-serif">When i delete the 1-2-3 part of 2nd, 4-5-6 works great! with exact like 1st results.</font></div><div class="gmail_quote"><font face="arial, helvetica, sans-serif">All program (1-2-3-4-5-6) works badly.</font></div>
</blockquote></div><br></div><div>From the -log_summary, you have a memory leak (many more vector creations than destructions). Try running with -malloc_dump to debug it. Perhaps you are creating a vector every time one of your functions is called? You should also build --with-debugging=0 when looking at timing results. (You can keep it in PETSC_ARCH=linux-gnu-opt.)</div>
</blockquote></div><br><br clear="all"><div><br></div></div></div><div><div></div><div>-- <br><span style="border-collapse:collapse;font-family:arial, sans-serif;font-size:13px"><div><span style="border-collapse:collapse;font-family:arial, sans-serif;font-size:13px"><div>
Best regards,</div><div>Alexey Ryazanov</div><div>______________________________________</div><div><span style="color:rgb(51, 51, 51);font-family:Arial, Helvetica, sans-serif"><font size="1">Nuclear Safety Institute of Russian Academy of Sciences</font></span></div>
</span></div><div><br></div></span><br>
</div></div></blockquote></div></div></div><div><div></div><div><br><br clear="all"><div><br></div>-- <br><span style="border-collapse:collapse;font-family:arial, sans-serif;font-size:13px"><div><span style="border-collapse:collapse;font-family:arial, sans-serif;font-size:13px"><div>
Best regards,</div><div>Alexey Ryazanov</div><div>______________________________________</div><div><span style="color:rgb(51, 51, 51);font-family:Arial, Helvetica, sans-serif"><font size="1">Nuclear Safety Institute of Russian Academy of Sciences</font></span></div>
</span></div><div><br></div></span><br>
</div></div></blockquote></div></div></div><div><div></div><div class="h5"><br><br clear="all"><div><br></div>-- <br><span style="border-collapse:collapse;font-family:arial, sans-serif;font-size:13px"><div><span style="border-collapse:collapse;font-family:arial, sans-serif;font-size:13px"><div>
Best regards,</div><div>Alexey Ryazanov</div><div>______________________________________</div><div><span style="color:rgb(51, 51, 51);font-family:Arial, Helvetica, sans-serif"><font size="1">Nuclear Safety Institute of Russian Academy of Sciences</font></span></div>
</span></div><div><br></div></span><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><span style="border-collapse:collapse;font-family:arial, sans-serif;font-size:13px"><div><span style="border-collapse:collapse;font-family:arial, sans-serif;font-size:13px"><div>
Best regards,</div><div>Alexey Ryazanov</div><div>______________________________________</div><div><span style="color:rgb(51, 51, 51);font-family:Arial, Helvetica, sans-serif"><font size="1">Nuclear Safety Institute of Russian Academy of Sciences</font></span></div>
</span></div><div><br></div></span><br>
</div></div>