CS240A Homework #2: Frequently Asked Questions
Last Updated:
Sun Apr 22 15:29:47 PDT 2007
- How do I get started?
Get the harness code for the homework: it includes Makefiles, a generator for
creating and initializing the Life grid board and a corresponding result
validator. You can copy the harness on DataStar with:
cp -r ~ux454229/CS240A/hw2/ .
This will copy the files in the hw2 directory to your current directory. Please
refer to the README.txt file for futher instructions.
- What input parameters are provided to the program?
The harness will generate an executable that will take 3 command-line arguments:
the size of the Life grid (n), the number of iterations for which to run Life
(niters) and the initial configuration of the grid (whichstart). You can set
the values of these parameters in the Make.inc file.
- How does the harness distribute the Life grid among the threads?
First, the harness assumes that the size of the grid (n) is
evenly divisible by the number of processors (p). We also assume n > p. The
grid is divided evenly among the threads by rows i.e. we create the first
n/p rows on thread #0, the next n/p rows on thread #1 and so on. Your life()
function is invoked in each thread with the corresponding "chunk" (array A) of
the grid.
- What is the starting state (pattern) of the Life grid?
The harness initializes the Life grid with a starting pattern that can be
specified by the input parameter "whichstart". For each initial pattern, the
harness has pre-computed results that will be used to validate the result of
your life() function. The currently valid values of whichstart are described
below:
0 = All cells in the grid are dead.
2 = A "glider" pattern that will move across the grid.
3 = This pattern can be validated only for n = 9600 and niters = 100 or 1000.
1 = An "interesting" pattern. No validation is available for it at this time.
We might add more patterns+validations to the harness later. For now, you can
use whichstart = 0, 2 or 3. Of course, your program should work for any input
that we might use during grading.
- How do I validate the correctness of my results?
The harness calls the life() function with an output parameter "livecounts".
After every niters/10 iterations, you should store the number of "live" cells
in the "entire" Life grid in the vector livecounts. For e.g., for niters = 500,
livecounts[0] will have the number of live cells after 50 iterations,
livecounts[1] will have the number of live cells after 100 iterations, and so on.
You can assume that niters will be a multiple of 10. Also,
you just need to maintain the live counts in thread #0. The harness will
check the value of livecounts in thread #0 and output the correctness
as follows:
CORRECT: 0 means the result was incorrect
CORRECT: 1 means the result was correct
CORRECT: -1 means the result couldn't be validated (because of invalid value
of whichstart).
- How will be the performance of my program graded?
The performance of your program will be graded based on its speedup, for e.g.,
for fixed values of n and niters, how well does the execution time of your
program scale with the number of processors (p)? This means
that you can can get a good grade by focusing on optimizing the communication
patterns in your program. Extra credit will be given to the submission
that achieves the highest speed (execution time for a fixed n, niters and p).
- For a 2D decomposition of the Life grid, can I assume p is a perfect
square?
Yes.
- What do I need to submit?
For detailed instructions on what to turn in, please see John's
email on the mailing list.
Submit your entire homework directory with the report (preferably pdf/ps/html format) using the turnin script on a CSIL machine as below:
turnin hw2@cs240a your_hw2_directory
NOTE: do a "make clean" in your_hw2_directory first.
If you don't have a CS account, email a zipped copy of your homework directory
and the report to the TA.
- I have a question that is not answered in this FAQ!
Please check if the question has been already answered on the mailing list:
http://groups.google.com/group/UCSB-Computer-Science-240A-Spring-2007
If not, please post your question on the class mailing list:
ucsb-computer-science-240a-spring-2007@googlegroups.com