[petsc-dev] preallocation checks

Jed Brown jedbrown at mcs.anl.gov
Sat Jan 28 13:36:56 CST 2012


On Sat, Jan 28, 2012 at 13:27, Barry Smith <bsmith at mcs.anl.gov> wrote:

>   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
>

This, but we have to remove it from the other functions that also should
not be collective: MatGetRow, MatGetRowUpperTriangular, etc are obvious.
What about MatGetOwnershipRange()? If the user had

MatGetSizes(A,&m,NULL);
if (m) {
  MatGetOwnershipRange(A,&rstart,&rend);
  for (i=rstart; i<rend; i++) { ... }
}

this could deadlock if there are any empty procs. And MatGetBlockSize().


> 2) turn it into a static inline function.
>

It can only be called from functions that are already collective.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20120128/be717db7/attachment.html>


More information about the petsc-dev mailing list