[petsc-dev] error on preallocation business
Jed Brown
jedbrown at mcs.anl.gov
Sat Jan 21 14:32:58 CST 2012
On Sat, Jan 21, 2012 at 11:50, Barry Smith <bsmith at mcs.anl.gov> wrote:
>
> Jed,
>
> It appears you changed all the MatXXXSetPreallocation() routines to
> set call ierr =
> MatSetOption(B,MAT_NEW_NONZERO_ALLOCATION_ERR,PETSC_TRUE);CHKERRQ(ierr);
> thus generating an error if preallocation is wrong.
>
> The problem is that MatXXXSetPreallocation() is ALWAYS called (with
> default values if the user did not call it explicitly) by MatPreallocated()
> which calls MatPreallocationSetUp(). Hence you are ALWAYS setting error on
> new allocation.
>
> My intention was that an error would only be generated if the user
> explicitly called MatXXXSetPreallocation() so
>
> 1) Was my intention wrong and should we always default to erroring on
> wrong preallocation even if the user did not preallocate or (if so we
> need lots of fixes because much code is broken in nightly tests)
>
No, I think your idea was correct.
>
> 2) is there anyway to change it so it only errors out when the user did
> explicitly preallocate?
>
This patch is not pretty, but it seems to do the job.
http://petsc.cs.iit.edu/petsc/petsc-dev/rev/e675ef955f92
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20120121/46fa82e9/attachment.html>
More information about the petsc-dev
mailing list