Multithreading & MPI
This documentation is a draft and work in progress. It will be extended and improved in the future.
Multithreading and MPI are implemented based on a similar approach. The body is split into several chunks, that each have their own process.
There are two types of points. Each chunk consists of the local points, which lay inside the specific body chunk, as well as halo points, which lay on the surface of neighboring chunks and interact with local points of the considered chunk, because they lay inside their horizons.
This means that every point of a body exists locally in the body chunk that it originally lies in. Additionally one or more copies of the point can exist as halo points in other chunks.
Since there are points that exist in multiple chunks (in one chunk as local points and possibly in one or more chunks as halo points) information has to be exchanged between these copies of specific points. Two types of exchanges are of importance for both methods:
- local-to-halo exchange: Data from calculations in the chunk where the point is local is transferred to the halo versions of this point which exist in other chunks.
- halo-to-local exchange: Data from calculations of the one or multiple halo versions of a point is transferred to the local version of the point.
A body chunk contains all information that is necessary for the simulation:
Multithreading
To manage the body chunks that compose a body in multithreading a ThreadsDataHandler
is employed. It combines information about all the body chunks of the system and all halo exchanges between them.
MPI
For MPI simulations an MPIDataHandler
is used for each body chunk, processing its halo exchanges and further MPI-related information.