Question on MatPtAP
Matthew Knepley
knepley at gmail.com
Tue Jul 1 08:07:37 CDT 2008
I just ran this with petsc-dev and valgrind, and got no errors.
Matt
On Tue, Jul 1, 2008 at 5:53 AM, Tobias Neckel <neckel at in.tum.de> wrote:
> Hello,
>
> when moving from PETSc 2.3.2-p10 to 2.3.3-p13, I recently encountered a
> strange behaviour (segmentation fault) of the new version concerning the
> usage of MatPtAP. I tried to pull everything down to a simple test case. For
> square matrices (A as well as P), everything seems to work fine.
>
> But when I set up a simple non-square example (A being the 3x3-identity, P
> being a 3x5 matrix, see attached file PETScLibTest.cpp), I encounter severe
> problems: As soon as P gets entries outside its 3x3 block (an entry P(0,3),
> e.g.), PETSc is telling me about Memory corruption while using MatPtAP (see
> part of command line output in the attached file output.txt, run with
> -info).
>
> I used valgrind to check if sth. weird happens, but it is giving nothing
> until the PETSc error message.
>
> Using the same test case with PETSc 2.3.2-p10 (with identic configuring
> options on the same machine) does not show any problems at all.
>
> So I am a bit confused. Is it not allowed any longer to use MatPtAP with
> non-square matrices? I checked the online documentation but did not find
> anything ...
>
> Next idea was to use MatMatMult directly to see if that works. So I used
> MatMatMultTranspose(P, A, MAT_INITIAL_MATRIX, 1.0, &C1) and then
> MatMatMult(C1, P, MAT_INITIAL_MATRIX, 1.0, &C)
> to get C=C1*P=P^T*A*P in two steps. This time, everything works fine for the
> small test case from above, also with the new version 2.3.3-p13.
>
>
> Best regards
> Tobias Neckel
>
> --
> Dipl.-Tech. Math. Tobias Neckel
>
> Institut für Informatik V, TU München
> Boltzmannstr. 3, 85748 Garching
>
> Tel.: 089/289-18602
> Email: neckel at in.tum.de
> URL: http://www5.in.tum.de/persons/neckel.html
>
> 11:16:11 info UserInterface::writeHeader()
> peano - jafs (Just Another Fluid Solver)
> 11:16:11 info UserInterface::writeHeader()
> 2d, loaded components: stacks geometry plotter trivialgrid fluid
> fluid-scenario steady-state(fluid) turbulence(fluid) grid petsc
> 11:16:11 info UserInterface::writeHeader()
> $Revision: 1.82 $
> 11:16:11 info UserInterface::writeHeader()
> 2005 - 2008 Tobias Neckel, Tobias Weinzierl, TUM, Informatik V
> 11:16:11 debug /::validateProgramArguments(int,char**)
> Using configuration file config-files/configurationTests.xml
> --32741-- REDIR: 0x4861F5C (operator new[](unsigned)) redirected to
> 0x40219AB (operator new[](unsigned))
> --32741-- REDIR: 0x4860B08 (operator delete[](void*)) redirected to
> 0x4020ABA (operator delete[](void*))
> 11:16:12 debug petsc::PETScLibTest::testMatPreallocation()
> start PETSc mat preallocation test
> 11:16:12 debug petsc::PETScLibTest::testMatPreallocation()
> stop PETSc mat preallocation test
> 11:16:12 debug petsc::PETScLibTest::testPTAPQuadratic()
> start PETSc PTAP test 1
> 11:16:13 debug petsc::PETScLibTest::testPTAPQuadratic()
> start test 2
> 11:16:13 debug petsc::PETScLibTest::testPTAPQuadratic()
> stop PETSc PTAP test
> 11:16:13 debug petsc::PETScLibTest::testPTAPRectangular()
> start PETSc PTAP rectangular test
> [0] PetscCommDuplicate(): Duplicating a communicator 1140850688 -2080374784
> max tags = 2147483647
> [0] PetscCommDuplicate(): returning tag 2147483647
> [0] MatAssemblyEnd_SeqAIJ(): Matrix size: 3 X 3; storage space: 0 unneeded,3
> used
> [0] MatAssemblyEnd_SeqAIJ(): Number of mallocs during MatSetValues() is 0
> [0] MatAssemblyEnd_SeqAIJ(): Maximum nonzeros in any row is 1
> [0] Mat_CheckInode(): Found 3 nodes out of 3 rows. Not using Inode routines
> [0] PetscCommDuplicate(): Using internal PETSc communicator 1140850688
> -2080374784
> [0] PetscCommDuplicate(): returning tag 2147483646
> [0] MatAssemblyEnd_SeqAIJ(): Matrix size: 3 X 5; storage space: 5
> unneeded,10 used
> [0] MatAssemblyEnd_SeqAIJ(): Number of mallocs during MatSetValues() is 0
> [0] MatAssemblyEnd_SeqAIJ(): Maximum nonzeros in any row is 4
> [0] Mat_CheckInode(): Found 2 nodes of 3. Limit used: 5. Using Inode
> routines
> [0] MatGetSymbolicTranspose_SeqIJ(): Getting Symbolic Transpose.
> [0]PETSC ERROR: PetscTrFreeDefault() called from PetscFreeSpaceContiguous()
> line 43 in src/mat/utils/freespace.c
> [0]PETSC ERROR: Block [id=0(12)] at address 0x4e9cd20 is corrupted (probably
> write past end of array)
> [0]PETSC ERROR: Block allocated in PetscFreeSpaceGet() line 14 in
> src/mat/utils/freespace.c
> [0]PETSC ERROR: --------------------- Error Message
> ------------------------------------
> [0]PETSC ERROR: Memory corruption!
> [0]PETSC ERROR: Corrupted memory!
> [0]PETSC ERROR:
> ------------------------------------------------------------------------
> [0]PETSC ERROR: Petsc Release Version 2.3.3, Patch 13, Thu May 15 17:29:26
> CDT 2008 HG revision: 4466c6289a0922df26e20626fd4a0b4dd03c8124
> [0]PETSC ERROR: See docs/changes/index.html for recent updates.
> [0]PETSC ERROR: See docs/faq.html for hints about trouble shooting.
> [0]PETSC ERROR: See docs/index.html for manual pages.
> [0]PETSC ERROR:
> ------------------------------------------------------------------------
> [0]PETSC ERROR: Debug/peano_stud on a linux-gnu named atsccs29 by neckel Tue
> Jul 1 11:16:11 2008
> [0]PETSC ERROR: Libraries linked from
> /home/neckel/Programme/petsc-2.3.3-p13/lib/linux-gnu-c-real-debug-gentoo-NOmpi-080523
> [0]PETSC ERROR: Configure run at Fri May 23 13:44:27 2008
> [0]PETSC ERROR: Configure options
> --PETSC_ARCH=linux-gnu-c-real-debug-gentoo-NOmpi-080523
> --prefix=/home/neckel/Programme/petsc-2.3.3-p13 --with-mpi-dir=/usr/
> --with-mpi=0 --with-debugging=yes --with-clanguage=C++ --with-cxx=g++
> --with-shared=0 --with-fortran-kernels=generic
> [0]PETSC ERROR:
> ------------------------------------------------------------------------
> [0]PETSC ERROR: PetscTrFreeDefault() line 303 in src/sys/memory/mtr.c
> [0]PETSC ERROR: PetscFreeSpaceContiguous() line 43 in
> src/mat/utils/freespace.c
> [0]PETSC ERROR: MatPtAPSymbolic_SeqAIJ_SeqAIJ() line 129 in
> src/mat/impls/aij/seq/matptap.c
> [0]PETSC ERROR: MatPtAPSymbolic_SeqAIJ() line 22 in
> src/mat/impls/aij/seq/matptap.c
> [0]PETSC ERROR: MatPtAPSymbolic() line 6689 in src/mat/interface/matrix.c
> [0]PETSC ERROR: MatPtAP_Basic() line 13 in src/mat/utils/ptap.c
> [0]PETSC ERROR: MatPtAP() line 6582 in src/mat/interface/matrix.c
> 11:16:13 warning petscError::logPETScError
> Attention: no PetscErrorBaseMessage imitated!
> 11:16:13 error petscError::logPetscTraceBackErrorHandler
> Major PETSc error occured in function
> petsc::PETScLibTest::testPTAPRectangular, line 591, dir. petsc/tests, file
> ../src/petsc/tests/PETScLibTest.cpp.
>
--
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
More information about the petsc-users
mailing list