14#include "arccore/alina/MessagePassingUtils.h"
21namespace Arcane::Alina
28AlinaCommunicator(MPI_Comm comm)
29: m_mpi_communicator(comm)
31 if (comm == MPI_COMM_NULL)
34 MPI_Comm_rank(comm, &rank);
35 MPI_Comm_size(comm, &size);
36 m_message_passing_mng = MessagePassing::Mpi::StandaloneMpiMessagePassingMng::createRef(comm);
43AlinaCommunicator(IMessagePassingMng* mpm_comm)
45 MessagePassing::Communicator c = mpm_comm->communicator();
47 m_mpi_communicator =
static_cast<MPI_Comm
>(c);
48 rank = mpm_comm->commRank();
49 size = mpm_comm->commSize();
50 m_message_passing_mng =
makeRef(mpm_comm);
56void AlinaCommunicator::
57check(
bool cond,
const String& message)
59 int lc = (cond) ? 1 : 0;
60 int gc =
mpAllReduce(m_message_passing_mng.get(), MessagePassing::eReduceType::ReduceMin, cond);
71 std::cerr <<
"Failed assumption: " << message << std::endl;
72 std::cerr <<
"Offending processes:";
73 for (
int i = 0; i < size; ++i)
75 std::cerr <<
" " << i;
76 std::cerr << std::endl;
79 ARCCORE_FATAL(
"CheckError in MessagePassingUtils: {0}", message);
85MPI_Comm AlinaCommunicator::
86mpiCommunicator()
const
88 if (m_mpi_communicator == MPI_COMM_NULL)
90 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.
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.