mpi-communicators
Table of Contents
MPI Communicators
Communicators are groups of processes in MPI. Messages sent on one communicator cannot be received on another, even between the same ranks with the same tag. MPI_COMM_WORLD is the default, including all processes launched by mpirun. Within a communicator, each process has a rank (0 to N-1) and the group has a size.
MPI_Comm_split partitions an existing communicator into sub-communicators. Each process passes a color to determine which group it joins and a key to control rank ordering within the new group. Processes with the same color end up in the same new communicator. This is useful for creating communicators that span a single node, a single row of a process grid, or any other subset.
int color = rank % 2; // even and odd ranks form separate communicators MPI_Comm half; MPI_Comm_split(MPI_COMM_WORLD, color, rank, &half); // use half... MPI_Comm_free(&half);
mpi-communicators.md · Last modified: by 127.0.0.1
