- #1
Chaoyi Zhang
- 1
- 0
Homework Statement
I wrote a brute force O(N^2) N-body code in python and I am not happy with its performance despite the fact that I have cythonised the calculation heavy parts as well as implemented MPI. I am currently out of ideas for how to optimise it further, can I get some advice please?
Edit: the code solve gravitational systems with very large N (10k - 30k) bodies by calculating the trajectories of all the bodies. By brute force, I mean direct summation, summing the force from each particle at each timestep, moving the particles then repeating the process.
Here's a link to my code: https://1drv.ms/f/s!Aks13DdO4pS0jAfWncIFbjg07HpR
calc2.pyx is the acceleration and leapfrog integration calculation written with cython
Nbtest_2.py runs the simulation
setup_calc2.py cythonises calc2.pyx
Homework Equations
The Attempt at a Solution
Last edited: