CS735/CS835 Programming Assignments


All programming assignments must be submitted for grading from agate.cs.unh.edu. Check below for the details on submitting each assignment. Submissions can be checked using ~cs735/bin/scheck. For example, to check on assignment one:

    ~cs735/bin/scheck prog1
The scheck program can only be executed on agate.cs.unh.edu.

Program One - Due Sunday September 22

This assignment involves solving a combinatorial search problem using threads.

To receive 75% of the credit: Write a threads program to parallelize the serial program (color.c) found in ~cs735/public/color. Keep one global priority queue of states and one global data structure for tracking the best solution found so far. Place your program in the file color75.c.

Two test files will be distributed in ~cs735/public/color: sample_input and larger_input. Use sample_input when debugging. Use larger_input when analyzing the performance of your program.

Experiment with your color75.c using 1, 2, 3, 4, and more threads on agate.cs.unh.edu. Report on your running times, compute speedup numbers, and analyze any trends that you recognize in the data you collect. What are the limitations, if any, of color75.c? Place your findings in the "flat" Ascii file named FINAL-REPORT.

To receive 85% of the credit: In addition to obtaining the 75% level, modify your program for the 75% level to distribute the priority queue of states among the threads. That is, eliminate the global queue and have all threads manage their own priority queues. Implement one of the schemes described in class or in the textbook for distributing states among the threads. Be careful how you handle thread termination. Place your program in the file color85.c.

Experiment with your color85.c using 1, 2, 3, 4, and more threads on agate.cs.unh.edu. Report on your running times, compute speedup numbers, and analyze any trends that you recognize in the data you collect. How does color85.c compare to color75.c? Place your findings in the "flat" Ascii file named FINAL-REPORT.

To receive 100% of the credit: In addition to obtaining the 85% level, modify your programs for the 75% and 85% levels, as well as the serial program, to use a better implementation for the priority queue. (The priority queue is currently being maintained using insertion sort.) Place your modified programs in the files ncolor.c, ncolor75.c, and ncolor85.c.

Redo the experiments of the 75% and 85% levels using the modified programs. Again report and analyze the results. What is the difference in how the modified programs perform? As before, place your findings in the "flat" Ascii file named FINAL-REPORT.

Submitting your assignment: To receive full credit for the assignment, you must turn in your files prior to 8am on Monday September 23. Late submissions will be accepted at the penalty of 5% per day up to one week late. To turn in this assignment, type (on agate.cs.unh.edu)

   ~cs735/bin/submit prog1 FINAL-REPORT color*5.c ncolor.c ncolor*5.c

Remember: as always you are expected to do your own work on this assignment.

Also: you should adequately document and structure your programs.

Finally: your final report should clearly indicate what level of the assignment has been completed.

Program Two - Due Sunday October 20

This program concerns the implementation of a linear system solver using message passing.

Write a message-passing program to parallelize the serial program (gaussian.c) found in ~cs735/public/gaussian. You should use the NXS message-passing library and you should execute your program on the Galaxy cluster.

The distributed source code contains a serial solver based upon Gaussian elimination and back substitution. This serial program includes code for initializing a matrix to be solved and for checking the results. The performance of these two steps is not important. You are only responsible for improving the performance of the system solver itself.

To receive 75% of the credit: Provide a parallel implementation of the Gaussian elimination phase.

To receive 85% of the credit: Provide a parallel implementation of both the Gaussian elimination phase and the back substitution phase.

To receive 100% of the credit: Provide a parallel implementation of both the Gaussian elimination phase and the back substitution phase that utilize reduction operations that are implemented using "Log P" algorithms.

Place your parallel implementation in the file pgauss.c.

Experiment with your pgauss.c using 1, 2, 3, 4, 5, 6, 7 and 8 processors on the Galaxy cluster. Solve a system of 1024 equations for the final experiment. (The distributed code solves 256 equations, which is fine for debugging your program.) Report on your running times, compute speedup numbers, and analyze any trends that you recognize in the data you collect. Place your findings in the "flat" Ascii file named FINAL-REPORT. Also document in this report the basic design of your parallel program and clearly indicate what level (75%, 85% or 100%) of the assignment you have obtained.

If you only do the 75% level, then you will need to develop a means to determine if your program is working correctly. This probably will involve printing the "eliminated matrix" in both the serial program and the parallel program and then checking the results by hand.

Submitting your assignment: To receive full credit for the assignment, you must turn in your files prior to 8am on Monday October 21. Late submissions will be accepted at the penalty of 5% per day up to one week late. To turn in this assignment, type (on agate.cs.unh.edu)

   ~cs735/bin/submit prog2 FINAL-REPORT pgauss.c

Remember: as always you are expected to do your own work on this assignment.

Also: you should adequately document and structure your programs.

Program Three - Due Sunday November 3

This program concerns the implementation of an edge detection algorithm using C*. Write a C* program for the Sobel edge detection algorithm. A serial implementation of the algorithm is given in ~cs735/public/sobel. A stub for the C* program is in ~cs735/public/sobel/psobel.

These programs read and write image data in the PGM format. The C* stub program includes functions for reading and writing PGM files. The input functions will create a 2D shape with a position for each pixel in the image. The input functions will then read the image data into a parallel variable of the created shape. Output functions create an appropriate PGM file from the image data in a parallel variable.

Your task is to implement the do_sobel function in main.cs.

PGM files may be displayed using xv. Two PGM files are being distributed for testing: einstein.pgm and fish.pgm. Use the fish image when you are debugging your program. Use the Einstein image for performing your final timings.

To receive 75% of the credit: Provide a correct C* implementation of the Sobel algorithm. Analyze your code to be sure that your program is appropriately utilizing the C* virtual machine. (Simply submitting a serial solution is not acceptable!)

To receive 85% of the credit: Provide a correct C* implementation of the Sobel algorithm that shows improving performance on the Galaxy cluster as more processors are used.

To receive 100% of the credit: Provide a correct C* implementation of the Sobel algorithm that shows actual speedup (measured against the serial program) on the Galaxy cluster. The speedup should improve as more processors are used.

Submit for grading your modified main.cs.

Experiment with your program using 1, 2, 4 and 8 processors on the Galaxy cluster. Use the Einstein image for these experiments. Report on your running times, compute speedup numbers, and analyze any trends that you recognize in the data you collect. Place your findings in the "flat" Ascii file named FINAL-REPORT. Clearly indicate in your report what level (75%, 85% or 100%) of the assignment you have obtained.

Submitting your assignment: To receive full credit for the assignment, you must turn in your files prior to 8am on Monday November 4. Late submissions will be accepted at the penalty of 5% per day up to one week late. To turn in this assignment, type (on agate.cs.unh.edu)

   ~cs735/bin/submit prog3 FINAL-REPORT main.cs

Remember: as always you are expected to do your own work on this assignment.

Also: you should adequately document and structure your program.


Last modified on October 17, 1996.

Comments and questions should be directed to pjh@cs.unh.edu