Everything is one question It\'s for paralllel computing I need an expert so I c
ID: 3857920 • Letter: E
Question
Everything is one question It's for paralllel computing I need an expert so I can learn from you So I can apply in different codes After all you are one with a degree and I am not Thank u Everything is one question It's for paralllel computing I need an expert so I can learn from you So I can apply in different codes After all you are one with a degree and I am not Thank u A lot my professor is terrible But I am trying my best to learn this 1 Write a program which runs on two processes, Process 1 sends string Greetings from Process 1 to Process 0, and Process 0 prints out the message 2 Modify the above program so that Process 0 also sends string Greetings from Process 0 to Process 1. 3 Modify the program so that it involves 3 processes and the message passing is in the ring pattern 012 ring pattern 0Explanation / Answer
# include # include # include int main ( int argc, char *argv[] ); void ring_io ( int p, int id ); /******************************************************************************/ int main ( int argc, char *argv[] ) /******************************************************************************/ /* Purpose: MAIN is the main program for RING_MPI. Discussion: RING_MPI sends messages of various size from process 0 to 1 to 2 to ...the last process and then back to 0. */ { int error; int id; int p; /* Initialize MPI. */ MPI_Init ( &argc, &argv ); /* Get the number of processes. */ MPI_Comm_size ( MPI_COMM_WORLD, &p ); /* Get the individual process ID. */ MPI_Comm_rank ( MPI_COMM_WORLD, &id ); /* Print a message. */ if ( id == 0 ) { printf ( " " ); printf ( "RING_MPI: " ); printf ( " C/MPI version " ); printf ( " Measure time required to transmit data around " ); printf ( " a ring of processes " ); printf ( " " ); printf ( " The number of processes is %d ", p ); } ring_io ( p, id ); /* Shut down MPI. */ MPI_Finalize ( ); /* Terminate. */ if ( id == 0 ) { printf ( " " ); printf ( "RING_MPI: " ); printf ( " Normal end of execution. " ); } return 0; } /******************************************************************************/ void ring_io ( int p, int id ) /******************************************************************************/ /* Purpose: RING_IO carries out the tasks of process ID, of a total of P processes. { int dest; int i; int j; int n; int n_test[5] = { 100, 1000, 10000, 100000, 1000000 }; int n_test_num = 5; int source; MPI_Status status; double tave; int test; int test_num = 10; double tmax; double tmin; double wtime; double *x; if ( id == 0 ) { printf ( " " ); printf ( " Timings based on %d experiments ", test_num ); printf ( " N double precision values were sent " ); printf ( " in a ring transmission starting and ending at process 0 " ); printf ( " and using a total of %d processes. ", p ); printf ( " " ); printf ( " N T min T ave T max " ); printf ( " " ); } /* Choose message size. */ for ( i = 0; iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.