CS735/CS835 Programming Assignment 2 (due Sun Oct 5)


This program concerns the parallel implementation of matrix multiplication (C = A x B) using threads.

Write a threads program to parallelize the serial program (matrix0.c) found in ~cs735/public/mm.

This serial program includes code for initializing the matrices to be multiplied and code for computing a simple checksum for checking the results. The performance of these two steps is not important. You are only responsible for improving the performance of the matrix multiply step itself.

To receive 75% of the credit: Provide a parallel implementation of matrix multiply based upon assigning rows (or columns) to threads. Call your program pmatrix75.c.

To receive 85% of the credit: Provide a parallel implementation of matrix multiply based upon assigning two-dimensional sub-matrices to threads. Call your program pmatrix85.c.

To receive 100% of the credit: Experiment with your 75% and 85% programs to try to improve cache behavior. For example, you might try transposing the B matrix before starting the computation. And, in the 85% program try making the sub-matrix size match the available cache size (possibly by altering the number of threads used). The goal is to find the fastest possible matrix multiplication program.

Place your parallel implementation in the file pmatrix.c.

Experiment with your pmatrix75.c and pmatrix85.c programs using (at least) 1, 2, 4 and 8 threads on agate.cs.unh.edu. Use matrices of size 128 and 256 for the final experiment. (At the 100% level you may need to use size 512, too.) Report on your running times, compute speedup numbers, and analyze any trends that you recognize in the data you collect. (Be sure to consider whether you are using the correct serial program when computing the speedup.) 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.

Submitting your assignment: To receive full credit for the assignment, you must turn in your files prior to 8am on Monday October 6. 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 pmatrix75.c pmatrix85.c

NOTE: You must submit your assignment for grading from agate.cs.unh.edu. Submissions can be checked using ~cs735/bin/scheck. For example, to check your assignment:

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

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

Also: you should adequately document and structure your programs.


Last modified on September 29, 1997.

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