Question: /* - Process 0 sends x to process 1 and y to processes 2. 1, MPI_INT indicates that the message consists of one integer. -

/* - Process 0 sends x to process 1 and y to processes 2. "1, MPI_INT" indicates that the message consists of one integer. - Processes other than rank 0 wait to receive a message using MPI_Recv. The "0, 0" indicates that the message is expected from process 0 and should have the tag 0. The result is stored in the number variable. */
#include
int main(int argc, char** argv) { int size, rank;
MPI_Init(NULL, NULL); MPI_Comm_size(MPI_COMM_WORLD, &size); MPI_Comm_rank(MPI_COMM_WORLD, &rank); if(size != 2) { if(rank == 0) { printf("This program needs to run on exactly 3 processes "); } } { { int ball = 0; MPI_Send(ball, 0, MPI_INT, 1, 0, MPI_COMM_WORLD); } else { int number; MPI_Recv(&number, 1, MPI_INT, 0, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE); printf("Process %d received %d ", rank, number); } } MPI_Finalize();
return 0; }
my program has errors as you can see shown in the first screenshot below I am using thinlinc could you correct them please
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
