University of Wisconsin Computer Sciences Header Map (repeated with 
textual links if page includes departmental footer) Useful Resources Research at UW-Madison CS Dept UW-Madison CS Undergraduate Program UW-Madison CS Graduate Program UW-Madison CS People Useful Information Current Seminars in the CS Department Search Our Site UW-Madison CS Computer Systems Laboratory UW-Madison Computer Sciences Department Home Page UW-Madison Home Page

CS/ECE 757: Advanced Computer Architecture II
Spring 2004 Section 1 of 1
Instructor Mark D. Hill and T. A. David Mulvihill
URL: http://www.cs.wisc.edu/~markhill/cs757/Spring2004/

Homework #1

Due: Friday, February 6, 2004, IN CLASS
You should do this assignment alone. No late assignments.

Last updated on Friday, 23-Jan-2004 16:54:47 CST

The purpose of this assignment is to give you experience writing simple programs in shared memory and message passing. This experience will provide a foundation for writing and/or running much more complex programs.

We have given you accounts on 14-processor Sun E6000 named cabernet.cs.wisc.edu. Unless you already had an account, you should only use this machine only for 757 homework assigments or, with instructor's permission, for your course project. In any case, you should never interfere with the research work on this research machine.

Problem 1

Please read Getting Started - Threads with Shared Memory and follow the pthread's option.

(a) Write a shared-memory program that reads in three N x N matrices, multiplies them, and writes the output to a file. Your program should operate in parallel with P processors specified on the command line. It is okay to only handle the just easy cases (e.g., N is multiple of P).

(b) For N a power of two, how big does N have to be for your program to reliably take over one minute in the parallel phase?

(c) Write an improved program that multiplies matrices more rapidly (where N is set to the size of your answer to part (b).

Problem 2

Please read and follow Getting Started - MPI.

(a) Write the same program as in Problem 1 except this time write it using message-passing mechanisms instead of shared memory. You will be using the MPI (Message Passing Interface) standard to implement your message-passing code. You will be able to write C (not C++) code, compile it, and run it on the same machine as Problem 1.

Program Guidelines

What to Hand In

Please turn this homework in on paper at the beginning of lecture.