[petsc-dev] who broke petsc-dev

Barry Smith bsmith at mcs.anl.gov
Sun Nov 13 16:46:33 CST 2011


  Please fix it. There are many tests that now crash because of this including src/snes/examples/tutorials/ex5.c

   Barry

On Nov 13, 2011, at 4:44 PM, Matthew Knepley wrote:

> On Sun, Nov 13, 2011 at 10:36 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:
> 
> 0) Me
> 
> PetscErrorCode  KSPSetOperators(KSP ksp,Mat Amat,Mat Pmat,MatStructure flag)
> {
>  MatNullSpace   nullsp;
>  PetscErrorCode ierr;
> 
>  PetscFunctionBegin;
>  PetscValidHeaderSpecific(ksp,KSP_CLASSID,1);
>  if (Amat) PetscValidHeaderSpecific(Amat,MAT_CLASSID,2);
>  if (Pmat) PetscValidHeaderSpecific(Pmat,MAT_CLASSID,3);
>  if (Amat) PetscCheckSameComm(ksp,1,Amat,2);
>  if (Pmat) PetscCheckSameComm(ksp,1,Pmat,3);
>  if (!ksp->pc) {ierr = KSPGetPC(ksp,&ksp->pc);CHKERRQ(ierr);}
>  ierr = PCSetOperators(ksp->pc,Amat,Pmat,flag);CHKERRQ(ierr);
>  if (ksp->setupstage == KSP_SETUP_NEWRHS) ksp->setupstage = KSP_SETUP_NEWMATRIX;  /* so that next solve call will call PCSetUp() on new matrix */
>  if (ksp->guess) {
>    ierr = KSPFischerGuessReset(ksp->guess);CHKERRQ(ierr);
>  }
>  ierr = MatGetNullSpace(Amat, &nullsp);CHKERRQ(ierr);
>  if (nullsp) {
>    ierr = KSPSetNullSpace(ksp, nullsp);CHKERRQ(ierr);
>  }
>  PetscFunctionReturn(0);
> }
> 
> 
> 1) It is legitimate to call KSPSetOperators with a null Amat so this is a bug that crashes large parts of PETSc
> 
> What does a NULL A even mean here. I can understand a NULL P, which might mean A == P, but what would it mean
> to have no A?
>  
> 2) Do you really want to do this? I am not sure I like it.
> 
> Yes, I definitely do. How else will the solver get information about the null space of an operator.
> 
>    Matt
> 
> -- 
> 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




More information about the petsc-dev mailing list