Docsity

Programming Project 4 - Advanced Parallel Programming | CS 515, Study Guides, Projects, Research of Computer Science

Toggle sidebar
bg1
Spring ’09: CS415/515 Advanced Parallel Programming 5/21/09
Prof. Ji ngke Li(FAB 120-06, [email protected]); Classes: TTh noon-1:50pm @ FAB150; Office Hours: TTh 10-11am.
Programming Project #4
(Due Thursday, 6/04/09 @ noon, — Firm Deadline!)
This project is to implement a sorting algorithm and to collect and analyze timing data from its execution.
Description
Your task is to implement a sorting algorithm to sort integer data from an input file into an ascending order
and write to an output file. You have freedom in choosing the algorithm and the platform.
•Algorithm — You may choose any parallel sorting algorithm to implement. If you choose a fine-
grained algorithm, such as parallel bubble sort or odd-even transposition sort, you need to develop a
reasonably good coarse-grained version of it.
•Platform — You may choose to implement your algorithm either on a shared-memory platform or
on a message-passing platform. If you choose the shared-memory platform, you need to implement the
algorithm with both Pthreads and OpenMP, and compare the performances of the two versions. If you
chose the message-passing platform, you only need to implement one MPI version.
•Program — Regardless of your platform choices, the sorting program should be implemented in the
SPMD style. It should take two command-line arguments, i.e. the names of the input and output files,
respectively. The program should reads data from the input file; sort it into an ascending order; and
writes the result to the output file.
•Data File Format — The data to be sorted are four-byte unsigned integers. Both the input and
output files are byte files of the same format: The very first four bytes of an input/output file consists
of an unsigned long integer value representing the number of records in the file. After these four bytes,
records are simply laid out one after another.
•I/O Handling — With all the three tools, Pthreads, OpenMP, and MPI, individual thread/host is
capable of performing file I/O. Therefore, I’ll leave the choices of I/O handling to you. You may decide
to have a single thread/host do the I/O, or you may decide to let everyone do their part. Some of
the considerations are: How to minimize memory buffer size? How to guarantee data ordering in the
output file?
•Timing — Insert timing routines in your program to collect timing data. For MPI programs, use
MPI Wtime() routine; for Pthread/OpenMP programs, use Unix’s gettimeofday() routine. We are
interested in measuring two versions of total elapsed time: (a) one that includes everything, and (b)
one that excludes I/0. Find the right points to insert the timing routine calls for these measurements.
•Execution — Your program should work correctly with any number of threads (or hosts), including
the case of just one thread, and any size of of data file. The workload among the threads need to be
roughly balanced.
•Performance Study — Run your program with different input data sizes, including at least 10,000,
50,000, and 100,000 record cases. For each data size, try the program with different number of
hosts/threads, including at least, 1, 2, 4, and 8.
•Report — Write a summary report covering the following topics:
–The algorithm — What algorithm did you implement? Why did you choose this algorithm?
1
pf2

Partial preview of the text

Download Programming Project 4 - Advanced Parallel Programming | CS 515 and more Study Guides, Projects, Research Computer Science in PDF only on Docsity!

Spring ’09: CS415/515 Advanced Parallel Programming 5/21/ Prof. Jingke Li(FAB 120-06, [email protected]); Classes: TTh noon-1:50pm @ FAB150; Office Hours: TTh 10-11am.

Programming Project

(Due Thursday, 6/04/09 @ noon, — Firm Deadline!)

This project is to implement a sorting algorithm and to collect and analyze timing data from its execution.

Description

Your task is to implement a sorting algorithm to sort integer data from an input file into an ascending order and write to an output file. You have freedom in choosing the algorithm and the platform.

  • Algorithm — You may choose any parallel sorting algorithm to implement. If you choose a fine- grained algorithm, such as parallel bubble sort or odd-even transposition sort, you need to develop a reasonably good coarse-grained version of it.
  • Platform — You may choose to implement your algorithm either on a shared-memory platform or on a message-passing platform. If you choose the shared-memory platform, you need to implement the algorithm with both Pthreads and OpenMP, and compare the performances of the two versions. If you chose the message-passing platform, you only need to implement one MPI version.
  • Program — Regardless of your platform choices, the sorting program should be implemented in the SPMD style. It should take two command-line arguments, i.e. the names of the input and output files, respectively. The program should reads data from the input file; sort it into an ascending order; and writes the result to the output file.
  • Data File Format — The data to be sorted are four-byte unsigned integers. Both the input and output files are byte files of the same format: The very first four bytes of an input/output file consists of an unsigned long integer value representing the number of records in the file. After these four bytes, records are simply laid out one after another.
  • I/O Handling — With all the three tools, Pthreads, OpenMP, and MPI, individual thread/host is capable of performing file I/O. Therefore, I’ll leave the choices of I/O handling to you. You may decide to have a single thread/host do the I/O, or you may decide to let everyone do their part. Some of the considerations are: How to minimize memory buffer size? How to guarantee data ordering in the output file?
  • Timing — Insert timing routines in your program to collect timing data. For MPI programs, use MPI Wtime() routine; for Pthread/OpenMP programs, use Unix’s gettimeofday() routine. We are interested in measuring two versions of total elapsed time: (a) one that includes everything, and (b) one that excludes I/0. Find the right points to insert the timing routine calls for these measurements.
  • Execution — Your program should work correctly with any number of threads (or hosts), including the case of just one thread, and any size of of data file. The workload among the threads need to be roughly balanced.
  • Performance Study — Run your program with different input data sizes, including at least 10,000, 50,000, and 100,000 record cases. For each data size, try the program with different number of hosts/threads, including at least, 1, 2, 4, and 8.
  • Report — Write a summary report covering the following topics:
    • The algorithm — What algorithm did you implement? Why did you choose this algorithm?
  • Implementation — Given a brief description of your program’s organization. Did you encounter any difficulties in the implementation?
  • Timing Results — Tabulate your timing results nicely. What is the expected performance of the algorithm? Did you observe that performance from the measured performance data? Did you observe any speedup when running the program on more hosts? Explain why the observed performance is what it is.
  • General comments — Do you have any advice for people who wants to sort a large number of records? What’s your recommendation on algorithms, number of hosts, and number of processes?

Additional Information

  • Utility Routines — A pair of programs, datagen.c and verify.c, are provided to you for dealing with data files. datagen is a simple random data generator. It takes an integer command-line argument, N, and generates N random four-byte values, which can be saved in a data file:

datagen 1024 > data1k

verify is a result-verifying program. It can be used to verify that the four-byte values in a given data file are sorted in an ascending order:

verify

Finally, there is a Unix/Linux utility, od, that can be used to view the content of a byte file: od -t u1 < datafile — translates each byte in datafile into an unsigned integer; od -t u4 < datafile — translates each four-byte group in datafile into an unsigned integer.

  • For the Shared-Memory Version — You may write separate programs for the Pthread version and the OpenMP version. The timing study must be conducted on Cepheus, the 8-core Sun server machine.
  • For the MPI Version — You need to use MPI’s file I/O routines. We’ll cover them in class, but you may also want to look up more info online.
  • Grading — Normal criteria apply (i.e. correctness, performance, and report). Undergraduates will be graded more leniently. Extra credits may be awarded to exceptionally good or challenging projects.

What to Turn In

Zip your program(s) and the summary and submit it to [email protected].