Comparisons of different codes for galacticN-body simulations
Astronomy and Astrophysics
Context. N-body simulations are widely used for galactic dynamics studies. Several different algorithms have been developed and a number of authors have made their codes public. Aims. We wish to help potential users of these codes, particularly less experienced ones, to select the appropriate code by giving them relevant information. Methods. We consider different implementations of three different algorithms, namely the Barnes-Hut tree-code algorithm (implemented both in GADGET-2 and as a NEMO
... program), the fast multipole method (implemented in the FMB code -Fast Multipole with BLAS) and W. Dehnen's algorithm (implemented in falcON -force algorithm with complexity O(N)). We compare extensively the timing and memory comparisons of these different implementations and discuss other advantages and disadvantages of these codes. Results. In terms of serial executions, falcON is clearly the fastest code, in many cases by a wide margin. In addition, it is much less sensitive to concentration than other codes, it conserves linear momentum, its computational costs depends roughly linearly on the number of particles, and it allows for manipulators. GADGET-2 is the second fastest and, being parallel, can outperform falcON if a sufficient number of processors is used, the number of which, in our tests is between three and ten. Its public version includes an SPH representation of the gas component. FMB is faster than the implementation of the Barnes-Hut algorithm in NEMO, as long as the particle distribution is not too concentrated, but remains considerably slower than falcON and GADGET-2. It has, nevertheless, the highest parallel efficiency and memory scalability. Conclusions. We recommend falcON for pure N-body simulations with a relatively restricted number of particles (up to a few million). In cases of a larger number of particles, a number of processors being available, or studies including gas and its physics, we recommend GADGET-2. FMB provides the highest parallel efficiency and memory scalability, but is considerably slower in execution time and is ill-adapted to the concentrated distributions encountered in galactic work. Article published by EDP Sciences A120, page 1 of 11 A&A 531, A120 (2011) parallel execution in Sect. 5. We discuss our results and certain advantages and disadvantages of the codes in Sect. 6 and we conclude in Sect. 7.