[petsc-users] counter->tag = *maxval - 128

Fande Kong fdkong.jd at gmail.com
Tue Jan 12 10:41:57 CST 2021


Hi All,

I am curious about why we subtract 128 from the max value of tag? Can we
directly use the max tag value?

Thanks,

Fande,


PetscErrorCode  PetscCommGetNewTag(MPI_Comm comm,PetscMPIInt *tag)
{
  PetscErrorCode   ierr;
  PetscCommCounter *counter;
   PetscMPIInt      *maxval,flg;


  MPI_Comm_get_attr(comm,Petsc_Counter_keyval,&counter,&flg);
  if (!flg) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_CORRUPT,"Bad MPI
communicator supplied; must be a PETSc communicator");

 if (counter->tag < 1) {
  PetscInfo1(NULL,"Out of tags for object, starting to recycle. Comm
reference count %d\n",counter->refcount);
  MPI_Comm_get_attr(MPI_COMM_WORLD,MPI_TAG_UB,&maxval,&flg);
    if (!flg) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_LIB,"MPI error:
MPI_Comm_get_attr() is not returning a MPI_TAG_UB");
    counter->tag = *maxval - 128; /* hope that any still active tags were
issued right at the beginning of the run */
  }

  *tag = counter->tag--;
   if (PetscDefined(USE_DEBUG)) {
     /*
     Hanging here means that some processes have called
PetscCommGetNewTag() and others have not.
      */
    MPI_Barrier(comm);
  }
  return(0);
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20210112/b2e9effc/attachment.html>


More information about the petsc-users mailing list