Due date: 5:00pm, Friday, September 13. Value: 80 pts.
In this assignment we'll study how multithreading can help a program for simulating how heat disperses in a two-dimensional toroidal surface.
|HeatModel.java||The interface implemented by both |
|HeatModelSimple.java||An efficient single-threaded implementation implementing the heat equation.|
|HeatModelThreaded.java||Right now, this is basically identical to
All of your substantive modifications for this assignment
should go into
Other files should remain unmodified, except that
you may end up changing some
DEFAULT_* constants in
for your own testing.
This assignment consists of three parts, in three different files that you should submit via Moodle as your solution.
(Please note: If you work with a partner on this assignment, please make sure that both peoples' names appear at the top of each file!)
HeatModelThreaded, implement a threaded version of the code appearing in
HeatModelSimple, where each thread is responsible for computing heat values for a subregion of the surface. Note that
HeatModelThreaded's constructor includes two parameters,
subgridHeight, indicating what the size of each such subregion should be.
In a text file name results.txt, create a table giving timing results as measured on one of the Linux lab computers (such as frodo or eowyn). Your results should all deal with a 512×512 grid, and it should include results for each of the following sizes.
512×512 (uses the one-thread implementation found
256×512 (2 threads) 128×512 (4 threads) 64×512 (8 threads) 32×512 (16 threads) 16×512 (32 threads) 512×256 (2 threads) 512×128 (4 threads) 512×64 (8 threads) 512×32 (16 threads) 512×16 (32 threads) 256×256 (4 threads) 128×256 (8 threads) 128×128 (16 threads) 64×128 (32 threads)
In each case, you should do at least three runs, and your table should report the median of the per-time-step measurements. Using
HeatGui) to measure these times should give more accurate results.
In a text file named report.txt, write a report discussing the results, including both your recommendation as well as any interesting trends you observe. Your discussion should attempt to explain any numerical results; issues to consider include the number of cores on the computer and caches. There is no definite length guideline on this file, but it should be possible to do a nice, concise analysis within 300 words. Please note that the quality of writing and of your analysis will be an important component of the overall assignment grade!
In case it helps with your analysis, each Linux lab computer has an Intel i5-750 processor, which has four cores (not hyperthreaded), each with a 32 KB l1 cache and a 256 KB L2 cache. The cores share an 8 MB L3 cache.
As always, please feel free to stop by my office when you are unsure of where to go next!