Starting from:

$34.99

CSC4005 Assignment3: N-body Simulation Solution


1 description
Write a sequential program, a P-thread program, an CUDA program, a openMP program and an MPI program to simulate an astronomical N-body system, but in two-dimensions. The bodies are initially at rest. Their initial positions and masses are to be selected randomly (using a random number generator). The gravity between N-body should be described by the following equation:

Also you should consider the collision and bouncing, otherwise, all the points will be collasped into a singular point. Display the movement of the bodies using xlib or other GUI systems on your computers.
Bounus(10 points): Write an MPI + OpenMP program for a two-dimensional N-body simulation.
2 requirement
• You need to implement five versions of the tasks, which are Sequential version, openMP version, MPI version, CUDA version and a Pthread version. And hand in the codes for these five versions in five seperated code files.
• In your submit code, it should display an image with size of 800 × 800, and with 200 bodies moving for a fixed number of iterations.
• Include the results in your report by capturing a picture on your screen.
• Record a video of your result.
• You need to specify the command line about how to compile and run your program.
• You need to compare the performance of different implementation and configurations in your report.
– The number of processes or threads used in the program (up to at least 33 processes and threads)
– MPI vs Sequential vs Pthread vs CUDA vs openMP
– you should fix the size of the display window and the number of iterations, instead you should change the number of bodies (ranging from small, medium to large size). – More if you have
• You need to include three figures describing the structure of your MPI program, Pthread program, openmp and CUDA program.
• The report should be written in appropriate format.
• At least 10 pages on your report
3 Tips
• When measuring the running time of the program, make sure only measure the computation time. (Because Imgui’s or xlib's drawing are time consuming.)
• Debug your program on the VM that is built on the image centos. Make sure the program is OK, only after then measure the running time of the program on the server. • Try to limit your program running time within 60 seconds. If your program is running slow, try to improve your code or reduce the image’s size.
4 Where and What to Turn in Your Homework
• Please turn in a zip file includes
– Report
– Codes
– video demonstrating your program results
• zip your source codes, result video, paper in a zip file, and name it studentID.zip, then submit it on Blackboard.

More products