[petsc-users] PCFieldSplit with MatNest

Manuel Colera Rico m.colera at upm.es
Mon Mar 11 06:56:36 CDT 2019


Hello,

I need to solve a 2*2 block linear system. The matrices A_00, A_01, 
A_10, A_11 are constructed separately via MatCreateSeqAIJWithArrays and 
MatCreateSeqSBAIJWithArrays. Then, I construct the full system matrix 
with MatCreateNest, and use MatNestGetISs and PCFieldSplitSetIS to set 
up the PC, trying to follow the procedure described here: 
https://www.mcs.anl.gov/petsc/petsc-current/src/snes/examples/tutorials/ex70.c.html.

However, when I run the code with Leak Sanitizer, I get the following error:

=================================================================
==54927==ERROR: AddressSanitizer: attempting free on address which was 
not malloc()-ed: 0x627000051ab8 in thread T0
     #0 0x7fbd95c08f30 in __interceptor_free 
../../../../gcc-8.1.0/libsanitizer/asan/asan_malloc_linux.cc:66
     #1 0x7fbd92b99dcd in PetscFreeAlign 
(/opt/PETSc_library/petsc/manuel_OpenBLAS_petsc/lib/libpetsc.so.3.8+0x146dcd)
     #2 0x7fbd92ce0178 in VecRestoreArray_Nest 
(/opt/PETSc_library/petsc/manuel_OpenBLAS_petsc/lib/libpetsc.so.3.8+0x28d178)
     #3 0x7fbd92cd627d in VecRestoreArrayRead 
(/opt/PETSc_library/petsc/manuel_OpenBLAS_petsc/lib/libpetsc.so.3.8+0x28327d)
     #4 0x7fbd92d1189e in VecScatterBegin_SSToSS 
(/opt/PETSc_library/petsc/manuel_OpenBLAS_petsc/lib/libpetsc.so.3.8+0x2be89e)
     #5 0x7fbd92d1a414 in VecScatterBegin 
(/opt/PETSc_library/petsc/manuel_OpenBLAS_petsc/lib/libpetsc.so.3.8+0x2c7414)
     #6 0x7fbd934a999c in PCApply_FieldSplit 
(/opt/PETSc_library/petsc/manuel_OpenBLAS_petsc/lib/libpetsc.so.3.8+0xa5699c)
     #7 0x7fbd93369071 in PCApply 
(/opt/PETSc_library/petsc/manuel_OpenBLAS_petsc/lib/libpetsc.so.3.8+0x916071)
     #8 0x7fbd934efe77 in KSPInitialResidual 
(/opt/PETSc_library/petsc/manuel_OpenBLAS_petsc/lib/libpetsc.so.3.8+0xa9ce77)
     #9 0x7fbd9350272c in KSPSolve_GMRES 
(/opt/PETSc_library/petsc/manuel_OpenBLAS_petsc/lib/libpetsc.so.3.8+0xaaf72c)
     #10 0x7fbd934e3c01 in KSPSolve 
(/opt/PETSc_library/petsc/manuel_OpenBLAS_petsc/lib/libpetsc.so.3.8+0xa90c01)

Disabling Leak Sanitizer also outputs an "invalid pointer" error.

Did I forget something when writing the code?

Thank you,

Manuel

---



More information about the petsc-users mailing list