When I do not explicitly set the type in petsc-dev I get errors: [0]PETSC ERROR: --------------------- Error Message ------------------------------------ [0]PETSC ERROR: Object is in wrong state! [0]PETSC ERROR: Mat object's type is not set: Argument # 1! [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 22:49:38 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: MatMPIAIJSetPreallocation() line 3883 in /home/mohammad/soft/petsc-dev/src/mat/impls/aij/mpi/mpiaij.c [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 MatGetOwnershipRange()! [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 22:49:38 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: MatGetOwnershipRange() line 6106 in /home/mohammad/soft/petsc-dev/src/mat/interface/matrix.c [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 22:49:38 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: [0] MatGetOwnershipRange line 6101 /home/mohammad/soft/petsc-dev/src/mat/interface/matrix.c [0]PETSC ERROR: [0] MatMPIAIJSetPreallocation line 3881 /home/mohammad/soft/petsc-dev/src/mat/impls/aij/mpi/mpiaij.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 22:49:38 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
Even more than that, I get lots of errors apparently complaining that I have not preallocated the matrix: [0]PETSC ERROR: --------------------- Error Message ------------------------------------ [0]PETSC ERROR: Argument out of range! [0]PETSC ERROR: New nonzero at (6,209) caused a malloc! [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 22:44:09 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: MatSetValues_MPIAIJ() line 507 in /home/mohammad/soft/petsc-dev/src/mat/impls/aij/mpi/mpiaij.c [0]PETSC ERROR: MatSetValues() line 1148 in /home/mohammad/soft/petsc-dev/src/mat/interface/matrix.c I do not see these with 3.2-p6. Does 3.2-p6 has any mechanism for such alerts? On Tue, Apr 24, 2012 at 5:58 PM, Hong Zhang <hzhang at mcs.anl.gov> wrote: > Mohammad : > >> >> Is this also true with MatSetType()? petsc-dev seems to need it (3.2-p6 >> does not) but it's not listed in the changes link ... >> > There is no change on MatSetType(). The default type is aij. > You can check petsc examples, > e.g. petsc-dev/src/ksp/ksp/examples/tutorials/ex2.c > > Hong > >> >> >> On Tue, Apr 24, 2012 at 4:27 PM, Mohammad Mirzadeh <mirzadeh at >> gmail.com>wrote: >> >>> Thanks Hong. >>> >>> >>> On Tue, Apr 24, 2012 at 4:25 PM, Hong Zhang <hzhang at mcs.anl.gov> wrote: >>> >>>> See >>>> http://www.mcs.anl.gov/petsc/documentation/changes/dev.html: >>>> >>>> You MUST now call MatXXXSetPreallocation() or MatSetUp() on any matrix >>>> you create directly (not using DMCreateMatrix()) before calling >>>> MatSetValues(), MatSetValuesBlocked() etc. >>>> >>>> >>>> On Tue, Apr 24, 2012 at 6:01 PM, Mohammad Mirzadeh <mirzadeh at >>>> gmail.com>wrote: >>>> >>>>> 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: >>>>> ------------------------------------------------------------------------ >>>>> >>>>> 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? >>>>> >>>> Yes. >>>> >>>> Hong >>>> >>>>> >>>>> Thanks, >>>>> Mohammad >>>>> >>>> >>>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120424/0fb392a6/attachment.htm>
