[petsc-users] Doubt in MPIPreallocation

Barry Smith bsmith at mcs.anl.gov
Fri Feb 19 13:05:02 CST 2016


> On Feb 19, 2016, at 12:54 PM, John Albequerque <johncfdcfd at gmail.com> wrote:
> 
> Jed, one more 
> 
> nnz cannot be greater than row length: local row 0 value 1 rowlength 0 

  Always send the entire error message, this provides the context to know what the hey is going on.

  It looks like you set a matrix block (if you are using an MPI matrix on one process this could the the "off-diagonal" block)  which has no columns (hence row length is zero) but you claim you need to preallocate an entry (the 1).

  Barry

> 
> How do I deal with this error?
> 
> Thanks.
> 
> ----
> John Albequerque.
> 
> 
> 
> On Fri, Feb 19, 2016 at 8:17 PM, John Albequerque <johncfdcfd at gmail.com> wrote:
> Thank you very much, I will try it.
> 
> 
> Thanks
> 
> ----
> John Albequerque.
> 
> 
> 
> On Fri, Feb 19, 2016 at 8:16 PM, Jed Brown <jed at jedbrown.org> wrote:
> John Albequerque <johncfdcfd at gmail.com> writes:
> 
> > So Jed, what you are suggesting is that I should set only the non-zero
> > elements while using
> > *  MatSetValues(A,(high-low),**idxm,nc,idxn,values,INSERT_*
> >
> > *VALUES);*
> > And not mention the zero elements and for that I should loop over all local
> > rows and then set each of the value.
> 
> Yes.  The whole point of a sparse matrix is to spend no time or storage
> on 0.0 entries.  If you allocate a dense matrix and store all the zeros,
> you're just being inefficient relative to a dense format.
> 
> 



More information about the petsc-users mailing list