

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An assignment for a parallel computing course, where students are required to implement four parallel sorting algorithms using mpi for communication. The algorithms include parallel quicksort, hyperquicksort, parallel sorting by regular sampling, and one other comparison-based algorithm. Students must create the necessary files, compile the code, and run it with the provided command. The assignment includes instructions on generating random integers, dividing the data among processors, and outputting the required results.
Typology: Assignments
1 / 2
This page cannot be seen from the preview
Don't miss anything!


Spring 2007
Assignment 2
Due: 6 Apr 2007
Problem: In this assignment, you will implement four parallel sorting algorithms using MPI.
Parallelization: Implement the following four parallel sorting algorithms using MPI for communication.
Files: You should create a directory called hw2 on the p690 at NCSA, containing the following files:
Running the code: Code will be run as follows:
poe sort [] –procs
In the above line, __ refers to the number of processors. The algorithm to use for sorting will be specified by __ ; _ = 1_ for the method 1 , 2 for method 2 , 3 , for method 3 , and 4 for method 4. The total number of (long) integers to sort is specified by __ , which will be at least 1. You should generate the random integers as follows. Use srand48 to seed the random number generator using __ (which is a long integer) as the seed. Then generate __ random integers using lrand48. (Remember to include the header file stdlib.h .) The __ integers should initially be divided by having each processor get floor((double)
/) or ceil((double) / )
Example: poe sort 1 5 8 2 1 3 –procs 2
The random numbers generated by srand48 will be as follows, using 8 as the seed: 294734626, 830272356, 8452830, 1276961749, 1036785092. The program will run parallel quicksort on two processors. The output will be as follows (the time taken may differ – everything else should be exactly as given here).
Time = 2.86102e-5 s 294734626 8452830 830272356
Code organization: The basic code (in sort.c ) should be organized as follows.
Turning in your assignment: All your files should have a time stamp before midnight, 6 Apr
Grading: You will be graded on the following (i) correctness of your codes, (ii) performance of your codes, especially relative to those of others in the class, and (iii) coding style. Good performance on method 4 is especially important. In the other methods, your implementation should not perform considerably worse than is possible. In method 4 , your grade for performance will depend on how it compares with the best in the class, for large input sizes.