CS 336: Project #3

Project 3: Finishing the Sequential Implementation of Fish Schooling Simulations

This is a continuation of project 2. Add a few files to your fish-schooling code from project 2:
  1. curl -O http://cs.colby.edu/courses/S16/cs336/projects/proj03/proj03/sim_fast.c
  2. curl -O http://cs.colby.edu/courses/S16/cs336/projects/proj03/proj03/sim_stats_1r.c
  3. curl -O http://cs.colby.edu/courses/S16/cs336/projects/proj03/proj03/sim_stats_nr.c
  4. curl -O http://cs.colby.edu/courses/S16/cs336/projects/proj03/proj03/disp_stats.c
The new files play various roles:

The main programs begin with more IO and less computation (good for debugging) and end with more computation and less IO. We also introduce code to time the computations. Our goal as we parallelize this code in the future will be to speed it up dramatically.

  1. One Simulation at a Time, with Statistics

    Now that we know how to run single simulations, let's compute the polarity and elongation values. We continue to allow for certain initial configurations, so that we can debug the statistics.

    1. Write computePolarization (in fish_support.c)
    2. Write runSimulationWithStatistics (in fish_support.c)
    3. Test it by running sim_fast (I supply sim_fast.c and my_timing.c)
  2. Lots of Simulations for one orientation/attraction ratio

    Ultimately, our goal is to run many simulations for each value of r (orientation/attraction ratio) starting from random initial conditions. First, let's write code that runs multiple simulations for one value of r.

    1. Write runRandomSimulationWithStatistics (in fish_support.c)
    2. Write runSimulations (in fish_support.c)
  3. Lots of Simulations for multiple orientation/attraction ratios

    1. Run sim_stats_nr to get a taste of how much time it can take to run sequential code. We need to run at least 32 simulations for each r value on schools of at least 100 fish. How long does it take to run 32 simulations of 100-fish schools for three values of r?



Make liberal use of dump_sim and sim_from_file.


  1. Create a file named README.txt for your project write-up. This week, I want you to talk about (a) what was the most challenging aspect of the project, (b) which extensions you did, and (c) how long it takes to run sim_stats_1r for different values of r (ranging from 0.25 to 16) for different sizes of fish schools (ranging from 10 to 100), and for different numbers of simulations (you will be limited by the fish school size for this one). For part (c), it is up to you to decide which simulations to run. Make your decision based on how long it takes to run the individual simulations. Don't spend more than an hour on this part (writing and running together).
  2. You should hand in all code necessary to run your solutions. Place all necessary .h, .c, and Makefile files in proj02 directory along with the README file. Stephanie will probably want to compile and run the code. It should be possible to do so without looking for any more files. Tar/zip up the directory and email it to Stephanie.