In a point to point communication in MPI, one node (processor) issues an MPI_Send message to another node that uses MPI_Recv to obtain the message.
In the example MPI_Send (C version) command below, identify what each of the six parameters represents. ("&" in C means "address of").
For help see
MPI Routines
MPI_Send(&pi, count, MPI_DOUBLE, 0, 10, MPI_COMM_WORLD);
List the meaning of each parameter -
&pi:
count:
MPI_DOUBLE:
0:
10:
MPI_COMM_WORLD: (see Constants in the MPI Routines link above)
In the example MPI_Recv (C version) command below, identify what each of the parameters represents.
MPI_Recv(&pi, 1, MPI_DOUBLE, 1, 10, MPI_COMM_WORLD, &status);
&pi:
count:
MPI_DOUBLE:
0:
10:
&status - for MPI_Status see the constants and scroll down to find MPI_Status
Define the parameters in the MPI_Bcast below:
MPI_Bcast(&pi, 1, MPI_DOUBLE, source, MPI_COMM_WORLD);
&pi:
1:
source:
In the code below, the MPI_Bcast is not in the if statement, so all of the processes see the MPI_Bcast.
count = 1;
source = 0;
if (rank == source) {
pi = M_PI;
printf("Rank %d is broadcasting %.10f\n", rank, pi);
}
MPI_Bcast(&pi, 1, MPI_DOUBLE, source, MPI_COMM_WORLD);
if (rank != source) {
printf("Rank %d receives %.10f from process %d\n", rank, pi, source);
}
Question: How does a process know whether it is sending or receiving the value of pi?