<div dir="ltr">Barry,<br>I have let PETSc decide the local sizes I have only specified the global values, I will also check with the debugger and tell you the status. <br><br>And just another query,is it a problem if I have already used <b>MatSetUp(A); </b>once and after that assembled the matrix and after that applying Preallocation. I guess that should not be a problem as the code ran fine with the one processor case. Just confirming though.<br><br>Many thanks.<br><br>----<br>John Albequerque.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Feb 20, 2016 at 2:53 AM, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Are you sure you have divided up the matrix so each process gets some of the rows?<br>
<br>
You are just going to have to break down and run with -start_in_debugger to see exactly why it is crashing.<br>
<span class="HOEnZb"><font color="#888888"><br>
Barry<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
> On Feb 19, 2016, at 3:16 PM, John Albequerque <<a href="mailto:johncfdcfd@gmail.com">johncfdcfd@gmail.com</a>> wrote:<br>
><br>
> Barry,<br>
> I forgot to mention that the code is working fine with a single processor, but when I increase the number of processors, as in this case 3 processors have been used when the error message was generated. And yes, it has something to do with the off-diagonal terms as I am increasing the number of processes, the same error triggers for each row for which o_nnz[i] is not zero.<br>
><br>
><br>
> Many thanks.<br>
><br>
> ----<br>
> John Albequerque.<br>
><br>
> On Sat, Feb 20, 2016 at 2:38 AM, Barry Smith <<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>> wrote:<br>
><br>
> You are setting nonzero preallocations for the "off diagonal" portion of the matrix, but one one process there is no off diagonal portion so you should be setting those values to all zero.<br>
><br>
> Barry<br>
><br>
> > On Feb 19, 2016, at 2:29 PM, John Albequerque <<a href="mailto:johncfdcfd@gmail.com">johncfdcfd@gmail.com</a>> wrote:<br>
> ><br>
> ><br>
> > Dear Barry,<br>
> > I am sorry I could not get you. I have also posted the entire error message so that you could get a deeper insight into it.<br>
> ><br>
> ><br>
> > Many thanks.<br>
> ><br>
> > ----<br>
> > John Albequerque.<br>
> > ========================================================================================<br>
> > Argument out of range<br>
> > [0]PETSC ERROR: nnz cannot be greater than row length: local row 0 value 1 rowlength 0<br>
> > [0]PETSC ERROR: See <a href="http://www.mcs.anl.gov/petsc/documentation/faq.html" rel="noreferrer" target="_blank">http://www.mcs.anl.gov/petsc/documentation/faq.html</a> for trouble shooting.<br>
> > [0]PETSC ERROR: Petsc Release Version 3.6.3, unknown<br>
> > [0]PETSC ERROR: ./MatSparse on a linux-gnu-c-debug named John by johncfd Sat Feb 20 01:36:01 2016<br>
> > [0]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++ --with-fc=gfortran --download-fblaslapack --download-mpich<br>
> > [0]PETSC ERROR: #1 MatSeqAIJSetPreallocation_SeqAIJ() line 3567 in /home//MyStuff/ClonedRepos/petsc/src/mat/impls/aij/seq/aij.c<br>
> > [0]PETSC ERROR: #2 MatSeqAIJSetPreallocation() line 3539 in /home/MyStuff/ClonedRepos/petsc/src/mat/impls/aij/seq/aij.c<br>
> > [0]PETSC ERROR: #3 MatMPIAIJSetPreallocation_MPIAIJ() line 2835 in /home/MyStuff/ClonedRepos/petsc/src/mat/impls/aij/mpi/mpiaij.c<br>
> > [0]PETSC ERROR: #4 MatMPIAIJSetPreallocation() line 3532 in /home/MyStuff/ClonedRepos/petsc/src/mat/impls/aij/mpi/mpiaij.c<br>
> > =========================================================================================<br>
> ><br>
> ><br>
> > On Sat, Feb 20, 2016 at 12:35 AM, Barry Smith <<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>> wrote:<br>
> ><br>
> > > On Feb 19, 2016, at 12:54 PM, John Albequerque <<a href="mailto:johncfdcfd@gmail.com">johncfdcfd@gmail.com</a>> wrote:<br>
> > ><br>
> > > Jed, one more<br>
> > ><br>
> > > nnz cannot be greater than row length: local row 0 value 1 rowlength 0<br>
> ><br>
> > Always send the entire error message, this provides the context to know what the hey is going on.<br>
> ><br>
> > 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).<br>
> ><br>
> > Barry<br>
> ><br>
> > ><br>
> > > How do I deal with this error?<br>
> > ><br>
> > > Thanks.<br>
> > ><br>
> > > ----<br>
> > > John Albequerque.<br>
> > ><br>
> > ><br>
> > ><br>
> > > On Fri, Feb 19, 2016 at 8:17 PM, John Albequerque <<a href="mailto:johncfdcfd@gmail.com">johncfdcfd@gmail.com</a>> wrote:<br>
> > > Thank you very much, I will try it.<br>
> > ><br>
> > ><br>
> > > Thanks<br>
> > ><br>
> > > ----<br>
> > > John Albequerque.<br>
> > ><br>
> > ><br>
> > ><br>
> > > On Fri, Feb 19, 2016 at 8:16 PM, Jed Brown <<a href="mailto:jed@jedbrown.org">jed@jedbrown.org</a>> wrote:<br>
> > > John Albequerque <<a href="mailto:johncfdcfd@gmail.com">johncfdcfd@gmail.com</a>> writes:<br>
> > ><br>
> > > > So Jed, what you are suggesting is that I should set only the non-zero<br>
> > > > elements while using<br>
> > > > * MatSetValues(A,(high-low),**idxm,nc,idxn,values,INSERT_*<br>
> > > ><br>
> > > > *VALUES);*<br>
> > > > And not mention the zero elements and for that I should loop over all local<br>
> > > > rows and then set each of the value.<br>
> > ><br>
> > > Yes. The whole point of a sparse matrix is to spend no time or storage<br>
> > > on 0.0 entries. If you allocate a dense matrix and store all the zeros,<br>
> > > you're just being inefficient relative to a dense format.<br>
> > ><br>
> > ><br>
> ><br>
> ><br>
><br>
><br>
<br>
</div></div></blockquote></div><br></div>