1997-98 CS 284a

Homework Two: Multithreaded Matrix Multiplication

Handed out: Wednesday, 22nd October 1997.
Due in: 5:00pm, Friday, 31st October 1997.

Introduction

Starting with the program provided, use the sthread_regular_for_loop() function to develop a correct and efficient multithreaded matrix multiplication function. The program consists of three files: matrix_multiply.h, matrix_multiply.c, and main.c. Write the multithreaded matrix multiplication function in matrix_multiply.c. Use the main program provided to test and time your multithreaded matrix multiplication function.

What to hand in

  1. Hand in your modified matrix_multiply.c file.
  2. Time sequential and multithreaded matrix multiply of 700-by-700 element matrices using 1, 2, 4, 8, 16, 32, 64, 96, and 128 threads on 4 processors. Hand in a table giving the execution time and speedup of multithreaded matrix multiply over sequential matrix multiply for increasing number of threads. Hand in a graph showing speedup of multithreaded matrix multiply over sequential matrix multiply for increasing number of threads.
  3. Using the best number of threads from part 2, time multithreaded matrix multiply of 700-by-700 element matrices on 1, 2, 3, and 4 processors. Hand in a table giving the execution time and the speedup of multithreaded matrix multiply over sequential matrix multiply for increasing number of processors. Hand in a graph showing speedup of multithreaded matrix multiply over sequential matrix multiply for increasing number of processors.
  4. Using the best number of threads from part 2, time sequential and multithreaded matrix multiply of 500-by-500, 600-by-600, 700-by-700, 800-by-800, and 900-by-900 element matrices on 4 processors. Hand in a table giving the execution time and the speedup of multithreaded matrix multiply over sequential matrix multiply for increasing number of items. Hand in a graph showing speedup of multithreaded matrix multiply over sequential matrix multiply for increasing number of items.
  5. Hand in a short written performance analysis, discussing the issues that limit the speedup of multithreaded matrix multiply. Quantitatively estimate the overheads of thread management, load imbalance, and memory contention.

Notes

Grading

Your homework will be graded out of 20 points as follows:

You must follow the style of maintaining equivalent pragma and Sthreads versions of multithreaded functions.

Double your best speedup for multiplying 600-by-600 element matrices.

Tables and graphs must be complete and well presented.

Your analysis must be accurate and insightful.