MPI_Comm_compare

int MPI_Comm_compare(MPI_Comm, MPI_Comm, int *);
Compares the groups and contexts of two communicators.