ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
MpiCallbacks.hpp File Reference

Communication::MpiCallbacks manages MPI communication using a visitor pattern. More...

#include <utils/NumeratedContainer.hpp>
#include <utils/tuple.hpp>
#include <utils/type_traits.hpp>
#include <boost/mpi/collectives/broadcast.hpp>
#include <boost/mpi/communicator.hpp>
#include <boost/mpi/environment.hpp>
#include <boost/mpi/packed_iarchive.hpp>
#include <cassert>
#include <memory>
#include <tuple>
#include <type_traits>
#include <utility>
#include <vector>
+ Include dependency graph for MpiCallbacks.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  Communication::MpiCallbacks
 The interface of the MPI callback mechanism. More...
 
class  Communication::MpiCallbacks::CallbackHandle< Args >
 RAII handle for a callback. More...
 
class  Communication::RegisterCallback
 Helper class to add callbacks before main. More...
 

Namespaces

namespace  Communication
 

Macros

#define REGISTER_CALLBACK(cb)
 Register a static callback without return value.
 

Typedefs

template<class... Args>
using Communication::CallbackHandle = MpiCallbacks::CallbackHandle< Args... >
 

Detailed Description

Communication::MpiCallbacks manages MPI communication using a visitor pattern.

The program runs on the head node and is responsible for calling callback functions on the worker nodes when necessary, e.g. to broadcast global variables or run an algorithm in parallel.

Callbacks are registered on the head node as function pointers via the REGISTER_CALLBACK. The visitor pattern allows using arbitrary function signatures.

Definition in file MpiCallbacks.hpp.

Macro Definition Documentation

◆ REGISTER_CALLBACK

#define REGISTER_CALLBACK (   cb)
Value:
namespace Communication { \
static ::Communication::RegisterCallback register_##cb(&(cb)); \
}

Register a static callback without return value.

This registers a function as an mpi callback. The macro should be used at global scope.

Parameters
cbA function

Definition at line 510 of file MpiCallbacks.hpp.