[petsc-users] Error in VecAssemeblyBegin after VecView

Johannes.Huber at unibas.ch Johannes.Huber at unibas.ch
Tue Jan 3 06:41:29 CST 2012


Hi Jed,
thanks for your answer.
The first assembly works well, and I would agree, if the first  
assmebly crashed. However, it's the second assembly call and in  
between those two calls, all I'm doing is viewing the vector.

Quoting Jed Brown <jedbrown at mcs.anl.gov>:

> On Tue, Jan 3, 2012 at 04:11, <Johannes.Huber at unibas.ch> wrote:
>
>> I have the following code snippet:
>>
>>    {
>>      static int iCall(0);
>>      Vec v = m_State->vec();  // Get the Petsc vector from a libmesh
>> PetscVector
>>
>
> 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.
>
>
>>      VecAssemblyBegin(v);
>>      VecAssemblyEnd(v);
>>      // Assembly works fine
>>      PetscViewer File;
>>      PetscViewerCreate(MPI_COMM_**WORLD,&File);
>>      char Filename[32];
>>      sprintf(Filename,"State_%03d.**m",iCall++);
>>      PetscViewerASCIIOpen(MPI_COMM_**WORLD,Filename,&File);
>>      PetscViewerSetFormat(File,**PETSC_VIEWER_ASCII_MATLAB);
>>      VecView(v,File);
>>      PetscViewerDestroy(&File);
>>      // File is created and looks good
>>      VecAssemblyBegin(v);  // Here it crashes
>>      VecAssemblyEnd(v);
>>    }
>>
>> When running this code on two processes, I receive the error message:
>> [1]PETSC ERROR: VecAssemblyBegin_MPI() line 1010 in
>> src/vec/vec/impls/mpi/pdvec.c
>> [1]PETSC ERROR: VecAssemblyBegin() line 219 in
>> src/vec/vec/interface/vector.c
>>
>
> Is this the *whole* error message? It should have printed quite a bit more
> than just this.
>
>
>>
>> Taking a look in the mentioned file there is the following code:
>>  ierr = MPI_Allreduce(&xin->stash.**insertmode,&addv,1,MPI_INT,**
>> MPI_BOR,comm);CHKERRQ(ierr);
>>  if (addv == (ADD_VALUES|INSERT_VALUES))  
>> SETERRQ(PETSC_COMM_SELF,PETSC_**ERR_ARG_NOTSAMETYPE,"Some
>> processors inserted values while others added");
>>
>> What am I doing wrong?
>>
>



----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.




More information about the petsc-users mailing list