Starting from:

$34.99

CSC4005 Assignment 3- N-body Simulation Solution


1 description
Write a sequential program, a P-thread program, an CUDA 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 four versions of the tasks, which are Sequential version,openMP version,MPI version and a Pthread version. And hand in the codes for these four versions in four seperate 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.

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 isOK, only after then measure the running time of the program on the server.
• Make sure use ‘sbatch’ command to submit your jobs onto the master machine, do not directly runyour program on the master machine.
• Try to limit your program running time within 60 seconds. If your program is running slow, tryto 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