12#ifndef ARCANE_PARALLEL_THREAD_HYBRIDMESSAGEQUEUE_H
13#define ARCANE_PARALLEL_THREAD_HYBRIDMESSAGEQUEUE_H
17#include "arcane/utils/CheckedConvert.h"
18#include "arcane/utils/TraceAccessor.h"
19#include "arcane/parallel/thread/ISharedMemoryMessageQueue.h"
22#include "arcane/parallel/mpi/ArcaneMpi.h"
47 Int32 r = rank.value();
54 friend std::ostream& operator<<(std::ostream& o,
const FullRankInfo& fri);
83class SourceDestinationFullRankInfo
95 FullRankInfo destination()
const {
return m_destination; }
96 bool isSameMpiRank()
const
98 return m_source.
mpiRank() == m_destination.mpiRank();
142 Int32 nbLocalRank()
const {
return m_nb_rank; }
145 return FullRankInfo::compute(user_rank, m_nb_rank);
147 SourceDestinationFullRankInfo rank(MessageRank rank1, MessageRank rank2)
const
149 auto x1 = FullRankInfo::compute(rank1, m_nb_rank);
150 auto x2 = FullRankInfo::compute(rank2, m_nb_rank);
151 return SourceDestinationFullRankInfo(x1, x2);
153 MessageTag tagForSend(MessageTag user_tag, FullRankInfo orig, FullRankInfo dest)
const
155 return _tag(user_tag, dest.localRank(), orig.localRank());
157 MessageTag tagForSend(MessageTag user_tag, SourceDestinationFullRankInfo fri)
const
159 return tagForSend(user_tag, fri.source(), fri.destination());
161 MessageTag tagForReceive(MessageTag user_tag, FullRankInfo orig, FullRankInfo dest)
const
163 return _tag(user_tag, orig.localRank(), dest.localRank());
165 MessageTag tagForReceive(MessageTag user_tag, MessageRank orig_local, MessageRank dest_local)
const
167 return _tag(user_tag, orig_local, dest_local);
169 MessageTag tagForReceive(MessageTag user_tag, SourceDestinationFullRankInfo fri)
const
171 return tagForReceive(user_tag, fri.source(), fri.destination());
177 return t % m_nb_rank;
184 Int64 utag = user_tag.value();
185 if (utag > MAX_USER_TAG)
186 ARCANE_FATAL(
"User tag is too big v={0} max={1}", utag, MAX_USER_TAG);
191 return MessageTag(CheckedConvert::toInt32(new_tag));
206class HybridMessageQueue
212 Int32 local_nb_rank);
224 MessageId probe(
const MP::PointToPointMessageInfo& message);
225 MP::MessageSourceInfo legacyProbe(
const MP::PointToPointMessageInfo& message);
226 const RankTagBuilder& rankTagBuilder()
const {
return m_rank_tag_builder; }
233 Int32 m_local_nb_rank;
235 Int32 m_debug_level = 0;
236 bool m_is_allow_null_rank_for_any_source =
true;
256 MessageId _probe(
const MP::PointToPointMessageInfo& message,
bool use_message_id);
#define ARCANE_FATAL(...)
Macro throwing a FatalErrorException.
Declarations of Arcane's general types.
File containing declarations concerning the message passing model.
Modifiable view of an array of type T.
Correspondence information between the different ranks of a communicator.
MP::MessageRank m_global_rank
Global rank within the communicator.
MP::MessageRank globalRank() const
Global rank within the communicator.
MP::MessageRank mpiRank() const
Associated MPI rank.
MP::MessageRank localRank() const
Local rank within the threads.
MP::MessageRank m_mpi_rank
Associated MPI rank.
MP::MessageRank m_local_rank
Local rank within the threads.
Interface of a message queue with threads.
Int32 value() const
Rank value.
Information for sending/receiving a point-to-point message.
MessageRank emiterRank() const
Message sender rank.
MessageRank destinationRank() const
Message destination rank.
Class to calculate a tag containing sender and receiver information from a user tag.
static constexpr Int32 MAX_USER_TAG_BIT
We allow 2^14 tags, i.e., 16384.
Int32 getReceiveRankFromTag(MessageTag internal_tag) const
Retrieves the rank from the tag. This is the inverse operation of _tag().
RankTagBuilder(Int32 nb_rank)
Constructs an instance for local_nb_rank.
Receive buffer information.
Encapsulates source/destination information.
Parallelism manager using MPI.
TraceAccessor(ITraceMng *m)
Constructs an accessor via the trace manager m.
Declarations of types and methods used by message exchange mechanisms.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
std::int64_t Int64
Signed integer type of 64 bits.
Int32 Integer
Type representing an integer.
std::int32_t Int32
Signed integer type of 32 bits.