CS 213 Spring '01
Lab 4

Lab Assignment L4 ( L4.ps, L4.pdf )

Due: Wednesday, April 11, 11:59PM

The final grades

Yiping Zhan's heatLocal.c

Yiping Zhan's heatFast.c

The statistics page


For the second part of your assignment, you may need to submit your program for performance evaluation. I have not set this up yet. In the mean time, you can use the output of the driver. The output of the driver will give you a good approximation unless the machine you are working on has a very high load.

Good luck and have a good Spring Break.

Revisions and Updates:

To simplify the implementation, I decided not to check the first N_STEPS and the last N_STEPS elements of the grid for correctness. This should eliminate some of the problems with the boundary, the start and the end of the grid. I updated the driver file accordingly. You can obtain the new files by typing "get L4" after deleting your L4 directory. Do not forget to save your work before deleting your L4 directory. The command "get L4" will overwrite your work, so copy your work before executing the get command. I did this update on Monday March 26, 11:50am, so if you have not retrieved L4 files by that time you are fine.


In general

The implementation part on this assignment is relatively easy. However, it may take you a while to figure out the algorithm for blocking. So start early and get the problem in your head. There are short, elegant solutions for the problem, so if you find that your solution is pretty long or tedious, then spend some more time thinking before implementing.

Do the first part first, and the second part second. Your algorithm for the second part may do wonders for the first part as well. We divided the problem into two parts so that you can solve the problem progressively.

How to debug?

If your program does not pass the correctness test, then either your algorithm is not correct or your implementation. To test your algorithm, run your algorithm by hand on a small input for small number of steps, for example you can try 8 elements for 2 steps. If you are convinced that it does work, then you can test your implementation.

To test your implementation, you can change the "initGrids" function that fills the grid with random floating point numbers so that it now fills the grid with simpler numbers such as 1's or 2's or 1,2,3... Then you can set the "N_STEPS" in defs.h to a single digit number, for example 2 will work fine, and use print statements to see what is going on. Note that print statements are printed on the screen through a buffer and print statements are not effective to track down a problem such as segmentation fault -- the buffer may not get flushed before your program dies.

Back to CS213 home page.