Question: Hello, please, I am trying to write an MPI program where P0 send messages to the even processes and P1 sends to the odd processes.

Hello, please, I am trying to write an MPI program where P0 send messages to the even processes and P1 sends to the odd processes. P0 cannot send to itself as even and neither can P1 send to itself as odd. It must start from P2. Thank you. Hello, please, I am trying to write an MPI program where P0
send messages to the even processes and P1 sends to the odd
Hello. That is the code given. At the bottom, after the return 0 is the closed curly braces. Nothing else was given in the code. It works when i run it, I'm just not getting the correct values.
But if I may ask, what do you think is missing. Thank you.

#include #include /* For strlen */ #include /* For MPI functions, etc */ const int MAX_STRING = 100; int main(void) { char greeting[MAX_STRING]; int comm_sz; /* Number of processes */ int my_rank; /* My process rank */ MPI_Init(NULL, NULL); MPI_Comm_size(MPI_COMM_WORLD, &comm_sz); MPI_Comm_rank (MPI_COMM_WORLD, &my_rank); if (my_rank != 0) sprintf (greeting, "Greetings from process %d of %d! ", my_rank, comm_sz); MPI_Send (greeting, strlen( greeting)+1, MPI_CHAR, 0, 0, MPI_COMM_WORLD); } else { printf ("Greetings from process $d of %d ", my_rank, comm_sz); int g; for (g = 1; g /* For strlen */ #include /* For MPI functions, etc */ const int MAX_STRING = 100; int main(void) { char greeting[MAX_STRING]; int comm_sz; /* Number of processes */ int my_rank; /* My process rank */ MPI_Init(NULL, NULL); MPI_Comm_size(MPI_COMM_WORLD, &comm_sz); MPI_Comm_rank (MPI_COMM_WORLD, &my_rank); if (my_rank != 0) { sprintf (greeting, "Greetings from process %d of %d! ", my_rank, comm_sz); MPI_Send( greeting, strlen(greeting)+1, MPI_CHAR, 0, 0, MPI_COMM_WORLD); } else { printf("Greetings from process $d of %d ", my_rank, comm_sz); int ; for (g = 1; g

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!