Table of Contents


gadget - parallelized cosmological treecode with SPH




gadget is a freely available code for cosmological N-body/SPH simulations on massively parallel computers with distributed memory. GADGET uses an explicit communication model that is implemented with the standardized MPI communication interface. The code can be run on essentially all supercomputer systems presently in use, including clusters of workstations or individual PCs.

gadget computes gravitational forces with a hierarchical tree algorithm (optionally in combination with a particle-mesh scheme for long-range gravitational forces) and represents fluids by means of smoothed particle hydrodynamics (SPH). The code can be used for studies of isolated systems, or for simulations that include the cosmological expansion of space, both with or without periodic boundary conditions. In all these types of simulations, GADGET follows the evolution of a self-gravitating collisionless N-body system, and allows gas dynamics to be optionally included. Both the force computation and the time stepping of GADGET are fully adaptive, with a dynamic range which is, in principle, unlimited.

gadget can therefore be used to address a wide array of astrophysically interesting problems, ranging from colliding and merging galaxies, to the formation of large-scale structure in the Universe. With the inclusion of additional physical processes such as radiative cooling and heating, GADGET can also be used to study the dynamics of the gaseous intergalactic medium, or to address star formation and its regulation by feedback processes.


There have also been older versions of the code that supported the special-purpose hardware GRAPE, in the form of GRAPE-3 and GRAPE-6. However, this functionality is not included in the current version at the moment.


Within NEMO there is a shell script $NEMO/src/scripts/gadget.install that helps installing the package. It needs a small set of libraries pre-installed, which this scripts takes care of. By using the keyword prefix=$NEMO it can be made to fit within the NEMO environment.

Note that for each style of gadget a special Makefile is used to compile this executable. Examples can be found in Gadget-2.0/Gadget2/parameterfiles/

There is no rungadget NEMO front-end for this complex program (yet). It is left as an excersize for the writer.


The benchmark we use can be found in the before mentioned gadget.install script, and runs a galaxy-galaxy N=60,000 collision:
  % time mpirun -np 1 Gadget2/Gadget2 Gadget2/parameterfiles/galaxy.param
>& galaxy.log
   AMD64/3200:           2126.093u 2.983s 35:29.48 99.9%
                         3294.859u 7.763s 55:10.38 99.7%   ???
   np=1 0.000u 0.000s 55:04.35 0.0%     0+0k 0+0io 0pf+0w
   np=2 0.000u 0.002s 36:44.69 0.0%     0+0k 0+0io 0pf+0w
   np=4 0.000u 0.002s 39:18.13 0.0%     0+0k 0+0io 0pf+0w
   AMD Opteron 246/2000  2160.138u 2.687s 36:02.81 100.0%
   P4/3300 desktop:   about 1h18m/2 = 78/2 = 2340" ?
   P4/1600 laptop:    about 4h35m           16508"
   P4/64/3000            3292.062u 7.109s 55:05.93 99.7%
   G5/1600               4263.6u  51.5s 1:19:07.64 90.8%
See Alsosnapgadget(1NEMO), gadgetsnap(1NEMO), snapshot(5NEMO)
Springel V. (2005MNRAS.364.1105S) -  The cosmological simulation code GADGET-2
Springel V. May 1, 2005  -  User Guide for GADGET-2 (users-guide.pdf).
Springel V., Yoshida N., White S. D. M., 2001, New Astronomy, 6, 51 


Volker Springel


15-mar-2000    V1.0 original fortran version released (Y2K compliant!)
1-may-2005    V2.0 rewritten in C++
17-mar-2006    a first document in NEMO

Table of Contents