title>CS267/Sp1996 Assignment 2

U.C. Berkeley Department of Electrical Engineering and Computer Science
CS267 Sp96
Assignment 2: Due: February 22, 5pm

Your assignment is to solve the Sharks and Fish problems 1 and 2, i.e. fish swimming around in an ocean subject both to external current and gravity. You should modify 4 out of 5 existing parallel programs:
  • CMMD (CM5)
  • CMF (CM5)
  • Split-C (CM5)
  • pSather (Sun SMP)
  • Solaris threads (Sun SMP)
  • For extra credit, you may complete all 5 programs. Although this is not strictly required, you are encouraged to tune code performance, especially for poor gravity implementations.

    The CM5 code is on rodin in /usr/castle/share/proj/shortcourse/wator. Pointers to the code are here.

    It is harder to test your implementation to see if you answers are accurate in a simulation of this kind, because it is less clear what the "right" answer is supposed to be, unlike matrix multiplication. You should try 2 test cases:

  • Case 1. Choose the "current" function so that it points directly away from the origin at every point in the plane (as though there were a big faucet at the origin). Arrange several equally heavy fish so they are initially equally spaced on a circle around the origin, and at rest. If the magnitude of the current exactly matches the gravitational attraction to the origin, the fish should stand still. Do they?
  • Case 2. In the absence of a current but presence of gravity, several fish held equally spaced on a circle and at rest will starting falling straight towards the center, pass through one another (no collisions yet in this simple version of Sharks and Fish), and decelerate until they come to rest exactly as far apart as they started (conservation of energy). Then the process repeats. Now add a current which is constant everywhere (i.e. same direction and magnitude everywhere). The simple periodic picture of falling together and moving apart should now just move with the current, but not otherwise change. Is this true? Note that the numerical approximation we use to follow the fish paths (Euler's method) may also distort the fish paths, so you can't expect them to follow their ideal trajectories.
  • In addition to looking at nice pictures produced by the code, and turning in a picture of the fish after several "together and apart" cycles from Case 2, you should time one of the CM5 programs and one of the SMP programs, and compute the speedup and efficiency. For this, remove the I/O, and time only the main loop of the program. Is the speedup what you expect? If not, can you explain why?

    Turn in pointers to your code, some nice pictures, some measurements, and anything else you may want to share with us.