<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On 6 January 2017 at 22:31, Łukasz Kasza <span dir="ltr"><<a href="mailto:rpgwars@wp.pl" target="_blank">rpgwars@wp.pl</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
Dear PETSc Users,<br>
<br>
        Please consider the following 2 snippets which do exactly the same (calculate a sum of two vectors):<br>
        1.<br>
        VecAXPY(amg_level_x[level],1.0<wbr>,amg_level_residuals[level]);<br>
<br>
        2.<br>
        VecGetArray(amg_level_residual<wbr>s[level], &values);<br>
        VecSetValues(amg_level_x[level<wbr>],size,indices,values,ADD_<wbr>VALUES);<br>
        VecRestoreArray(amg_level_resi<wbr>duals[level], &values);<br>
        VecAssemblyBegin(amg_level_x[l<wbr>evel]);<br>
        VecAssemblyEnd(amg_level_x[lev<wbr>el]);<br>
<br>
In my program I have both of the snippets executed in a loop. The problem with the first one is that the longer the program goes the longer it takes to execute it. At the same time the execution time of the second snippet is more or less constant. I don't know why but after a few hundreds of iterations VecAXPY takes more than MatMult on the matrix and vector of the same size and after that it still grows! </blockquote><div><br></div><div>How did you profile this?<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Always returning a correct value though. I am using 4.5.3 version, </blockquote><div><br></div><div>Which version of PETSc are you using?? Current release is 3.7.5<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">the vectors are<br>
sequential. VecAXPY in such case is just a wrapper for blas, do you have any idea why the execution time of this function constantly grows?<br></blockquote><div><br></div><div>Maybe your code is leaking memory and ultimately your OS starts swapping?<br></div><div><br></div><div>Please send the code.<br><br></div><div>Thanks,<br></div><div>  Dave<br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Best regards.<br>
<br>
<br>
</blockquote></div><br></div></div>