Skip to content

Latest commit

 

History

292 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GraviDy - Gravitational Dynamics

Build Status

The astrophysics "N-body problem" consist in a dynamical N celestial bodies model which interact gravitationally.

Solving this problem implies understand and predict the movement of the system components, for example, the Solar System, a stars cumulus, or a galaxy.

To systems with more than 3 bodies, which are most of the interesting astronomical systems, the problem do not have an analytic solution, and it is necessary to use computational methods, which are progresively more expensives to largest values of N.

GraviDy is a new GPU, direct-summation N-body integrator written from scratch and based on the Hermite scheme. The most important features of the code are:

  • Written in C/C++,
  • Using parallel computing techniques and libraries like OpenMP, MPI and CUDA,
  • full double-precision resolution,
  • its high modularity, which allows users to readily introduce new physics into it,
  • the exploitation of all high-performance computing resources available,
  • its maintenance and improvement cycle,
  • the fact that the code is publicly released under a BSD license and will be maintained via planned, public, regular updates.

Publication reference

Maureira-Fredes, C and Amaro-Seoane, P. "GraviDy, a GPU modular, parallel direct-summation N−body integrator: Dynamics with softening", MNRAS, vol. 473, pp. 3113-3127, Jan . 2018.

Requirements

Software Version Description
GCC v9 or greater Compiler, C++17 and std::filesystem
boost::program_options v1.52.0 or greater command-line options
OpenMPI v1.8.8 or greater MPI implementation
CUDA v11 or greater GPU implementation, first one with C++17
Python v3.6 or greater Regression tests only

The build is pinned to C++17, so the versions of GCC and CUDA that the code used to accept are no longer enough. The version 11 of CUDA is the first one whose nvcc takes the dialect, and it is the oldest one that the GPU version is meant to support; the versions it has been built with so far are GCC 16 and CUDA 13.3.

Install

Enter the src directory and proceed to edit the Makefile with the Boost, CUDA and OpenMPI paths if they are not installed on the system, otherwise the flags are not needed.

Every version can be generated by:

  • CPU version, gravidy-cpu
    • make cpu
  • CPU version with the Post-Newtonian terms enabled, gravidy-pn
    • make pn
    • Note that this version only accepts a two body system.
  • MPI version, gravidy-mpi
    • make mpi
  • GPU version, gravidy-gpu
    • make gpu

Each version keeps its objects in its own src/build subdirectory, so the different versions can coexist without a make distclean in between.

demo

Tests

make check runs a set of short simulations and compares their result against the references stored in tests/reference:

cd src
make cpu pn mpi
make check

The cases whose binary is not built are skipped, so make check on its own only exercises the CPU and the PN versions. The MPI version is compared against the very same reference as the CPU one, since both have to produce the same numbers.

These tests do not validate the physics, the references were produced by the code itself. What they do is to notice when a change alters the result of a simulation, so they are meant to be run before and after every modification of the integrator. The comparison uses a relative tolerance of 1e-9, because the last digits of a floating point result depend on the compiler and on the machine.

When a change is meant to alter the results, look at what changed and then rewrite the references with make check-update.

The input files of the tests live in tests/data and do not need the input submodule.

Input submodule

The example initial conditions are in a different git respository, that it can be cloned through the setup-submodule script, in the root of the repository. If you do not have a Gitlab account, you can clone the repository directly:

git clone https://gitlab.com/cmaureir/gravidy-input.git

Example execution

demo

Licence

Copyright 2014 Cristián Maureira-Fredes, Pau Amaro-Seoane

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

About

GraviDy: Gravitational Dynamics -- A GPU modular, parallel direct-summation N−body integrator

Resources

Stars

6 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages