What does this sentence in the OpenMPI documentation mean?

Viewed 17

In the documentation of OpenMPI one can read the following sentence in the "When communicator is an Inter-communicator"-section:

The send buffer argument of the processes in the first group must be consistent with the receive buffer argument of the root process in the second group.

This section only appears in the documentation of non-blocking functions. In my case this is MPI_Igatherv.

I have an Inter-communicator connecting two groups. The first group contains only one process, which is a master (distributing and collecting data). The second group contains one or more worker processes (receiving data, doing work and sending results back). All the workers have the same code and the master has its own separate code. The master starts the workers with MPI_Spawn.

However I am concerned, I am not using the function call correctly.

As the master tries to receive data, I use the following code:

MPI_Igatherv(nullptr, 0, MPI_DOUBLE, recv_buf, sizes, offsets, MPI_DOUBLE, MPI_ROOT, inter_comm, &mpi_request);

The master does not contribute any data, so the send buffer here is a nullptr with zero size.

On the other hand, all workers send data like this:

MPI_Igatherv(send_buf, size, MPI_DOUBLE, nullptr, nullptr, nullptr, MPI_DOUBLE, 0, inter_comm, &mpi_request);

The workers do not receive any data, so the receive buffer is a nullptr with no sizes or offsets.

Is this the correct way?

0 Answers
Related