1 / 14

N Body Gravitational Problem

N Body Gravitational Problem. Seminar By Srinivasan Manoharan. Problem. To compute the position of N bodies over a set of Iterations by using the forces that exists between the other bodies. A big mathematical conundrum

doli
Download Presentation

N Body Gravitational Problem

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. N Body Gravitational Problem Seminar By SrinivasanManoharan

  2. Problem • To compute the position of N bodies over a set of Iterations by using the forces that exists between the other bodies. • A big mathematical conundrum • I chose this problem because of the huge amount of computation involved in this problem. • Mathematical Problem:- • Consider n point masses in three dimensional space • Assumption :- Force experienced between them is Newtonian. • Then, if the initial positions in space and initial velocities are specified for every particle at some present instant t0, determine the position of each particle at every future (or past) moment of time

  3. Problem(Contd..) • The All Pairs Approach is a brute force technique which evaluates the interactions between all the pairs of the N bodies. • The problem with this approach is that the worst case computational complexity is O(N2). • The all pair approach is used for evaluating bodies that are interacting very closely. • So the all pairs method is combined with a more efficient method ,far field approximation of long range forces(Barnes Hut method). • This far field method is only valid when the two bodies are well separated. • The all pairs method requires substantial time to compute and an area where acceleration can be used.

  4. Calculation • Force Between two bodies with a distance r is • The total Force on the Body i is the summation of the all the forces other than i. i.e where j is 1 to N and not equal to j. • Due to approximation, softening factor is included and Force = mass * Acceleration. • Acceleration of the body ,ai Fij=G*(mi*mj)/rij2 Fi=∑Fij Fi=G*mi*∑((mjrij)/rij3) Fi=G*mi*∑((mjrij)/(rij2+ε2)3/2). ai=G*∑((mjrij)/(rij2+ε2)3/2).

  5. Calculation (contd..) • With acceleration calculated , we can get the velocity v and the distance x for the body to move . • We can calculate all Fijin a grid of size N * N .

  6. Strategy • First we randomly position the bodies in the 3 dimensional space. • Then we calculate the force exerted in all the axis using the formula. • We calculate the acceleration by dividing the force by mass • We calculate the velocity by multiplying the acceleration with delta time. • Then finally we calculate the new position by multiplying the velocity with delta time.

  7. Strategy • Each entry in the Grid can be calculated independently , therefore there is N2 parallelism. • But Since the memory is limited, we cannot use N2 threads each computing the force in the grid. • So we can calculate the forces in a row to be calculated in sequential order . • And parallelize the columns as each thread can calculate the Force and acceleration of the body .

  8. Analysis • We need to obtain the performance by • By varying the number of bodies N interacting • By Varying the number of iterations. • By varying the number of threads per block. • By varying the number of processors. • The number of threads per block can also be varied ,but the performance was better when I used p= 256 i.e 256 threads per block. • Number of Blocks = Number of Bodies / Number of threads

  9. Table (N & Number of Iterations)-Sequential

  10. Table (N & Number of Iterations)-Parallel

  11. Performance(Time Vs N)

  12. Performance (Time Vs Processors) • As the number of Nodes increases , the performance is better .

  13. Analysis & Inference • The number of calculations involved is 34357641220 and computed in 11.4 milli seconds. • Each calculation involves 14 operations. • When the number of computation is less the processors are underutilized. • But when the calculations increase the performance is far better than the sequential code. • When the number of bodies is 32 the performance is better in parallel .i.e 126976 calculations.

  14. QUESTIONS Thank You

More Related