[petsc-dev] MPI_Attr_get test fails

Mark Adams mfadams at lbl.gov
Fri Feb 9 21:35:04 CST 2018


On Fri, Feb 9, 2018 at 6:22 PM, Jed Brown <jed at jedbrown.org> wrote:

> Mark Adams <mfadams at lbl.gov> writes:
>
> > I get an error in PetscCommGetNewTag. So I copied the test to may main
> and
> > I get the same problem. So this code fails:
> >
> > int main( int argc, char **args )
> > {
> >   PetscErrorCode   ierr;
> >   ierr = PetscInitialize( &argc, &args, "./.petscrc", NULL
> );CHKERRQ(ierr);
> >   { // debug
> >     PetscCommCounter *counter;
> >     PetscMPIInt      flg;
> >     ierr =
> > MPI_Attr_get(PETSC_COMM_WORLD,Petsc_Counter_keyval,&counter,
> &flg);CHKERRQ(ierr);
> >     if (!flg) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_CORRUPT,"Bad MPI
> > communicator supplied ???????????????");
> >   }
> >
> > Any ideas?
>
> Why do you think there would be a value on PETSC_COMM_WORLD (an outer
> comm)?  Use PetscCommDuplicate() to get an inner comm or use the
> communicator on a PETSc object.
>

Get the same thing with this. This is an ancient code and I had an ugly
hack where I duplicated MPI_COMM_WORLD and set PETSC_COMM_WORLD with that.
I'm going over this code and trying to de-uglify it ...

int main( int argc, char **args )
{
  PetscErrorCode ierr;
  MPI_Comm       newcomm;
  ierr = PetscInitialize(&argc, &args, "./.petscrc", NULL);CHKERRQ(ierr);
  ierr = PetscCommDuplicate(PETSC_COMM_WORLD, &newcomm, NULL);CHKERRQ(ierr);
  { // debug
    PetscCommCounter *counter;
    PetscMPIInt      flg;
    ierr =
MPI_Attr_get(newcomm,Petsc_Counter_keyval,&counter,&flg);CHKERRQ(ierr);
    if (!flg) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_CORRUPT,"Bad MPI
communicator supplied ???????????????");
  }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20180209/4789aed4/attachment-0001.html>


More information about the petsc-dev mailing list