<div class="gmail_quote">On Tue, Jan 3, 2012 at 04:11, <span dir="ltr"><<a href="mailto:Johannes.Huber@unibas.ch">Johannes.Huber@unibas.ch</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div id=":1w">I have the following code snippet:<br>
<br>
{<br>
static int iCall(0);<br>
Vec v = m_State->vec(); // Get the Petsc vector from a libmesh PetscVector<br></div></blockquote><div><br></div><div>The problem is earlier, where you call VecSetValues() with ADD_VALUES in one place and with INSERT_VALUES in another place, perhaps through overloaded operators.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div id=":1w">
VecAssemblyBegin(v);<br>
VecAssemblyEnd(v);<br>
// Assembly works fine<br>
PetscViewer File;<br>
PetscViewerCreate(MPI_COMM_<u></u>WORLD,&File);<br>
char Filename[32];<br>
sprintf(Filename,"State_%03d.<u></u>m",iCall++);<br>
PetscViewerASCIIOpen(MPI_COMM_<u></u>WORLD,Filename,&File);<br>
PetscViewerSetFormat(File,<u></u>PETSC_VIEWER_ASCII_MATLAB);<br>
VecView(v,File);<br>
PetscViewerDestroy(&File);<br>
// File is created and looks good<br>
VecAssemblyBegin(v); // Here it crashes<br>
VecAssemblyEnd(v);<br>
}<br>
<br>
When running this code on two processes, I receive the error message:<br>
[1]PETSC ERROR: VecAssemblyBegin_MPI() line 1010 in src/vec/vec/impls/mpi/pdvec.c<br>
[1]PETSC ERROR: VecAssemblyBegin() line 219 in src/vec/vec/interface/vector.c<br></div></blockquote><div><br></div><div>Is this the *whole* error message? It should have printed quite a bit more than just this.</div><div>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div id=":1w">
<br>
Taking a look in the mentioned file there is the following code:<br>
ierr = MPI_Allreduce(&xin->stash.<u></u>insertmode,&addv,1,MPI_INT,<u></u>MPI_BOR,comm);CHKERRQ(ierr);<br>
if (addv == (ADD_VALUES|INSERT_VALUES)) SETERRQ(PETSC_COMM_SELF,PETSC_<u></u>ERR_ARG_NOTSAMETYPE,"Some processors inserted values while others added");<br>
<br>
What am I doing wrong?</div></blockquote></div><br>