Question: CSC461/561 Parallel HPC (Spring 2018) Homework 6 (60 points) Due: Friday, April 27, 2018 by 11:59PM (via Blackboard) NAME: Write a MPI program to pass

 CSC461/561 Parallel HPC (Spring 2018) Homework 6 (60 points) Due: Friday,

CSC461/561 Parallel HPC (Spring 2018) Homework 6 (60 points) Due: Friday, April 27, 2018 by 11:59PM (via Blackboard) NAME: Write a MPI program to pass a message around a ring of processors. The message should start and finish at process 0 (rank 0). Initially, your program should have the main process (rank 0) initialize an integer value to 0. This value will be sent around the ring. Prior to sending the message to it's neighbor the sending process should add 2 times it's rank to the value received Rank-0 initializes integer to send to neighbor to 0. It adds 2 times its rank (which is 0) to the value before sending (still 0), so it sends a 0 to rank-1 Rank-1 receives the integer from rank 0 (value 0) and adds 2 times its rank (2* 1 2) to the value it received resulting in a value of 2, which is sent to rank-2. This process continues until the message is received back at Rank-0. Once rank-0 receives the result it should just print out the final value. Remember, the number of processes created is specified by the mpirun command. If the program was run as follows: mpirun -np n your program name> n processes would be created, ranks 0 through n-1, and the message should start at rank-0, proceed through each of the ranks 1 (n-1), and finally back to rank-0. Note: this program is based on the example we went over in our last2 classes CSC461/561 Parallel HPC (Spring 2018) Homework 6 (60 points) Due: Friday, April 27, 2018 by 11:59PM (via Blackboard) NAME: Write a MPI program to pass a message around a ring of processors. The message should start and finish at process 0 (rank 0). Initially, your program should have the main process (rank 0) initialize an integer value to 0. This value will be sent around the ring. Prior to sending the message to it's neighbor the sending process should add 2 times it's rank to the value received Rank-0 initializes integer to send to neighbor to 0. It adds 2 times its rank (which is 0) to the value before sending (still 0), so it sends a 0 to rank-1 Rank-1 receives the integer from rank 0 (value 0) and adds 2 times its rank (2* 1 2) to the value it received resulting in a value of 2, which is sent to rank-2. This process continues until the message is received back at Rank-0. Once rank-0 receives the result it should just print out the final value. Remember, the number of processes created is specified by the mpirun command. If the program was run as follows: mpirun -np n your program name> n processes would be created, ranks 0 through n-1, and the message should start at rank-0, proceed through each of the ranks 1 (n-1), and finally back to rank-0. Note: this program is based on the example we went over in our last2 classes

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!