On 6 January 2017 at 22:31, Łukasz Kasza <rpgw...@wp.pl> wrote:

>
>
> Dear PETSc Users,
>
>         Please consider the following 2 snippets which do exactly the same
> (calculate a sum of two vectors):
>         1.
>         VecAXPY(amg_level_x[level],1.0,amg_level_residuals[level]);
>
>         2.
>         VecGetArray(amg_level_residuals[level], &values);
>         VecSetValues(amg_level_x[level],size,indices,values,ADD_VALUES);
>         VecRestoreArray(amg_level_residuals[level], &values);
>         VecAssemblyBegin(amg_level_x[level]);
>         VecAssemblyEnd(amg_level_x[level]);
>
> 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!


How did you profile this?


> Always returning a correct value though. I am using 4.5.3 version,


Which version of PETSc are you using?? Current release is 3.7.5


> the vectors are
> 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?
>

Maybe your code is leaking memory and ultimately your OS starts swapping?

Please send the code.

Thanks,
  Dave



>
> Best regards.
>
>
>

Reply via email to