Check out example codes for "mpi split communicator". It will help you in understanding the concepts better.

Code Example 1

int MPI_Comm_split(
  MPI_Comm comm,
  int color, // int representing the group, one different for each group
  int key,   // int representing the rank of the current proc in the new group
  MPI_Comm *newcomm // output param
);

Learn ReactJs, React Native from akashmittal.com