[petsc-users] error in petsc-dev

Mohammad Mirzadeh mirzadeh at gmail.com
Tue Apr 24 18:01:04 CDT 2012


Hi,

While trying to figure out a problem, I came across the following
situation. Consider the following code:

int main (int argc, char **argv){

    PetscInitialize(&argc, &argv, (char*)0, help);


    Mat m;

    MatCreate(PETSC_COMM_WORLD, &m);

    MatSetSizes(m, 10, 10, PETSC_DECIDE, PETSC_DECIDE);

    MatSetFromOptions(m);

    MatAssemblyBegin(m, MAT_FINAL_ASSEMBLY);

    MatAssemblyEnd(m, MAT_FINAL_ASSEMBLY);

    MatView(m, PETSC_VIEWER_STDOUT_WORLD);

    MatDestroy(&m);


    PetscFinalize();

    return 0;

}


This runs without any problem under 3.2-p6 but fails with petsc-dev:

[0]PETSC ERROR: --------------------- Error Message
------------------------------------
[0]PETSC ERROR: Object is in wrong state!
[0]PETSC ERROR: Must call MatXXXSetPreallocation() or MatSetUp() on
argument 1 "mat" before MatAssemblyBegin()!
[0]PETSC ERROR:
------------------------------------------------------------------------
[0]PETSC ERROR: Petsc Development HG revision:
5c943f0d8cbf252873fd4abeffa38c8d3c15987e  HG Date: Mon Apr 09 22:04:11 2012
-0500
[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: ./petsc on a arch-linu named mohammad-laptop by mohammad
Tue Apr 24 15:55:40 2012
[0]PETSC ERROR: Libraries linked from
/home/mohammad/soft/petsc-dev/arch-linux2-cxx-debug/lib
[0]PETSC ERROR: Configure run at Mon Apr  9 23:17:27 2012
[0]PETSC ERROR: Configure options --with-clanguage=cxx --with-cc=gcc
--with-cxx=g++ --with-fc=gfortran --download-mpich=1
--download-f-blas-lapack=1 --download-hypre=1 --download-superlu_dist=1
--download-metis=1 --download-parmetis=1
[0]PETSC ERROR:
------------------------------------------------------------------------
[0]PETSC ERROR: MatAssemblyBegin() line 4810 in
/home/mohammad/soft/petsc-dev/src/mat/interface/matrix.c
[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
http://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] MatAssemblyEnd_SeqAIJ line 800
/home/mohammad/soft/petsc-dev/src/mat/impls/aij/seq/aij.c
[0]PETSC ERROR: [0] MatAssemblyEnd line 4984
/home/mohammad/soft/petsc-dev/src/mat/interface/matrix.c
[0]PETSC ERROR: [0] MatAssemblyBegin line 4807
/home/mohammad/soft/petsc-dev/src/mat/interface/matrix.c
[0]PETSC ERROR: --------------------- Error Message
------------------------------------
[0]PETSC ERROR: Signal received!
[0]PETSC ERROR:
------------------------------------------------------------------------
[0]PETSC ERROR: Petsc Development HG revision:
5c943f0d8cbf252873fd4abeffa38c8d3c15987e  HG Date: Mon Apr 09 22:04:11 2012
-0500
[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: ./petsc on a arch-linu named mohammad-laptop by mohammad
Tue Apr 24 15:55:40 2012
[0]PETSC ERROR: Libraries linked from
/home/mohammad/soft/petsc-dev/arch-linux2-cxx-debug/lib
[0]PETSC ERROR: Configure run at Mon Apr  9 23:17:27 2012
[0]PETSC ERROR: Configure options --with-clanguage=cxx --with-cc=gcc
--with-cxx=g++ --with-fc=gfortran --download-mpich=1
--download-f-blas-lapack=1 --download-hypre=1 --download-superlu_dist=1
--download-metis=1 --download-parmetis=1
[0]PETSC ERROR:
------------------------------------------------------------------------
[0]PETSC ERROR: User provided function() line 0 in unknown directory
unknown file
application called MPI_Abort(MPI_COMM_WORLD, 59) - process 0
[unset]: aborting job:
application called MPI_Abort(MPI_COMM_WORLD, 59) - process 0


Eventually I could fix this by adding MatSetUp(m) after setting the
options. Why do I need this in petsc-dev? Does this somehow preallocate the
matrix?

Thanks,
Mohammad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120424/4e5a494a/attachment.htm>


More information about the petsc-users mailing list