<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Nov 8, 2016 at 2:19 AM, Ji Zhang <span dir="ltr"><<a href="mailto:gotofd@gmail.com" target="_blank">gotofd@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">Dear all, <div><br></div><div>I'm a petsc and petsc4py user. Obviously, the package is outstanding and elegant for those projects involving large matrix calculation. One small defect, I think, is that petsc4py.PETSc.Object.destroy(<wbr>) method do not work in parallel mode. The memory cannot be released. </div><div><br></div><div>For example, if I create a Mat obj named mat1, do some stuffs, and then use mat1.destroy(), the memory useage of the code decreased without mpirun, what is not change with mpirun.</div></div></blockquote><div><br></div><div>This is about how the operating system is dealing with memory. PETSc calls free(), but that does not mean that the OS</div><div>decreases the memory unfortunately. However, it should normally be reclaimed if you try and reallocate.</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> More, let mat2=mat1, after do mat1.destroy(), mat2 is unacceptable whether memory is released or not. </div></div></blockquote><div><br></div><div>Here you are making a shallow copy, meaning only the pointer to the object. Thus when mat1 is destroyed, so is mat2.</div><div>If you want a real copy, you need to use MatDuplicate().</div><div><br></div><div> Thanks,</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>Is there any one can check if I made some mistakes? Thanks. </div><div><br clear="all"><div><div class="m_8931572179032363467gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><font size="2" face="System"><span><span>此致<br> 敬礼<br>张骥(</span></span></font><font size="2" face="System"><span><span><font face="System"><span><span>博士研究生)</span></span></font><br>北京计算科学研究中心
<br><span style="background-color:rgba(0,0,0,0)">北京市海淀区西北旺东路10号院东区9号楼 </span>(100193)<br><br></span></span></font><div><font size="2" face="System">Best, </font></div><div><font size="2" face="System">Regards, </font></div><div><font size="2" face="System"><span style="background-color:rgba(0,0,0,0);color:rgb(80,0,80)">Zhang Ji, PhD student</span><br></font></div><div><font size="2" face="System"><span style="color:rgb(80,0,80);background-color:rgba(0,0,0,0)">Beijing Computational Science Research Center <br>Zhongguancun Software Park II, No. 10 Dongbeiwang West Road, Haidian District, Beijing 100193, China <br></span></font></div><font size="2"></font></div></div></div>
</div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="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>