On Fri, Jan 6, 2017 at 4:31 PM, Łukasz Kasza <[email protected]> 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! Always returning a correct value > though. I am using 4.5.3 version, 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? >
2 should be MUCH slower than 1. Version 4.5.3 of what? I cannot understand what would make this happen. Can you send the output of -log_view for two different run lengths? Matt > Best regards. > -- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener
