|
Peano
|
Peano's domain decomposition is used for both MPI and multithreading.
It is used as is by ExaHyPE. The one thing ExaHyPE adds on top is some bespoke/abstracted load-balancing, while its solvers themselves obviously are made domain decomposition-aware.
Most users that write extensions to ExaHyPE which need some global data exchange are users which add new fields to their solver. Examples are global statistics that they want to track over the solution or global variables that they control.
Each MPI rank holds one instance of the solver. All threads per MPI rank share the same instance of the solver. Peano splits up the domain into chunks along the space-filling curve. If you use an enclave solver, it then splits up these chunks further into tasks. That is, operations per cell such as the Riemann solves and the patch postprocessing can run in parallel on each thread.
If you add new attributes to your solver, this attribute exists on each solver on each rank. You therefore have to
The first item is relatively simple: You might, for example, decide to protect all accesses to your own variables via a semaphore. There is no specific place to take care of the protection: Just protect the actual data access.
The second item requires slightly more work, as you have to globally reduce the attribute: After each time step, you have to ensure that all ranks exchange their attributes with each other, and you then have to merge these data. I recommend not to use MPI's data exchange routine directly, but to use Peano's wrappers around these routines. See also Peano's domain decomposition (data exchange events).
The actual data exchange should be done at the end of each time step. For this, you add
to your solver. The implementation should first invoke the superclass and then add the additional data exchange.
ExaHyPE internally realises these two steps for all of its solver attributes such as the maximum mesh size or the admissible time step sizes. This is the reason why you have to call the superclass implementation, too.