Starting from:
$35

$29

Homework 3 (MPI Programming) Solution

The objective of this programming assignment is to get you familiar with MPI programming.

Specifically, you will need to write a MPI program for the prefix sum problem:




Given a sequence of numbers x1, x2, ..., xn, the prefix sums are the partial sums




s1 = x1

s2 = x1 + x2

...

sn = x1 + x2 + ... + xn




You should write a MPI program to compute the prefix sums on Comet@SDSC.




 
Your program should be able to use a variable, user-specified, number of processors. For example, the user should be able to run the program using any number of processors between 1 and 16. The number of processors can either be selected using a command line argument or the program can prompt the user.




 
Your program should be able to sum a variable, user-specified, number of integers. The integers in the input sequence should be randomly generated inside your program. That is, the user will input n, and the program will then randomly generate n numbers.




 
Your program should print out (either to the standard output or to a file) the prefix sums computed. It should also print out the original input.




 
Your program should print timing statistics. In particular, you should print out the elapsed time taken to compute the prefix sums, i.e., do not include the time taken to generate the input sequence (or at least account for it separately).




Submission:

 
You should put your source code (.c file) and documents into a .zip or .tar file, and upload it on




theBlackboard.Thenameof.zipor.tarshouldfollowtheformat:

CS546_LastName_FirstName_HW3.




 
The document should include a design report (in PDF) explaining what algorithm you have implemented to compute the prefix sums and any relevant implementation details. You should also describe how you guarantee the correctness of your coding.




 
A README file is required to explain how to compile and run your programs, executables compiled on comed@sdsc.




 
You should also include a result report (in PDF) to list the runtimes for 1, 2, 4, 8, 12 and 16 processors. Evaluate the performance of your implementation. USE THE MPI TIMERS FOR PORTABILITY, i.e. the MPI_Wtime() calls even though this measures elapsed times and not CPU times.










1




Note on cheating: This is an individual assignment. Copying problem solutions or code is cheating. Both the person copying and the person giving the answers will be equally penalized. Make sure you do your own work.



























































































































































































2

More products