What is the difference between a communicator and a group in MPI?
Asked Answered
D

5

18

I have read the definitions of these terms and my interpretation is that there is a one to one relation between a group and a communicator. A group is a set of processes which wish to communicate with each other and a communicator is an implementation for a group.

Is this correct? Why have two different terms if this is so?

Distiller answered 15/4, 2010 at 4:58 Comment(0)
L
9

A group is an ordered set of process identifiers (MPI 2.2 spec, sec 6.2.1). The ordering is given by associating with each process identifier a unique rank from 0 to group.size - 1.

A communicator encapsulates all communication among a set of processes. An intra-communicator is associated with a group as well as contexts of communication for both point-to-point and collective communication and possibly other context information such as virtual topologies (spec, 6.1.2). An inter-communicator is associated with two non-overlapping groups.

I (probably very loosely) think of a communicator's group as its symbol table.

A group may contain process identifiers from several communicators.

Finally, construction of and operations on groups are local to the process, and do not involve interprocess communication. This is not, in general, true for communicators (by their very nature).

Lorrettalorri answered 4/5, 2010 at 20:54 Comment(0)
D
6

There are a lot of differences between communicators and groups as I found out after reading the MPI Specification.

Edit: Groups are objects that represent groups of processes.

Communicator is a set of processes that may communicate with each other and may consist of processes from a single group or from multiple groups.

Thus they are completely different entities. They should not be confused with each other.

Distiller answered 16/4, 2010 at 18:12 Comment(1)
I've downvoted this because it is a poor answer to the question, it does nothing to explain to the OP what the differences may be.Donadonadee
D
2

A communicator contains group(s) while a group is just a collection of processes.

If a communicator contains just one group, it is called an intracommunicator (the communicator, MPI_COMM_WORLD is one such which refers to one group which includes all the ranks).

If it contains two groups, it is called in intercommunicator (there are none created by default for you).

Take a look at https://computing.llnl.gov/tutorials/mpi_advanced/DavidCronkSlides.pdf where he gives a very good pictorial explanation of how a communicator is a container for one or two groups.

Divisibility answered 3/12, 2014 at 14:22 Comment(0)
P
2

A group in MPI corresponds to the mathematical concept "set", which is introduced in MPI to facilitate organizing processes and creating new communications. For example you can use the union and intersection operations on sets to create new sets so that you can use them to create new communicators.

A group has nothing to do with communications although a group can be used to create a communicator (a communicator is a group plus a context).

A group can also be used as an ID in distributing task/data among different processes. For instance, we can test whether a process is in a group to determine whether it should do something.

Petr answered 25/7, 2018 at 15:14 Comment(0)
S
-1

A communicator is an object describing a group of processes. In many applications all processes work together closely coupled, and the only communicator you need is MPI_COMM_WORLD .

group describing all processes that your job starts with.

Slacken answered 15/7, 2018 at 11:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.