DOC PREVIEW
UConn CSE 2102 - Homework #7

Previewing page 1

Save
Premium Document
Do you want full access? Go Premium and unlock all 1 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CSE 3100 Systems ProgrammingHomework #7 Due: 11/15/2018Complete your work in the hw7 folder. Remember to pull, add, commit, and push.Note: For this homework you will work on a project that has multiple source files. Study the Makefileand learn how to write rules for such targets.Exercise 1. Matrix multiplication (80 points)In this exercise you will continue to work on the matrix ADT. The function mulMatrix() in matrix.cperforms matrix multiplication. You must implement mulMatrix thread() in mmul.c, which performsmatrix multiplication with two threads. You can change all the lines in mmul.c.test-mmul.c is provided for you to test your implementation. The program takes the following argumentsfrom the command line: the number of rows in the first matrix, the number of columns in the first matrix,and the number of columns in the second matrix. Then it fills two matrices with random numbers, andcompares the result of mulMatrix() and mulMatrix thread(). If no argument is specified, the programworks on two matrices of size 6 × 6.Here are some sample sessions running test-madd. Note that the second command multiplies a matrixof 1000 by 500 with a matrix of 500 by 2000. The resulting matrix is 1000 by 2000.$./test-mmulUsage: ./test-mmul nrows ncols ncols_2Currently using the default values for the number of rows and columns.0 Good work!$./test-mmul 1000 500 10000 Good work!Exercise 2. Timing (20 points)Two functions provided in unixtimer.c allow timing specific sections of the code. start timer() starts astopwatch, and cpu seconds() returns a double indicating the number of seconds elapsed since the stopwatchstarted. The prototype of the functions are in unixtimer.h.Modify test-mmul.c. Use the two timing functions to measure the time required for mulMatrix() andmulMatrix thread() to do the same matrix multiplication, and print the results to stdout. A sample sessionis shown below.$./test-mmul 1000 200 8000 Good work!time1=1.05053


View Full Document

UConn CSE 2102 - Homework #7

Documents in this Course
Load more
Download Homework #7
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Homework #7 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Homework #7 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?