<div dir="ltr"><div dir="ltr">On Wed, Apr 10, 2019 at 2:00 PM Sajid Ali via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><div>Hi PETSc developers, <br><br></div>I wanted to convert my code that in which I was using general Vec/Mat to DMDA based grid management (nothing fancy just a 5-point complex stencil). For this, I created a DA object and created the global solution vector using this. This worked fine. <br><br></div>Now, I created the matrix using DMCreateMatrix and fill it using the regular function. I get no error when I run the problem using mpirun -np 1 and I thought my matrix filling logic aligns with the DM non-zero locations (Star Stencil, width 1). With mpirun -np 2, no errors either. But with mpirun -np 4 or 8, I get errors which say : "Argument out of range/ Inserting a new nonzero at global row/column ... into matrix". <br><br></div><div>I would switch over the logic provided in KSP/ex46.c for filling the Matrix via the MatSetStencil logic but I wanted to know what I was doing wrong in my current code since I've never seen an error that depends on number of mpi processes.<br><br></div><div>I'm attaching the code ( which works if the matrix is created without using the DA, i.e. comment out line 159, uncomment 161/162 and I'm doing this on a small grid to catch errors.). </div></div></div></blockquote><div><br></div><div>You are assuming a lexicographic ordering of unknowns, but we do not do that in parallel. There is a manual chapter</div><div>about the difference between PETSc and Natural numbering in DMDA.</div><div><br></div><div>  Thanks,</div><div><br></div><div>    Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><div><div><div>Thanks in advance for the help. <br><br><br></div><div>-- <br><div dir="ltr" class="gmail-m_1259765743640358046gmail_signature"><div dir="ltr"><div style="font-size:12.8px">Sajid Ali<br></div><div style="font-size:12.8px">Applied Physics<br></div><div style="font-size:12.8px">Northwestern University</div></div></div></div></div></div></div></div></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>