[petsc-users] Input argument out of range with MatZeroRows

Jennifer Ellen Fromm jefromm at eng.ucsd.edu
Fri Apr 15 18:07:06 CDT 2022


Thank you for your reply, with petsc4py the only error message I get is:

Traceback (most recent call last):
  File "../../../exhume-fenics-prototype/demos/exhume_poisson.py", line
228, in <module>
    solveKSP(dR_b,R_b,u_p, method=LINEAR_SOLVER, PC=PRECONDITIONER,
bfr_tol=bfr_tol_set)
  File
"/home/jennifer/Work/exhume/exhume-fenics-prototype/EXHUME/common.py", line
958, in solveKSP
    A,b = trimNodes(A,b=b, bfr_tol=bfr_tol)
  File
"/home/jennifer/Work/exhume/exhume-fenics-prototype/EXHUME/common.py", line
314, in trimNodes
    A.zeroRows(nz_id)
  File "PETSc/Mat.pyx", line 993, in petsc4py.PETSc.Mat.zeroRows
petsc4py.PETSc.Error: error code 63

When I print out the matrix size and the row IDs I want to zero (for each
processor), I get
((36, 72), (36, 72))
[36, 37, 43, 45, 62, 64, 70, 71]
((36, 72), (36, 72))
[0, 1, 2, 8, 9, 11, 24, 26, 27, 33, 34, 35]

Is there a way I can get petsc4py to pass me the entire PETSC error message?

On Fri, Apr 15, 2022 at 3:42 PM Barry Smith <bsmith at petsc.dev> wrote:

>
>   Yes, this sounds like the intended usage. The only expected reason this
> would error is if one of the indices is less than 0 or greater than or
> equal to the number of rows in the entire matrix. In the error message, it
> should print both the index and the number of rows in the matrix. Can you
> send the full error message, cut and paste?
>
>   Barry
>
>
> > On Apr 15, 2022, at 5:09 PM, Jennifer Ellen Fromm <jefromm at eng.ucsd.edu>
> wrote:
> >
> > Hello,
> > I am using petsc4py, and attempting to zero rows of an mpiaij matrix
> (and set the diagonal to 1). I loop over the owned row indices to identify
> the rows I want to zero, then attempt to call zeroRows() with the list of
> owned indices. When I run in parallel (mpirun --np 2) I get petsc4py error
> 63, 'input argument out of range'. I have tried to adjust several matrix
> options but nothing has worked. Is this a valid method for trying to zero
> rows?
> > Thanks,
> > Jennifer
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20220415/8ff1b59f/attachment.html>


More information about the petsc-users mailing list