Difference between revisions of "CSC352 Game of Life Homework 2"
(Created page with "--~~~~ ---- =Problem 1= <br /> Write a threaded java program that computes the generations of the game of life. The program should get 3 different pieces of information from ...") |
|||
(8 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
--[[User:Thiebaut|D. Thiebaut]] ([[User talk:Thiebaut|talk]]) 16:06, 28 February 2017 (EST) | --[[User:Thiebaut|D. Thiebaut]] ([[User talk:Thiebaut|talk]]) 16:06, 28 February 2017 (EST) | ||
---- | ---- | ||
+ | __TOC__ | ||
+ | <br /> | ||
+ | <br /> | ||
+ | <bluebox> | ||
+ | This assignment is due on 3/23/17 at 1:00 p.m. Submit your answer archive file on Moodle. | ||
+ | </bluebox> | ||
+ | <br /> | ||
+ | <br /> | ||
+ | <br /> | ||
+ | <br /> | ||
=Problem 1= | =Problem 1= | ||
<br /> | <br /> | ||
Line 6: | Line 16: | ||
# The number of threads it must generate | # The number of threads it must generate | ||
# The number of generations it must compute | # The number of generations it must compute | ||
− | # The name of the text file containing the first generation, | + | # The name of the text file containing the first generation, i.e. the first "dish." |
<br /> | <br /> | ||
==Format of the Text File== | ==Format of the Text File== | ||
Line 12: | Line 22: | ||
The original dish is stored in a text file using the following format: | The original dish is stored in a text file using the following format: | ||
<source lang="text"> | <source lang="text"> | ||
− | + | " " | |
− | + | " # " | |
− | + | " # # ### " | |
− | + | " ## " | |
− | + | " " | |
− | + | " # " | |
− | + | " # # " | |
− | + | " ## " | |
− | + | " " | |
− | + | " " | |
− | + | " " | |
− | + | " " | |
− | + | " # " | |
− | + | " # # " | |
− | + | " ## " | |
− | + | " " | |
− | + | " " | |
− | + | " " | |
− | + | " " | |
− | + | " " | |
− | + | " " | |
− | + | " " | |
− | + | " " | |
− | + | " " | |
− | + | " " | |
− | + | " " | |
− | + | " " | |
− | + | " " | |
</source> | </source> | ||
+ | Each line of the dish array is defined by 2 double quotes. The first double-quote defines the beginning of a row of characters representing cells, spaces for dead cells, and #-signs for live ones. | ||
+ | <br /> | ||
+ | There can be any number of lines in the text file, and their length can be different from the length shown above. Normally, though, all lines will have the same length. | ||
+ | <br /> | ||
+ | =Code= | ||
+ | <br /> | ||
+ | Code your program to be as simple as possible. Try to avoid excessive communication and excessive copying of data. | ||
+ | <br /> | ||
+ | Feel free to use this 2-thread solution program [[CSC352_Game_of_Life,_2_Threads|solution program]] for inspiration. | ||
+ | <br /> | ||
+ | =Measuring Performance= | ||
+ | <br /> | ||
+ | Measure the ''speedup'' of your program for | ||
+ | * 2, 4, 8, 12, 16, 20, 32, and 64 threads. Use a dish file that contains at least 128 lines of cells. | ||
+ | * 10, 1000, and 10,000 generations. | ||
+ | <br /> | ||
+ | You can use the serial program available [[CSC352_Game_of_Life_Lab_2017| here]] to compute ''T(1)''. You will have to modify it so that it can get the dish array from a data file. | ||
+ | <br /> | ||
+ | |||
+ | =Graph the speedup curves= | ||
+ | <br /> | ||
+ | Use the graphing package of your choice to display the speedup curves. Save a graph as a png or jpg file. | ||
+ | <br /> | ||
+ | =Submission= | ||
+ | <br /> | ||
+ | Submit a zip, tgz, or tar file containing your java program, a sample dish file, any python or script file you created to process the data, and an image file of the graph. | ||
+ | <br /> |
Latest revision as of 17:01, 28 February 2017
--D. Thiebaut (talk) 16:06, 28 February 2017 (EST)
Contents
This assignment is due on 3/23/17 at 1:00 p.m. Submit your answer archive file on Moodle.
Problem 1
Write a threaded java program that computes the generations of the game of life. The program should get 3 different pieces of information from the command line:
- The number of threads it must generate
- The number of generations it must compute
- The name of the text file containing the first generation, i.e. the first "dish."
Format of the Text File
The original dish is stored in a text file using the following format:
" "
" # "
" # # ### "
" ## "
" "
" # "
" # # "
" ## "
" "
" "
" "
" "
" # "
" # # "
" ## "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
Each line of the dish array is defined by 2 double quotes. The first double-quote defines the beginning of a row of characters representing cells, spaces for dead cells, and #-signs for live ones.
There can be any number of lines in the text file, and their length can be different from the length shown above. Normally, though, all lines will have the same length.
Code
Code your program to be as simple as possible. Try to avoid excessive communication and excessive copying of data.
Feel free to use this 2-thread solution program solution program for inspiration.
Measuring Performance
Measure the speedup of your program for
- 2, 4, 8, 12, 16, 20, 32, and 64 threads. Use a dish file that contains at least 128 lines of cells.
- 10, 1000, and 10,000 generations.
You can use the serial program available here to compute T(1). You will have to modify it so that it can get the dish array from a data file.
Graph the speedup curves
Use the graphing package of your choice to display the speedup curves. Save a graph as a png or jpg file.
Submission
Submit a zip, tgz, or tar file containing your java program, a sample dish file, any python or script file you created to process the data, and an image file of the graph.