<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Il giorno mar 6 giu 2023 alle ore 09:24 Pichler, Franz <<a href="mailto:franz.pichler@v2c2.at">franz.pichler@v2c2.at</a>> ha scritto:<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 class="msg5282957388883735254">
<div lang="EN-US" style="overflow-wrap: break-word;">
<div class="m_4814553848995281534WordSection1">
<p class="MsoNormal">Hello,<u></u><u></u></p>
<p class="MsoNormal">I was just investigating my KSP_Solve_BCGS Routine with algrandcallgrind,<u></u><u></u></p>
<p class="MsoNormal">I see there that petsc is using a vecduplicate (onvolvin malloc and copy) every time it is called.</p></div></div></div></blockquote><div><br></div><div>Do you mean <span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0);font-family:Menlo;font-size:21px">KSPSolve_BCGS?</span></div>
<div> </div><div>There's only one VecDuplicate in there and it is called only once. An example code showing the problem would help</div><div><br></div><div><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 class="msg5282957388883735254"><div lang="EN-US" style="overflow-wrap: break-word;"><div class="m_4814553848995281534WordSection1"><p class="MsoNormal"><u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I call it several thousand times (time evolution problem with rather small matrices)<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I am not quite sure which vector is copied there but I guess is the initial guess or the rhs,<u></u><u></u></p>
<p class="MsoNormal">Is there a tool in petsc to avoid any vecduplication by providing a fixed memory for this vector?<br>
<br>
Some corner facts of my routine:<u></u><u></u></p>
<p class="MsoNormal">I assemble the matrices(crs,serial) and vectors myself and then use<u></u><u></u></p>
<p class="MsoNormal">MatCreateSeqAIJWithArrays and VecCreateSeqWithArray<u></u><u></u></p>
<p class="MsoNormal">To wrap petsc around it,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I use a ILU preconditioner and the sparsity patterns between the calls to not change, the values do,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Thank you for any hint how to avoid the vecduplicate,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Best regards<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Franz<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><span style="font-size:12pt;color:black"><u></u> <u></u></span></p>
<p class="MsoNormal"><b><span style="font-size:10pt;font-family:Arial,sans-serif;color:black">Dr. Franz Pichler</span></b><span style="font-size:10pt;font-family:Tahoma,sans-serif;color:black"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:8pt;font-family:Arial,sans-serif;color:black">Lead Researcher Area E</span><span style="font-size:10pt;font-family:Tahoma,sans-serif;color:black"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Tahoma,sans-serif;color:black"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:10pt;color:black"> </span><span style="font-size:12pt;font-family:"Times New Roman",serif;color:black"><u></u><u></u></span></p>
<p class="MsoNormal"><b><span style="font-size:10pt;color:black">Virtual Vehicle Research GmbH</span></b><span style="font-size:12pt;font-family:"Times New Roman",serif;color:black"><u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:3pt"><b><span style="font-size:10pt;color:black"> </span></b><span style="font-size:12pt;font-family:"Times New Roman",serif;color:black"><u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:2pt;line-height:115%">
<span lang="IT" style="font-size:10pt;line-height:115%;color:black">Inffeldgasse 21a, 8010 Graz, Austria</span><span style="font-size:12pt;line-height:115%;font-family:"Times New Roman",serif;color:black"><u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:115%"><span lang="FR" style="font-size:10pt;line-height:115%;color:black">Phone: +43 316 873 9818
</span><span style="font-size:12pt;line-height:115%;font-family:"Times New Roman",serif;color:black"><u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:2pt"><span lang="FR" style="font-size:10pt;color:black"><a href="mailto:franz.pichler@v2c2.at" target="_blank"><span style="color:blue">franz.pichler@v2c2.at</span></a></span><span style="font-size:10pt;font-family:"Courier New";color:black"><u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:115%"><span lang="DE-AT" style="font-size:12pt;line-height:115%;font-family:"Times New Roman",serif;color:black"><a href="http://www.v2c2.at" target="_blank"><span lang="FR" style="font-size:10pt;line-height:115%;font-family:Calibri,sans-serif;color:blue">www.v2c2.at</span></a></span><span style="font-size:12pt;line-height:115%;font-family:"Times New Roman",serif;color:black"><u></u><u></u></span></p>
<p class="MsoNormal"><span lang="FR" style="color:black"> </span><span style="font-size:12pt;font-family:"Times New Roman",serif;color:black"><u></u><u></u></span></p>
<p class="MsoNormal"><span lang="DE" style="font-size:8pt;font-family:Arial,sans-serif;color:black">Firmenname: Virtual Vehicle Research GmbH </span><span lang="DE" style="font-size:12pt;font-family:"Times New Roman",serif;color:black"><u></u><u></u></span></p>
<p class="MsoNormal"><span lang="DE" style="font-size:8pt;font-family:Arial,sans-serif;color:black">Rechtsform: Gesellschaft mit beschränkter Haftung </span><span lang="DE" style="font-size:12pt;font-family:"Times New Roman",serif;color:black"><u></u><u></u></span></p>
<p class="MsoNormal"><span lang="DE" style="font-size:8pt;font-family:Arial,sans-serif;color:black">Firmensitz: Austria, 8010 Graz, Inffeldgasse 21/A </span><span lang="DE" style="font-size:12pt;font-family:"Times New Roman",serif;color:black"><u></u><u></u></span></p>
<p class="MsoNormal"><span lang="DE" style="font-size:8pt;font-family:Arial,sans-serif;color:black">Firmenbuchnummer: 224755y </span><span lang="DE" style="font-size:12pt;font-family:"Times New Roman",serif;color:black"><u></u><u></u></span></p>
<p class="MsoNormal"><span lang="DE" style="font-size:8pt;font-family:Arial,sans-serif;color:black">Firmenbuchgericht: Landesgericht für ZRS Graz </span><span lang="DE" style="font-size:12pt;font-family:"Times New Roman",serif;color:black"><u></u><u></u></span></p>
<p class="MsoNormal"><span lang="DE" style="font-size:8pt;font-family:Arial,sans-serif;color:black">UID: ATU54713500 </span><span lang="DE" style="font-size:12pt;font-family:"Times New Roman",serif;color:black"><u></u><u></u></span></p>
<p class="MsoNormal"><span lang="DE" style="font-size:8pt;font-family:Arial,sans-serif;color:black"> </span><span lang="DE" style="font-size:12pt;font-family:"Times New Roman",serif;color:black"><u></u><u></u></span></p>
<p class="MsoNormal"><span lang="DE"><u></u> <u></u></span></p>
</div>
</div>
</div></blockquote></div><br clear="all"><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature">Stefano</div></div>