:orphan:
# PetscObjectGetNewTag
Gets a unique new tag from a PETSc object. All processors that share the object MUST call this routine EXACTLY the same number of times.  This tag should only be used with the current objects communicator; do NOT use it with any other MPI communicator. 
## Synopsis
```
#include "petscsys.h"   
PetscErrorCode PetscObjectGetNewTag(PetscObject obj, PetscMPIInt *tag)
```
Collective


## Input Parameter

- ***obj -*** the PETSc object; this must be cast with a (`PetscObject`), for example,
`PetscObjectGetNewTag`((`PetscObject`)mat,&tag);



## Output Parameter

- ***tag -*** the new tag





## Note
This tag is needed if one is writing MPI communication code involving message passing and needs unique MPI tags to ensure the messages are connected to this specific
object.


## See Also
 `PetscCommGetNewTag()`

## Level
developer

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/objects/tagm.c.html#PetscObjectGetNewTag">src/sys/objects/tagm.c</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/objects/tagm.c)


[Index of all Sys routines](index.md)  
[Table of Contents for all manual pages](/manualpages/index.md)  
[Index of all manual pages](/manualpages/singleindex.md)  
