# PetscCommDuplicate

Duplicates the communicator only if it is not already a PETSc communicator.

### Synopsis

    #include "petscsys.h"
    PetscErrorCode PETSC_DLLEXPORT PetscCommDuplicate(MPI_Comm comm_in,MPI_Comm *comm_out,PetscMPIInt* first_tag)

Collective on MPI_Comm

### Input Parameters

comm_in -Input communicator

### Output Parameters

| comm_out | - Output communicator. May be comm_in.
| first_tag | - Tag available that has not already been used with this communicator (you may pass in PETSC_NULL if you do not need a tag)

PETSc communicators are just regular MPI communicators that keep track of which tags have been used to prevent tag conflict. If you pass a non-PETSc communicator into a PETSc creation routine it will be duplicated for use in the object.

### See Also

PetscObjectGetNewTag(), PetscCommGetNewTag()

Level:developer
Location:src/sys/src/objects/tagm.c
Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages