CS 194-2: Homework

Homework 4

Handout and provided code

The Homework 4 handout has links to provided code.

Cilk information

UPDATE (mfh 12:18 21 Oct 2007): I've also installed Cilk on Citris; use the same paths as below. (The path is the same but the builds are NOT the same, so you'll have to "make clean" and rebuild your project if you move to a different platform.)

The Cilk website has links to the Cilk manual and source code. I've installed Cilk on PSI in the

directory. Add
to your PATH, and add
to your LD_LIBRARY_PATH. You can find sample Cilk applications in the

Interactive batch jobs

"Interactive batch job" seems like an oxymoron, but it's a handy and little-known feature of the PBS system. Rather than submitting a job to run on its own, you can request an exclusive shell on one of the compute nodes. Within that shell, you can run any programs you want and collect timings. No one else can log into that node while you are using it. As you can imagine, if you're working on game tree search and you want to play as a human against the computer, an interactive job can be useful (otherwise how do you submit moves?).

The following command gives you an exclusive shell on one of the 2-CPU nodes for a maximum of five minutes:

 $ qsub -l nodes=1:ppn=2 -l
walltime=00:05:00 -I 
This doesn't have to be in a script; just run it directly at the command line. When you run the above command, your login node's shell blocks (with some kind of "waiting" message) until you get the exclusive shell.

Homework 3, Part 2

UPDATE (mfh 06 Oct 2007): You can use the HW2a rubric as a guideline for writing your reports.

Your goal in Part 2 is to optimize Part 1. You must implement at least three different domain decompositions: vertical, horizontal, and 2D. 2D need not be square if the number of processors is not a perfect square; in the case of an odd number of processors, you can degrade to 1D. What I usually do is factor the number of processors p into a * b, by taking x = floor(sqrt(p)) and finding the largest factor "a" of p such that a <= p. It could be that a == 1 (if p is prime); this is OK. You'll have to decide for yourself whether you choose a as the number of block rows or the number of block columns.

Further optimizations may include whatever you can invent. Some suggestions include the following: reducing the memory requirements per cell from one byte to one bit, copying the data per processor in order to improve locality (possibly helpful in the 2D case), or tracking active regions (hard). Post to the newsgroup if you'd like more ideas.

Homework 3, Part 1

UPDATE (mfh 15:30 27 Sep 2007): Link problems on Citris with the provided codehave been fixed, and the initboard.x application has been improved. Please download the latest version of the provided code (same name, different file).

The handout is available here, and the provided code is available here as a gzip'd tarball.

Homework 2

Details and provided source code for both parts of Homework 2 are available here.

Homework 1

UPDATE (mfh 1646 08 Sep 2007): new version of provided code for your solution is available here for download. Please read the README file for tips. I've tested this on PSI so it should work just fine. It also comes with a PBS script template that's tuned for this particular homework (but you should still edit it!).

Homework 1 handout available online. A skeleton code for your solution is also available. Homework 1 is due Tuesday 11 Sept. at 5pm.

Homework 0

Click here for a description of Homework 0.

Submitting homeworks

We use the "submit" script system with which you should be familiar from your previous cources. As of 06 Sep 2007, the submit system should work in both bash and (t)csh on the instructional Un*x machines. The scripts do NOT work on the cluster (PSI, Citris) machines. Please report to us any problems you may have.

Class survey

Here is the course survey which we handed out at the beginning of the semester.

Last updated 08 Oct 2007.