[petsc-dev] preallocation checks

Barry Smith bsmith at mcs.anl.gov
Sat Jan 28 13:27:21 CST 2012


On Jan 28, 2012, at 1:15 PM, Jed Brown wrote:

> On Sat, Jan 28, 2012 at 13:11, Barry Smith <bsmith at mcs.anl.gov> wrote:
> MatPreallocated() or MatSetUpPreallocation()
> 
> Why are these functions different? The body of MatSetUpPreallocation() checks the same conditional, so I don't think we need both.

  Jed,

   Since MatSetUpPreallocated() was called inside MatSetValues() the macro MatPreallocated() was added to prevent unneeded functions calls in the inner kernel MatSetValues().

   With modern PETSc we can get rid of MatPreallocated() everywhere and use MatSetUpPreallocation() directly everywhere then 

1)  say we don't think that function call overhead matters where it is called now or
2) turn it into a static inline function.

   You decide,

   Barry






More information about the petsc-dev mailing list