21#ifndef CORE_COMMUNICATION_HPP
22#define CORE_COMMUNICATION_HPP
51#include <boost/mpi/communicator.hpp>
52#include <boost/mpi/environment.hpp>
63 boost::mpi::communicator &
comm;
96std::shared_ptr<boost::mpi::environment>
mpi_init(
int argc = 0,
97 char **argv =
nullptr);
105template <
class... Args,
class... ArgRef>
106void mpi_call(
void (*fp)(Args...), ArgRef &&...args) {
116template <
class... Args,
class... ArgRef>
130void init(std::shared_ptr<boost::mpi::environment> mpi_env);
Communication::MpiCallbacks manages MPI communication using a visitor pattern.
Vector implementation and trait types for boost qvm interoperability.
auto call_all(void(*fp)(Args...), ArgRef &&...args) const -> std::enable_if_t< std::is_void_v< decltype(fp(args...))> >
Call a callback on all nodes.
void mpi_loop()
Process requests from head node.
Communicator communicator
void mpi_call(void(*fp)(Args...), ArgRef &&...args)
Call a local function.
void mpi_call_all(void(*fp)(Args...), ArgRef &&...args)
Call a local function.
boost::mpi::communicator comm_cart
The communicator.
std::shared_ptr< boost::mpi::environment > mpi_init(int argc=0, char **argv=nullptr)
Initialize MPI.
int this_node
The number of this node.
std::shared_ptr< MpiCallbacks > mpiCallbacksHandle()
void init(std::shared_ptr< boost::mpi::environment > mpi_env)
Init globals for communication.
MpiCallbacks & mpiCallbacks()
Returns a reference to the global callback class instance.
boost::mpi::communicator & comm
void full_initialization()
int size
The MPI world size.
int & this_node
The MPI rank.
Utils::Vector3i calc_node_index() const
Calculate the node index in the Cartesian topology.
Utils::Vector3i node_grid
void set_node_grid(Utils::Vector3i const &value)
Set new Cartesian topology.
MpiContainerUnitTest(int argc, char **argv)
std::shared_ptr< boost::mpi::environment > m_mpi_env