I'm not able to reproduce it with the BDDC example ex59.c in KSP tutorials. The error comes from the PetscMalloc1 call at src/mat/impls/aij/mpi/mpiov.c:1082, which allocates with Malloc and not with Calloc.
2017-07-13 17:50 GMT+03:00 Hong <[email protected]>: > Stefano : > Can you give me a detailed instruction on how to reproduce this error? > Hong > > Hong, >> >> I think what you wrote is conceptually wrong, being in the interface >> part of the library. >> The extra allocation is not done consistently throughout all the specific >> implementations that MatCreateSubMatrices can use. >> Here is an excerpt of a valgrind error I'm getting >> >> ==37303== Conditional jump or move depends on uninitialised value(s) >> ==37303== at 0xA94B0D7: MatDestroySubMatrices >> (/home/szampini/src/petsc/src/mat/interface/matrix.c:6890) >> ==37303== by 0xAFA0400: PCBDDCSubSchursSetUp >> (/home/szampini/src/petsc/src/ksp/pc/impls/bddc/bddcschurs.c:1545) >> ..... >> ==37303== Uninitialised value was created by a heap allocation >> ==37303== at 0x4C2FF83: memalign (/builddir/build/BUILD/valgrin >> d-3.12.0/coregrind/m_replacemalloc/vg_replace_malloc.c:858) >> ==37303== by 0x9FA172C: PetscMallocAlign (/home/szampini/src/petsc/src/ >> sys/memory/mal.c:39) >> ==37303== by 0x9FA4044: PetscTrMallocDefault >> (/home/szampini/src/petsc/src/sys/memory/mtr.c:183) >> ==37303== by 0xA87BE20: MatCreateSubMatrix_MPIAIJ_All >> (/home/szampini/src/petsc/src/mat/impls/aij/mpi/mpiov.c:1082) >> ==37303== by 0xA8852F1: MatCreateSubMatrices_MPIAIJ >> (/home/szampini/src/petsc/src/mat/impls/aij/mpi/mpiov.c:2024) >> ==37303== by 0xA9490C3: MatCreateSubMatrices >> (/home/szampini/src/petsc/src/mat/interface/matrix.c:6742) >> ==37303== by 0xAF9F401: PCBDDCSubSchursSetUp >> (/home/szampini/src/petsc/src/ksp/pc/impls/bddc/bddcschurs.c:1506) >> >> You can see the calling sequence, so that maybe I'm doing something wrong >> in bddcschurs.c. >> >> Thanks, >> Stefano >> >> >> 2017-07-12 22:20 GMT+03:00 Hong <[email protected]>: >> >>> MatCreateSubMatrices_xxx() calloc an array of size n+1, n=ismax and >>> submat[n]=null as default. >>> >>> For MatCreateSubMatrices_MPIAIJ(), I calloc ismax+nstages and use >>> submat[n] ... to store some datastructures for reuse. >>> >>> When submat[n] != null, these data structures are destroyed. >>> >>> Hong >>> >>> >>> On Wed, Jul 12, 2017 at 11:29 AM, Stefano Zampini < >>> [email protected]> wrote: >>> >>>> Is line number 6890 of matrix.c correct??? >>>> >>>> https://bitbucket.org/petsc/petsc/src/b02a13eda23b9fabea7dbf >>>> cadcfb98e3258ee49d/src/mat/interface/matrix.c?at=master&file >>>> viewer=file-view-default#matrix.c-6890 >>>> >>>> -- >>>> Stefano >>>> >>> >>> >> >> >> -- >> Stefano >> > > -- Stefano
