parrelle computing

profilemilkshak38
cassandrawatsonITS470-HW6.docx

ITS 470

Homework 6

Please put Course number, your Full Name, Assignment number on top right. Submit your homework on Blackboard. Please name your file as “ITS470HW6FirstNameLastName.(doc or docx)”. You should submit all source codes, script files, and all output files from job submission. Documentation is important. The more clear and detail documentation is a good way to earn better grade.

1. In given code “mpi-pi.c”, the jobs are distributed in cyclic manner. Modify the code that distributes the job using block partition, which assigns a set of consecutive jobs to each process. For example, if there are 40 jobs and 4 processes, distribute 10 jobs to each process such as 1 to 10 to process 0, 11 to 20 to process 1, 21 to 30 to process 2, and 31 to 40 to process 3. For the simplicity, assume that user inputs the number of steps that is the multiple of the number of processes. For example, if the number of processes is 4, the number of steps should be multiple of 4 such as 16, 100, 200, 10000, etc. Your code should dynamically distribute the same amount of jobs over the number of available processes. Explain your job distribution method as detail as possible. In addition, your code should be well documented. (20 points)

2. Re-write pi estimation code using MPI_Send and MPI_Recv communication functions only. You can download sample code at course website called “mpi-pi.c”. Explain how you did in word here and it should be documented in your code. (Hint: Process 0 receives all partial local results and computes the estimating pi) (20 points)

3. Use given “mpi-pi.c” code, modify it to compute and print the elapsed time at process 0 using Wtime( ) function. Then, choose the large number of steps (i.e., n = 2,000,000,000) and run the program by use of 1, 4, 8, and 16 processes to find each corresponding elapsed time. Do this with the small number of steps (i.e., 200) to find the elapsed time at each number of processes. Plot both results on one graph to observe and compare the relationship between the number of processes and elapsed time for each number of steps. Use the plot to write your observation and comparison. (30 points)

4. Following information is given to create the graph and use them to draw the graph topology.

number of node = 4, index[4] = {2, 4, 6, 8}, edges[8] = {2, 3, 2, 3 , 0, 1, 0, 1}. (10 points)

5. Write the code using MPI_Comm_split routine to divide a group and create communicator such that:

all processes with even ranks are in one group

all processes with odd ranks are in the other group

maintain the reverse order by rank

Your output should display each process’s group number, rank from original communicator, new rank from new communicator. (10 points)