[petsc-users] Allocation errors

Matthew Knepley knepley at gmail.com
Wed May 27 14:32:35 CDT 2015


On Wed, May 27, 2015 at 1:16 PM, Li, Xinya <Xinya.Li at pnnl.gov> wrote:

>  Thank you, Matthew.
>
> Mat A is the only matrix I am working on in this function.
>
> If I remove the  following lines from the code,  it will run smoothly.
>
> // Allocate A
>
>   ierr = MatCreate(PETSC_COMM_WORLD,&A); CHKERRQ(ierr);
>
>   ierr = MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,4*ngen,4*ngen);
> CHKERRQ(ierr);
>
>   ierr = MatSetFromOptions(A); CHKERRQ(ierr);
>
>  ierr = MatSetUp(A); CHKERRQ(ierr);
>

That error message will only happen if you do not assemble the matrix. Run
in the debugger, find
which matrix is unassembled, and assemble it.

  Thanks,

     Matt


>
>
> *From:* Matthew Knepley [mailto:knepley at gmail.com]
> *Sent:* Wednesday, May 27, 2015 10:56 AM
> *To:* Li, Xinya
> *Cc:* petsc-users at mcs.anl.gov
> *Subject:* Re: [petsc-users] Allocation errors
>
>
>
> On Wed, May 27, 2015 at 12:39 PM, Li, Xinya <Xinya.Li at pnnl.gov> wrote:
>
>
>
> The error messages were still the same.
>
>
>
> In original code, I called  MatAssemblyBegin and  MatAssemblyEnd after I
> use MatSetValues to evaluate A.
>
>
>
> That error message is given when a matrix you give PETSc is not assembled.
> If the message persists, you have
>
> called MatAssemblyBegin/End() on the wrong matrix. Maybe it would be
> easier for you to use the debugger to
>
> track down which matrix you need to assemble.
>
>
>
>    Matt
>
>
>
>
>
> *From:* Matthew Knepley [mailto:knepley at gmail.com]
> *Sent:* Wednesday, May 27, 2015 10:04 AM
> *To:* Li, Xinya
> *Cc:* petsc-users at mcs.anl.gov
> *Subject:* Re: [petsc-users] Allocation errors
>
>
>
> On Wed, May 27, 2015 at 11:58 AM, Li, Xinya <Xinya.Li at pnnl.gov> wrote:
>
> Dear Sir/Madam,
>
>
>
> I am trying to assembling a large sparse complex matrix for parallel
> computing. I need to pre-allocate for this sparse matrix A.
>
>
>
> This is what I included in the code
>
>
> ***************************************************************************************************
>
> // Allocate A
>
>   ierr = MatCreate(PETSC_COMM_WORLD,&A); CHKERRQ(ierr);
>
>   ierr = MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,4*ngen,4*ngen);
> CHKERRQ(ierr);
>
>   ierr = MatSetFromOptions(A); CHKERRQ(ierr);
>
>  ierr = MatSetUp(A); CHKERRQ(ierr);
>
>
>
>   ierr = MatGetOwnershipRange(A, &xstart, &xend); CHKERRQ(ierr);
>
>   if (iteration > 0) {
>
>     ierr = MatRetrieveValues(A); CHKERRQ(ierr);
>
>   }
>
>
>
> Call MatAssemblyBeginEnd().
>
>
>
>   Thanks,
>
>
>
>     Matt
>
>
>
>
> ***************************************************************************************************
>
>
>
> This is the error message
>
>
> ***************************************************************************************************
>
> [0]PETSC ERROR: --------------------- Error Message
> --------------------------------------------------------------
>
> [0]PETSC ERROR: Object is in wrong state
>
> [0]PETSC ERROR: Not for unassembled matrix
>
> [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html
> for trouble shooting.
>
> [0]PETSC ERROR: Petsc Release Version 3.5.3, unknown
>
> [0]PETSC ERROR: ./dynSim on a arch-complex named olympus.local by lixi729
> Wed May 27 09:46:05 2015
>
> [0]PETSC ERROR: Configure options --with-cc=gcc --with-fc=gfortran
> --with-cxx=g++ --with-scalar-type=complex --with-clanguage=C++
> --with-fortran-kernels=generic --with-cxx-dialect=C++11
> --download-fblaslapack --download-mpich --download-superlu_dist
> --download-mumps --download-scalapack --download-parmetis --download-metis
> --download-elemental
>
> [0]PETSC ERROR: #1 MatGetOrdering() line 189 in
> /people/lixi729/petsc/src/mat/order/sorder.c
>
> [0]PETSC ERROR: #2 PCSetUp_ILU() line 196 in
> /people/lixi729/petsc/src/ksp/pc/impls/factor/ilu/ilu.c
>
> [0]PETSC ERROR: #3 PCSetUp() line 902 in
> /people/lixi729/petsc/src/ksp/pc/interface/precon.c
>
> [0]PETSC ERROR: #4 KSPSetUp() line 306 in
> /people/lixi729/petsc/src/ksp/ksp/interface/itfunc.c
>
> [0]PETSC ERROR: #5 KSPSolve() line 418 in
> /people/lixi729/petsc/src/ksp/ksp/interface/itfunc.c
>
> [0]PETSC ERROR: #6 SNESSolve_NEWTONLS() line 232 in
> /people/lixi729/petsc/src/snes/impls/ls/ls.c
>
> [0]PETSC ERROR: #7 SNESSolve() line 3743 in
> /people/lixi729/petsc/src/snes/interface/snes.c
>
> [0]PETSC ERROR: #8 TSStep_Theta() line 194 in
> /people/lixi729/petsc/src/ts/impls/implicit/theta/theta.c
>
> [0]PETSC ERROR: #9 TSStep() line 2629 in
> /people/lixi729/petsc/src/ts/interface/ts.c
>
> [0]PETSC ERROR: #10 TSSolve() line 2748 in
> /people/lixi729/petsc/src/ts/interface/ts.c
>
> [0]PETSC ERROR: #11 simu() line 638 in simulation.C
>
> [0]PETSC ERROR: #12 runSimulation() line 99 in dynSim.h
>
>
> ****************************************************************************************************
>
>
>
> Thank you very much. I really appreciate your help and time.
>
> Regards
>
> *__________________________________________________ *
> *Xinya Li*
> Scientist
> EED/Hydrology
>
> Pacific Northwest National Laboratory
> 902 Battelle Boulevard
> P.O. Box 999, MSIN K9-33
> Richland, WA  99352 USA
> Tel:  509-372-6248
> Fax: 509-372-6089
> *Xinya.Li at pnl.gov <Xinya.Li at pnl.gov>*
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> --
>
> 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
>
>
>
>
>
> --
>
> 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
>



-- 
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20150527/bb913457/attachment.html>


More information about the petsc-users mailing list