Arcane  4.2.3.0
Developer documentation
Loading...
Searching...
No Matches
Messages.h
Go to the documentation of this file.
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* Messages.h (C) 2000-2026 */
9/* */
10/* Interface for the message exchange manager. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCCORE_MESSAGEPASSING_MESSAGES_H
13#define ARCCORE_MESSAGEPASSING_MESSAGES_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arccore/message_passing/IMessagePassingMng.h"
18#include "arccore/message_passing/IDispatchers.h"
19#include "arccore/message_passing/ITypeDispatcher.h"
20#include "arccore/message_passing/Request.h"
21
23#include "arccore/base/Span.h"
24
25/*---------------------------------------------------------------------------*/
26/*---------------------------------------------------------------------------*/
27
29{
30
31/*---------------------------------------------------------------------------*/
32/*---------------------------------------------------------------------------*/
33
34#define ARCCORE_GENERATE_MESSAGEPASSING_PROTOTYPE(type) \
35 \
36 extern "C++" ARCCORE_MESSAGEPASSING_EXPORT void \
37 mpAllGather(IMessagePassingMng* pm, Span<const type> send_buf, Span<type> recv_buf); \
38 \
39 extern "C++" ARCCORE_MESSAGEPASSING_EXPORT void \
40 mpGather(IMessagePassingMng* pm, Span<const type> send_buf, Span<type> recv_buf, Int32 rank); \
41 \
42 extern "C++" ARCCORE_MESSAGEPASSING_EXPORT Request \
43 mpNonBlockingAllGather(IMessagePassingMng* pm, Span<const type> send_buf, Span<type> recv_buf); \
44 \
45 extern "C++" ARCCORE_MESSAGEPASSING_EXPORT Request \
46 mpNonBlockingGather(IMessagePassingMng* pm, Span<const type> send_buf, Span<type> recv_buf, Int32 rank); \
47 \
48 extern "C++" ARCCORE_MESSAGEPASSING_EXPORT void \
49 mpAllGatherVariable(IMessagePassingMng* pm, Span<const type> send_buf, Array<type>& recv_buf); \
50 \
51 extern "C++" ARCCORE_MESSAGEPASSING_EXPORT void \
52 mpGatherVariable(IMessagePassingMng* pm, Span<const type> send_buf, Array<type>& recv_buf, Int32 rank); \
53 \
54 extern "C++" ARCCORE_MESSAGEPASSING_EXPORT Request \
55 mpGather(IMessagePassingMng* pm, GatherMessageInfo<type>& gather_info); \
56 \
57 extern "C++" ARCCORE_MESSAGEPASSING_EXPORT void \
58 mpScatterVariable(IMessagePassingMng* pm, Span<const type> send_buf, Span<type> recv_buf, Int32 root); \
59 \
60 extern "C++" ARCCORE_MESSAGEPASSING_EXPORT type \
61 mpAllReduce(IMessagePassingMng* pm, eReduceType rt, type v); \
62 \
63 extern "C++" ARCCORE_MESSAGEPASSING_EXPORT void \
64 mpAllReduce(IMessagePassingMng* pm, eReduceType rt, Span<type> buf); \
65 \
66 extern "C++" ARCCORE_MESSAGEPASSING_EXPORT void \
67 mpAllReduce(IMessagePassingMng* pm, eReduceType rt, Span<const type> send_buf, Span<type> receive_buf); \
68 \
69 extern "C++" ARCCORE_MESSAGEPASSING_EXPORT void \
70 mpScanExclusive(IMessagePassingMng* pm, eReduceType rt, Span<const type> send_buf, Span<type> receive_buf); \
71 \
72 extern "C++" ARCCORE_MESSAGEPASSING_EXPORT Request \
73 mpNonBlockingAllReduce(IMessagePassingMng* pm, eReduceType rt, Span<const type> send_buf, Span<type> recv_buf); \
74 \
75 extern "C++" ARCCORE_MESSAGEPASSING_EXPORT void \
76 mpBroadcast(IMessagePassingMng* pm, Span<type> send_buf, Int32 rank); \
77 \
78 extern "C++" ARCCORE_MESSAGEPASSING_EXPORT Request \
79 mpNonBlockingBroadcast(IMessagePassingMng* pm, Span<type> send_buf, Int32 rank); \
80 \
81 extern "C++" ARCCORE_MESSAGEPASSING_EXPORT void \
82 mpSend(IMessagePassingMng* pm, Span<const type> values, Int32 rank); \
83 \
84 extern "C++" ARCCORE_MESSAGEPASSING_EXPORT void \
85 mpReceive(IMessagePassingMng* pm, Span<type> values, Int32 rank); \
86 \
87 extern "C++" ARCCORE_MESSAGEPASSING_EXPORT Request \
88 mpSend(IMessagePassingMng* pm, Span<const type> values, Int32 rank, bool is_blocked); \
89 \
90 extern "C++" ARCCORE_MESSAGEPASSING_EXPORT Request \
91 mpSend(IMessagePassingMng* pm, Span<const type> values, const PointToPointMessageInfo& message); \
92 \
93 extern "C++" ARCCORE_MESSAGEPASSING_EXPORT Request \
94 mpReceive(IMessagePassingMng* pm, Span<type> values, Int32 rank, bool is_blocked); \
95 \
96 extern "C++" ARCCORE_MESSAGEPASSING_EXPORT Request \
97 mpReceive(IMessagePassingMng* pm, Span<type> values, const PointToPointMessageInfo& message); \
98 \
99 extern "C++" ARCCORE_MESSAGEPASSING_EXPORT void \
100 mpAllToAll(IMessagePassingMng* pm, Span<const type> send_buf, Span<type> recv_buf, Int32 count); \
101 \
102 extern "C++" ARCCORE_MESSAGEPASSING_EXPORT Request \
103 mpNonBlockingAllToAll(IMessagePassingMng* pm, Span<const type> send_buf, Span<type> recv_buf, Int32 count); \
104 \
105 extern "C++" ARCCORE_MESSAGEPASSING_EXPORT void \
106 mpAllToAllVariable(IMessagePassingMng* pm, Span<const type> send_buf, ConstArrayView<Int32> send_count, \
107 ConstArrayView<Int32> send_index, Span<type> recv_buf, \
108 ConstArrayView<Int32> recv_count, ConstArrayView<Int32> recv_index); \
109 \
110 extern "C++" ARCCORE_MESSAGEPASSING_EXPORT Request \
111 mpNonBlockingAllToAllVariable(IMessagePassingMng* pm, Span<const type> send_buf, ConstArrayView<Int32> send_count, \
112 ConstArrayView<Int32> send_index, Span<type> recv_buf, \
113 ConstArrayView<Int32> recv_count, ConstArrayView<Int32> recv_index);
114
115/*---------------------------------------------------------------------------*/
116/*---------------------------------------------------------------------------*/
117
123ARCCORE_MESSAGEPASSING_EXPORT Ref<IRequestList>
125
126/*---------------------------------------------------------------------------*/
127/*---------------------------------------------------------------------------*/
128
132ARCCORE_MESSAGEPASSING_EXPORT void
133mpWaitAll(IMessagePassingMng* pm, ArrayView<Request> requests);
134
135/*---------------------------------------------------------------------------*/
136/*---------------------------------------------------------------------------*/
137
141ARCCORE_MESSAGEPASSING_EXPORT void
142mpWait(IMessagePassingMng* pm, Request request);
143
144/*---------------------------------------------------------------------------*/
145/*---------------------------------------------------------------------------*/
146
153ARCCORE_MESSAGEPASSING_EXPORT void
154mpWaitSome(IMessagePassingMng* pm, ArrayView<Request> requests, ArrayView<bool> indexes);
155
156/*---------------------------------------------------------------------------*/
157/*---------------------------------------------------------------------------*/
158
165ARCCORE_MESSAGEPASSING_EXPORT void
166mpTestSome(IMessagePassingMng* pm, ArrayView<Request> requests, ArrayView<bool> indexes);
167
168/*---------------------------------------------------------------------------*/
169/*---------------------------------------------------------------------------*/
170
177ARCCORE_MESSAGEPASSING_EXPORT void
178mpWait(IMessagePassingMng* pm, ArrayView<Request> requests,
179 ArrayView<bool> indexes, eWaitType wait_type);
180
181/*---------------------------------------------------------------------------*/
182/*---------------------------------------------------------------------------*/
183
201ARCCORE_MESSAGEPASSING_EXPORT MessageId
203
204/*---------------------------------------------------------------------------*/
205/*---------------------------------------------------------------------------*/
206
224ARCCORE_MESSAGEPASSING_EXPORT MessageSourceInfo
226
227/*---------------------------------------------------------------------------*/
228/*---------------------------------------------------------------------------*/
239ARCCORE_DEPRECATED_REASON("Y2026: Use mpSplitCommunicator() instead.")
240ARCCORE_MESSAGEPASSING_EXPORT IMessagePassingMng*
241mpSplit(IMessagePassingMng* pm, bool keep);
242
243/*---------------------------------------------------------------------------*/
244/*---------------------------------------------------------------------------*/
252ARCCORE_MESSAGEPASSING_EXPORT Ref<IMessagePassingMng>
254
255/*---------------------------------------------------------------------------*/
256/*---------------------------------------------------------------------------*/
257
263ARCCORE_MESSAGEPASSING_EXPORT void
265
266/*---------------------------------------------------------------------------*/
267/*---------------------------------------------------------------------------*/
268
272ARCCORE_MESSAGEPASSING_EXPORT Request
274
275/*---------------------------------------------------------------------------*/
276/*---------------------------------------------------------------------------*/
277
283ARCCORE_MESSAGEPASSING_EXPORT Ref<ISerializeMessageList>
285
287ARCCORE_MESSAGEPASSING_EXPORT Request
288mpSend(IMessagePassingMng* pm, const ISerializer* values, const PointToPointMessageInfo& message);
289
291ARCCORE_MESSAGEPASSING_EXPORT Request
292mpReceive(IMessagePassingMng* pm, ISerializer* values, const PointToPointMessageInfo& message);
293
295ARCCORE_MESSAGEPASSING_EXPORT void
296mpAllGather(IMessagePassingMng* pm, const ISerializer* send_serializer, ISerializer* recv_serializer);
297
298/*---------------------------------------------------------------------------*/
299/*---------------------------------------------------------------------------*/
300
310ARCCORE_MESSAGEPASSING_EXPORT Ref<ISerializeMessage>
312
318ARCCORE_MESSAGEPASSING_EXPORT Ref<ISerializeMessage>
320
329ARCCORE_MESSAGEPASSING_EXPORT Ref<ISerializeMessage>
331
340ARCCORE_MESSAGEPASSING_EXPORT Ref<ISerializeMessage>
342
343/*---------------------------------------------------------------------------*/
344/*---------------------------------------------------------------------------*/
345
346ARCCORE_GENERATE_MESSAGEPASSING_PROTOTYPE(char)
347ARCCORE_GENERATE_MESSAGEPASSING_PROTOTYPE(signed char)
348ARCCORE_GENERATE_MESSAGEPASSING_PROTOTYPE(unsigned char)
349
350ARCCORE_GENERATE_MESSAGEPASSING_PROTOTYPE(short)
351ARCCORE_GENERATE_MESSAGEPASSING_PROTOTYPE(unsigned short)
352ARCCORE_GENERATE_MESSAGEPASSING_PROTOTYPE(int)
353ARCCORE_GENERATE_MESSAGEPASSING_PROTOTYPE(unsigned int)
354ARCCORE_GENERATE_MESSAGEPASSING_PROTOTYPE(long)
355ARCCORE_GENERATE_MESSAGEPASSING_PROTOTYPE(unsigned long)
356ARCCORE_GENERATE_MESSAGEPASSING_PROTOTYPE(long long)
357ARCCORE_GENERATE_MESSAGEPASSING_PROTOTYPE(unsigned long long)
358
359ARCCORE_GENERATE_MESSAGEPASSING_PROTOTYPE(float)
360ARCCORE_GENERATE_MESSAGEPASSING_PROTOTYPE(double)
361ARCCORE_GENERATE_MESSAGEPASSING_PROTOTYPE(long double)
362
363ARCCORE_GENERATE_MESSAGEPASSING_PROTOTYPE(BFloat16)
364ARCCORE_GENERATE_MESSAGEPASSING_PROTOTYPE(Float16)
365
366#undef ARCCORE_GENERATE_MESSAGEPASSING_PROTOTYPE
367
368/*---------------------------------------------------------------------------*/
369/*---------------------------------------------------------------------------*/
370
371} // namespace Arcane::MessagePassing
372
373/*---------------------------------------------------------------------------*/
374/*---------------------------------------------------------------------------*/
375
377{
409} // namespace Arccore::MessagePassing
410
411/*---------------------------------------------------------------------------*/
412/*---------------------------------------------------------------------------*/
413
414#endif
Types and functions associated with the classes SpanImpl, SmallSpan and Span.
Half-precision floating-point type.
Interface of the message passing manager.
Information about the source of a message.
Information for sending/receiving a point-to-point message.
Declarations of types and methods used by message exchange mechanisms.
C void mpGather(IMessagePassingMng *pm, Span< const char > send_buf, Span< char > recv_buf, Int32 rank)
Ref< ISerializeMessage > mpCreateSerializeMessage(IMessagePassingMng *pm, MessageRank target, ePointToPointMessageType type)
Creates a serialization message.
Definition Messages.cc:335
C void mpScatterVariable(IMessagePassingMng *pm, Span< const char > send_buf, Span< char > recv_buf, Int32 root)
C Request mpNonBlockingAllGather(IMessagePassingMng *pm, Span< const char > send_buf, Span< char > recv_buf)
C void mpBroadcast(IMessagePassingMng *pm, Span< char > send_buf, Int32 rank)
void mpTestSome(IMessagePassingMng *pm, ArrayView< Request > requests, ArrayView< bool > indexes)
Tests if any of the requests in request are finished.
Definition Messages.cc:190
Ref< ISerializeMessageList > mpCreateSerializeMessageListRef(IMessagePassingMng *pm)
Creates a serialization message list.
Definition Messages.cc:279
Ref< ISerializeMessage > mpCreateSendSerializeMessage(IMessagePassingMng *pm, MessageRank destination)
Creates a serialization message for sending.
Definition Messages.cc:347
MessageSourceInfo mpLegacyProbe(IMessagePassingMng *pm, const PointToPointMessageInfo &message)
Tests if a message is available.
Definition Messages.cc:230
Ref< IMessagePassingMng > mpSplitCommunicator(IMessagePassingMng *pm, bool keep)
Creates a sub communicator.
Definition Messages.cc:250
Ref< ISerializeMessage > mpCreateReceiveSerializeMessage(IMessagePassingMng *pm, MessageRank source)
Creates a serialization message for receiving.
Definition Messages.cc:353
MessageId mpProbe(IMessagePassingMng *pm, const PointToPointMessageInfo &message)
Tests if a message is available.
Definition Messages.cc:220
C void mpAllToAll(IMessagePassingMng *pm, Span< const char > send_buf, Span< char > recv_buf, Int32 count)
C Request mpNonBlockingAllToAll(IMessagePassingMng *pm, Span< const char > send_buf, Span< char > recv_buf, Int32 count)
C void mpAllToAllVariable(IMessagePassingMng *pm, Span< const char > send_buf, ConstArrayView< Int32 > send_count, ConstArrayView< Int32 > send_index, Span< char > recv_buf, ConstArrayView< Int32 > recv_count, ConstArrayView< Int32 > recv_index)
C void mpGatherVariable(IMessagePassingMng *pm, Span< const char > send_buf, Array< char > &recv_buf, Int32 rank)
C char mpAllReduce(IMessagePassingMng *pm, eReduceType rt, char v)
Ref< IRequestList > mpCreateRequestListRef(IMessagePassingMng *pm)
Creates a list of requests.
Definition Messages.cc:155
C void mpAllGatherVariable(IMessagePassingMng *pm, Span< const char > send_buf, Array< char > &recv_buf)
void mpBarrier(IMessagePassingMng *pm)
Performs a barrier.
Definition Messages.cc:259
Request mpNonBlockingBarrier(IMessagePassingMng *pm)
Performs a non-blocking barrier.
Definition Messages.cc:269
void mpWait(IMessagePassingMng *pm, Request request)
Blocks until the request request is finished.
Definition Messages.cc:173
void mpAllGather(IMessagePassingMng *pm, const ISerializer *send_serializer, ISerializer *receive_serialize)
allGather() message for serialization
Definition Messages.cc:319
void mpWaitAll(IMessagePassingMng *pm, ArrayView< Request > requests)
Blocks until the requests in requests are finished.
Definition Messages.cc:164
IMessagePassingMng * mpSplit(IMessagePassingMng *pm, bool keep)
Creates a sub communicator.
Definition Messages.cc:240
C Request mpNonBlockingAllToAllVariable(IMessagePassingMng *pm, Span< const char > send_buf, ConstArrayView< Int32 > send_count, ConstArrayView< Int32 > send_index, Span< char > recv_buf, ConstArrayView< Int32 > recv_count, ConstArrayView< Int32 > recv_index)
ePointToPointMessageType
Point-to-point message type.
C Request mpNonBlockingGather(IMessagePassingMng *pm, Span< const char > send_buf, Span< char > recv_buf, Int32 rank)
Request mpReceive(IMessagePassingMng *pm, ISerializer *values, const PointToPointMessageInfo &message)
Receive message using an ISerializer.
Definition Messages.cc:300
void mpWaitSome(IMessagePassingMng *pm, ArrayView< Request > requests, ArrayView< bool > indexes)
Blocks until at least one of the requests in request is finished.
Definition Messages.cc:181
C Request mpNonBlockingBroadcast(IMessagePassingMng *pm, Span< char > send_buf, Int32 rank)
Request mpSend(IMessagePassingMng *pm, const ISerializer *values, const PointToPointMessageInfo &message)
Send message using an ISerializer.
Definition Messages.cc:289
C Request mpNonBlockingAllReduce(IMessagePassingMng *pm, eReduceType rt, Span< const char > send_buf, Span< char > recv_buf)
Namespace containing the types and declarations that manage the message-passing parallelism mechanism...