0
votes

I am trying to implement the MPI protocol in EPOS Operation System. Well, in fact I didn't understand how to implement the MPI_Comm. It is defined as "basic object used by MPI to determine which processes are involved in a communication". In some implementations that I found on Internet it is implemented as typedef int MPI_Comm, but how could I know which process are involved in a communication using int MPI_Comm? Any idea?

Thanks.

2

2 Answers

1
votes

There seem to be two approaches, which are almost the same.

  • The first is to typedef int MPI_Comm, and use the value as an index into some internal data structure that maintains the actual information.

  • The second is to typedef struct comm_info* MPI_Comm where the communicator (or any other MPI type) is a direct pointer to the internal structure. OpenMPI takes this approach.

The advantage of using an int is that it might be easier to use the same indices on all processors as long as the internal data struct is synchronized.

But why re-invent the wheel when OpenMPI and MPICH already do so much and are open source? The MPICH license in particular is extremely permissive. So much so that quite a few of the vendors base their own commercial MPI libraries on it. Check out their license.

0
votes

When an implementation uses an int for an MPI_Comm, it's actually using it as a reference to an internal array where it keeps track of all of the necessary information for the communicator internally.