14#include "arccore/alina/MessagePassingUtils.h"
21namespace Arcane::Alina
28AlinaCommunicator(IMessagePassingMng* mpm_comm)
30 m_message_passing_mng =
makeRef(mpm_comm);
38AlinaCommunicator(
const Ref<IMessagePassingMng>& mpm_comm)
40 m_message_passing_mng = mpm_comm;
47void AlinaCommunicator::
50 IMessagePassingMng* mpm_comm = m_message_passing_mng.get();
52 MessagePassing::Communicator c = mpm_comm->communicator();
54 m_mpi_communicator =
static_cast<MPI_Comm
>(c);
55 rank = mpm_comm->commRank();
56 size = mpm_comm->commSize();
63createFromMPI(MPI_Comm comm)
66 return AlinaCommunicator(mpm);
75 int lc = (cond) ? 1 : 0;
76 int gc =
mpAllReduce(m_message_passing_mng.get(), MessagePassing::eReduceType::ReduceMin, cond);
87 std::cerr <<
"Failed assumption: " << message << std::endl;
88 std::cerr <<
"Offending processes:";
89 for (
int i = 0; i < size; ++i)
91 std::cerr <<
" " << i;
92 std::cerr << std::endl;
95 ARCCORE_FATAL(
"CheckError in MessagePassingUtils: {0}", message);
101MPI_Comm AlinaCommunicator::
102mpiCommunicator()
const
104 if (m_mpi_communicator == MPI_COMM_NULL)
106 return m_mpi_communicator;
#define ARCCORE_FATAL(...)
Macro throwing a FatalErrorException.
void resize(Int64 s)
Changes the number of elements in the array to s.
Constant view of an array of type T.
Interface of the message passing manager.
static Ref< IMessagePassingMng > createRef(MPI_Comm comm, bool clean_comm=false)
Creates a manager associated with the communicator comm.
Unicode character string.
1D data vector with value semantics (STL style).
C void mpGather(IMessagePassingMng *pm, Span< const char > send_buf, Span< char > recv_buf, Int32 rank)
C char mpAllReduce(IMessagePassingMng *pm, eReduceType rt, char v)
void mpBarrier(IMessagePassingMng *pm)
Performs a barrier.
auto makeRef(InstanceType *t) -> Ref< InstanceType >
Creates a reference on a pointer.
Convenience wrapper around MPI_Comm.
void check(bool cond, const String &message)
Communicator-wise condition checking.