30#ifdef ESPRESSO_WALBERLA
34#ifdef ESPRESSO_SHARED_MEMORY_PARALLELISM
35#include <Cabana_Core.hpp>
36#include <Kokkos_Core.hpp>
43#include <boost/mpi.hpp>
44#include <boost/mpi/communicator.hpp>
45#include <boost/mpi/environment.hpp>
60#ifdef ESPRESSO_SHARED_MEMORY_PARALLELISM
70#ifdef ESPRESSO_SHARED_MEMORY_PARALLELISM
76 char const *
const value = std::getenv(name);
77 std::optional<std::string> result{std::nullopt};
79 result = std::string(value);
86 char **
argv =
nullptr;
87 return std::make_shared<boost::mpi::environment>(
argc,
argv);
94 std::shared_ptr<boost::mpi::environment>
mpi_env)
96#ifdef ESPRESSO_SHARED_MEMORY_PARALLELISM
103 m_is_mpi_gpu_aware =
false;
106#if defined(OMPI_HAVE_MPI_EXT_ROCM) && OMPI_HAVE_MPI_EXT_ROCM
109#if defined(OMPI_HAVE_MPI_EXT_CUDA) && OMPI_HAVE_MPI_EXT_CUDA
119#if defined(_CRAYC) or defined(__cray__)
124#ifdef ESPRESSO_WALBERLA
131 std::make_shared<Communication::MpiCallbacks>(
comm_cart, m_mpi_env);
143#ifdef ESPRESSO_SHARED_MEMORY_PARALLELISM
149#ifdef ESPRESSO_SHARED_MEMORY_PARALLELISM
154#ifdef ESPRESSO_WALBERLA
164 locked_for_checkpointing{
false} {}
167 auto constexpr reorder =
false;
171 std::ignore = Utils::Mpi::cart_neighbors<3>(
comm);
172#ifdef ESPRESSO_WALBERLA
Vector implementation and trait types for boost qvm interoperability.
~CommunicationEnvironment()
CommunicationEnvironment()
void loop() const
Start the MPI loop.
DEVICE_QUALIFIER constexpr pointer data() noexcept
cudaStream_t stream[1]
CUDA streams for parallel computing on CPU and GPU.
void mpi_loop()
Process requests from head node.
std::shared_ptr< KokkosHandle > kokkos_handle
Communicator communicator
static auto get_env_variable(char const *const name)
boost::mpi::communicator comm_cart
The communicator.
static auto make_default_mpi_env()
int this_node
The number of this node.
std::unique_ptr< CommunicationEnvironment > communication_environment
std::shared_ptr< KokkosHandle > kokkos_handle
Communicator communicator
boost::mpi::communicator comm_cart
The communicator.
void cuda_on_program_start()
Called on program start.
This file contains the errorhandling code for severe errors, like a broken bond or illegal parameter ...
void fft_on_program_start()
MpiCallbacks & mpiCallbacks()
Returns a reference to the global callback class instance.
void init_error_handling(boost::mpi::communicator const &comm)
Initialize the error collection system.
void deinit_error_handling()
boost::mpi::communicator cart_create(boost::mpi::communicator const &comm, Vector< int, dim > const &dims, bool reorder=true, Vector< int, dim > const &periodicity=Vector< int, dim >::broadcast(1))
Wrapper around MPI_Cart_create.
void mpi_deinit()
Release waLBerla's MPI manager and environment.
void mpi_reinit(int const *cart_topol)
Re-initialize waLBerla's MPI Cartesian communicator.
void mpi_init()
Initialize waLBerla's MPI manager and environment.
boost::mpi::communicator & comm
void full_initialization()
int size
The MPI world size.
int & this_node
The MPI rank.
bool locked_for_checkpointing
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.