On Jan 28, 2012, at 1:36 PM, Jed Brown wrote:
> 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.
Yup.
> 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.
Make it simple. Always require calling MatXXXSetPreallocation() or
MatSetUpPreallocation(). All these issues go out the window and user confusion
about when it is needed goes out the window.
Barry