I Example: Send and Receive In this program, process 0 sends a message to process 1 and process 1 receives it. note the use of myrank in a conditional to limit execution of code to a particular process /* simple send and receive * Include <stdio. h> #include <mpi.h> void main (int argc, char **argv) t int myrank; MP工 Status status; double a[100]; MPI Init(sagc, cargo);/*工 nitia1 ize MP工* MPI Comm rank(MPI COMM WORLD, &myrank);/* Get rank * if( myrank ==0 /* Send a message * MPI Send( a, 100, MPI DOUBLE, 1, 17, MPI COMM WORLD else if( myrank = 1 / Receive a message * MPI Recv( a, 100, MPI DOUBLE, 0,17, MPI COMM WORLD, &status )i MPI Finalize)i /* Terminate MPI *Example: Send and Receive • In this program, process 0 sends a message to process 1, and process 1 receives it. Note the use of myrank in a conditional to limit execution of code to a particular process. /* simple send and receive */ #include <stdio.h> #include <mpi.h> void main (int argc, char **argv) { int myrank; MPI_Status status; double a[100]; MPI_Init(&argc, &argv); /* Initialize MPI */ MPI_Comm_rank(MPI_COMM_WORLD, &myrank); /* Get rank */ if( myrank == 0 ) /* Send a message */ MPI_Send( a, 100, MPI_DOUBLE, 1, 17, MPI_COMM_WORLD ); else if( myrank == 1 ) /* Receive a message */ MPI_Recv( a, 100, MPI_DOUBLE, 0, 17, MPI_COMM_WORLD, &status ); MPI_Finalize(); /* Terminate MPI */ }