[petsc-users] Any overheads of VecGetArray/VecRestoreArray?

Barry Smith bsmith at mcs.anl.gov
Tue Mar 26 12:32:00 CDT 2013


   Dominik,

     There is no copy of vector entries on the calls to VecGetArray/RestoreArray() so the overhead is minimal. Likely you would barely be able to measure a difference.

    Barry

On Mar 26, 2013, at 9:45 AM, Dominik Szczerba <dominik at itis.ethz.ch> wrote:

> Hi,
> 
> Let's say I have a simple function where I assemble a global
> coefficient matrix by subsequent calls to another function that
> computes element coefficient matrix. I need some cell physical
> property like density that changes between grid cells, and which is
> stored as a Petsc Vec object. Now should I better call
> VecGetArray/VecRestoreArray only once in at the beginning/end of the
> function that assembles the global matrix or is it OK to call it each
> time in the function computing the element matrix? In other words, are
> there any overheads to better be avioded here?
> 
> Thanks for any hints,
> Dominik



More information about the petsc-users mailing list