[petsc-users] Copy X in ksp solver

Barry Smith bsmith at mcs.anl.gov
Fri Aug 23 12:59:26 CDT 2013


   This error happens because of 

  if (x->stash.insertmode != NOT_SET_VALUES) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Not for unassembled vector");

   It can only happen if 

1) memory corruption due to previously writing outside array regions or 

2) VecSetValues() was called on the input vector but VecAssemblyBegin/End() was never called.

  So verify you are not calling VecSetValues() on that X with the assembly and if it loops good then run with valgrind

http://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind


On Aug 23, 2013, at 12:14 PM, Longxiang Chen <suifengls at gmail.com> wrote:

> Dear all,
> 
> Running with ./ex23 -ksp_type cg, everything works well.
> If running with mpi: mpiexec -n 4  ./ex23 -ksp_type cg
> In /src/ksp/ksp/impls/cg/cg.c, when I try to make a copy of the solution vector X by VecCopy(X, myX), the following error comes out. 
> 
> [1]PETSC ERROR: --------------------- Error Message ------------------------------------
> [1]PETSC ERROR: Object is in wrong state!
> [1]PETSC ERROR: Not for unassembled vector!
> [1]PETSC ERROR: ------------------------------------------------------------------------
> [1]PETSC ERROR: Petsc Release Version 3.4.2, Jul, 02, 2013 
> [1]PETSC ERROR: See docs/changes/index.html for recent updates.
> [1]PETSC ERROR: See docs/faq.html for hints about trouble shooting.
> [1]PETSC ERROR: See docs/index.html for manual pages.
> [1]PETSC ERROR: ------------------------------------------------------------------------
> [1]PETSC ERROR: ./ex23 on a ksp-intel named head.cluster by lchen Fri Aug 23 11:57:49 2013
> [1]PETSC ERROR: Libraries linked from /home/lchen/petsc-3.4.2/ftksp-intel/lib
> [1]PETSC ERROR: Configure run at Mon Aug 19 18:32:17 2013
> [1]PETSC ERROR: Configure options PETSC_ARCH=ksp-intel --with-shared-libraries=0 --with-blas-lib=/opt/acml5.3.0/gfortran64/lib/libacml.a --with-lapack-lib=/opt/acml5.3.0/gfortran64/lib/libacml.a
> [1]PETSC ERROR: ------------------------------------------------------------------------
> [1]PETSC ERROR: VecCopy() line 1686 in /home/lchen/petsc-3.4.2/src/vec/vec/interface/vector.c
> 
> But VecCopy(myX, X) works.
> Any problem with my copy?
> Are there any methods to copy X to myX? 
> Thanks,
> 
> Longxiang



More information about the petsc-users mailing list