[petsc-users] Argument out of range error only in certain mpi sizes

Matthew Knepley knepley at gmail.com
Wed Apr 10 13:05:45 CDT 2019

On Wed, Apr 10, 2019 at 2:00 PM Sajid Ali via petsc-users <
petsc-users at mcs.anl.gov> wrote:

> Hi PETSc developers,
> 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.
> 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".
> 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.
> 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.).

You are assuming a lexicographic ordering of unknowns, but we do not do
that in parallel. There is a manual chapter
about the difference between PETSc and Natural numbering in DMDA.



> Thanks in advance for the help.
> --
> Sajid Ali
> Applied Physics
> Northwestern University

What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener

https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20190410/b636a92d/attachment.html>

More information about the petsc-users mailing list