For this project, rather than point masses, you are to display a 2-dimensional projection of the scalar magnitude of the gravitational field. Each pixel in the pixel plane corresponds to a physical location in space, in the x-y plane. You can find the scalar force on a pixel by treating it as a unit mass at its x-y position, computing the force vector on it, and finding the magnitude of this vector.
To do this sequentially, you would use a doubly nested loop, over pixels and masses, and for each pixel compute the force exerted on it by each mass, add this to a net force vector. The force vector on a pixel is the sum of the forces exerted on it by each "real" object; don't include the other pixels as objects when you calculate this force.
The result of this calculation will be an array representing a 2-dimensional projection of the scalar magnitude of the gravitational field at a particular instant of time. This array needs to be mapped into an array of values from 1-127 to give a color intensity display. If fmin is the smallest force, fmax the largest, and f the force on a particular pixel, then that pixel should have the value
126 * (f - fmin)/(fmax - fmin) + 1 .
Because forces can get arbitrarily large as masses approach
pixels, and because fmax and fmin can change as bodies move, you
may want to experiment with fixing fmin and fmax, and truncating
or otherwise restricting f to lie between them, to get a more
stable representation of field intensity. You can use the image server as in Project 1, or any other display routines. Test data is available in a tar file which includes input and output for one dT step of 100, 4096, 8192, and 16384 body problems, generated using dT=1 and G=1.
Some simple examples of threads code are available, including a hello world type example, an example illustrating shared and global memory access, and simply example of matrix multiplication.