[petsc-users] Question about MatGetRowMax

Sajid Ali sajidsyed2021 at u.northwestern.edu
Tue Sep 8 13:20:47 CDT 2020


Hi PETSc-developers,

While trying to use MatGetRowMax, I’m getting the following error :

[0]PETSC ERROR:
------------------------------------------------------------------------
[0]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation,
probably memory access out of range
[0]PETSC ERROR: Try option -start_in_debugger or -on_error_attach_debugger
[0]PETSC ERROR: or see
https://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind
[0]PETSC ERROR: or try http://valgrind.org on GNU/linux and Apple Mac
OS X to find memory corruption errors
[0]PETSC ERROR: likely location of problem given in stack below
[0]PETSC ERROR: ---------------------  Stack Frames
------------------------------------
[0]PETSC ERROR: Note: The EXACT line numbers in the stack are not available,
[0]PETSC ERROR:       INSTEAD the line number of the start of the function
[0]PETSC ERROR:       is given.
[0]PETSC ERROR: [0] MatGetRowMax_SeqAIJ line 3182
/home/sajid/packages/petsc/src/mat/impls/aij/seq/aij.c
[0]PETSC ERROR: [0] MatGetRowMax line 4798
/home/sajid/packages/petsc/src/mat/interface/matrix.c
[0]PETSC ERROR: [0] MatGetRowMax_MPIAIJ line 2432
/home/sajid/packages/petsc/src/mat/impls/aij/mpi/mpiaij.c
[0]PETSC ERROR: [0] MatGetRowMax line 4798
/home/sajid/packages/petsc/src/mat/interface/matrix.c
[0]PETSC ERROR: [0] construct_matrix line 25
/home/sajid/Documents/intern/pirt/src/matrix.cxx
[0]PETSC ERROR: --------------------- Error Message
--------------------------------------------------------------
[0]PETSC ERROR: Signal received
[0]PETSC ERROR: See
https://www.mcs.anl.gov/petsc/documentation/faq.html for trouble
shooting.
[0]PETSC ERROR: Petsc Development GIT revision:
v3.13.5-2756-g0264f47704  GIT Date: 2020-09-06 15:08:48 -0500
[0]PETSC ERROR: /home/sajid/Documents/intern/pirt/src/pirt on a
arch-linux-c-debug named xrm-backup by sajid Tue Sep  8 13:56:53 2020
[0]PETSC ERROR: Configure options --with-hdf5=1 --with-debugging=yes
[0]PETSC ERROR: #1 User provided function() line 0 in  unknown file
application called MPI_Abort(MPI_COMM_WORLD, 50161059) - process 0

Could someone point out what could cause such a segfault ?

PS : Should it be useful, the error occurs in the (nested) call to
MatGetRowMax for the off-diagonal SeqAIJ matrix and the segmentation
violation occurs for the first row of a matrix whose ncols=0 (for the off
diagonal part).

MatGetOwnershipRangeColumn was used to set the diagonal and off-diagonal
preallocation and all the columns were set to be in the diagonal SeqAIJ
matrix as shown below :

(gdb) frame
#0  MatGetRowMax (mat=0x7ed340, v=0x982470, idx=0x0) at
/home/sajid/packages/petsc/src/mat/interface/matrix.c:4803
4803      if (!mat->ops->getrowmax)
SETERRQ1(PetscObjectComm((PetscObject)mat),PETSC_ERR_SUP,"Mat type
%s",((PetscObject)mat)->type_name);
(gdb) print mat->cmap->rstart
$12 = 0
(gdb) print mat->cmap->rend
$13 = 65536
(gdb) step
4804      MatCheckPreallocated(mat,1);
(gdb) next
4806      ierr = (*mat->ops->getrowmax)(mat,v,idx);CHKERRQ(ierr);
(gdb) next

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff60ca248 in MatGetRowMax_SeqAIJ (A=0x8d1450, v=0x9b1220,
idx=0x99a620) at
/home/sajid/packages/petsc/src/mat/impls/aij/seq/aij.c:3195
3195          x[i] = *aa; if (idx) idx[i] = 0;
(gdb)

Thank You,
Sajid Ali | PhD Candidate
Applied Physics
Northwestern University
s-sajid-ali.github.io
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20200908/edf5937f/attachment.html>


More information about the petsc-users mailing list