Arcane  4.1.12.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-2025 */
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 Request \
67 mpNonBlockingAllReduce(IMessagePassingMng* pm, eReduceType rt, Span<const type> send_buf, Span<type> recv_buf); \
68 \
69 extern "C++" ARCCORE_MESSAGEPASSING_EXPORT void \
70 mpBroadcast(IMessagePassingMng* pm, Span<type> send_buf, Int32 rank); \
71 \
72 extern "C++" ARCCORE_MESSAGEPASSING_EXPORT Request \
73 mpNonBlockingBroadcast(IMessagePassingMng* pm, Span<type> send_buf, Int32 rank); \
74 \
75 extern "C++" ARCCORE_MESSAGEPASSING_EXPORT void \
76 mpSend(IMessagePassingMng* pm, Span<const type> values, Int32 rank); \
77 \
78 extern "C++" ARCCORE_MESSAGEPASSING_EXPORT void \
79 mpReceive(IMessagePassingMng* pm, Span<type> values, Int32 rank); \
80 \
81 extern "C++" ARCCORE_MESSAGEPASSING_EXPORT Request \
82 mpSend(IMessagePassingMng* pm, Span<const type> values, Int32 rank, bool is_blocked); \
83 \
84 extern "C++" ARCCORE_MESSAGEPASSING_EXPORT Request \
85 mpSend(IMessagePassingMng* pm, Span<const type> values, const PointToPointMessageInfo& message); \
86 \
87 extern "C++" ARCCORE_MESSAGEPASSING_EXPORT Request \
88 mpReceive(IMessagePassingMng* pm, Span<type> values, Int32 rank, bool is_blocked); \
89 \
90 extern "C++" ARCCORE_MESSAGEPASSING_EXPORT Request \
91 mpReceive(IMessagePassingMng* pm, Span<type> values, const PointToPointMessageInfo& message); \
92 \
93 extern "C++" ARCCORE_MESSAGEPASSING_EXPORT void \
94 mpAllToAll(IMessagePassingMng* pm, Span<const type> send_buf, Span<type> recv_buf, Int32 count); \
95 \
96 extern "C++" ARCCORE_MESSAGEPASSING_EXPORT Request \
97 mpNonBlockingAllToAll(IMessagePassingMng* pm, Span<const type> send_buf, Span<type> recv_buf, Int32 count); \
98 \
99 extern "C++" ARCCORE_MESSAGEPASSING_EXPORT void \
100 mpAllToAllVariable(IMessagePassingMng* pm, Span<const type> send_buf, ConstArrayView<Int32> send_count, \
101 ConstArrayView<Int32> send_index, Span<type> recv_buf, \
102 ConstArrayView<Int32> recv_count, ConstArrayView<Int32> recv_index); \
103 \
104 extern "C++" ARCCORE_MESSAGEPASSING_EXPORT Request \
105 mpNonBlockingAllToAllVariable(IMessagePassingMng* pm, Span<const type> send_buf, ConstArrayView<Int32> send_count, \
106 ConstArrayView<Int32> send_index, Span<type> recv_buf, \
107 ConstArrayView<Int32> recv_count, ConstArrayView<Int32> recv_index);
108
109/*---------------------------------------------------------------------------*/
110/*---------------------------------------------------------------------------*/
111
117ARCCORE_MESSAGEPASSING_EXPORT Ref<IRequestList>
119
120/*---------------------------------------------------------------------------*/
121/*---------------------------------------------------------------------------*/
122
126ARCCORE_MESSAGEPASSING_EXPORT void
127mpWaitAll(IMessagePassingMng* pm, ArrayView<Request> requests);
128
129/*---------------------------------------------------------------------------*/
130/*---------------------------------------------------------------------------*/
131
135ARCCORE_MESSAGEPASSING_EXPORT void
136mpWait(IMessagePassingMng* pm, Request request);
137
138/*---------------------------------------------------------------------------*/
139/*---------------------------------------------------------------------------*/
140
147ARCCORE_MESSAGEPASSING_EXPORT void
148mpWaitSome(IMessagePassingMng* pm, ArrayView<Request> requests, ArrayView<bool> indexes);
149
150/*---------------------------------------------------------------------------*/
151/*---------------------------------------------------------------------------*/
152
159ARCCORE_MESSAGEPASSING_EXPORT void
160mpTestSome(IMessagePassingMng* pm, ArrayView<Request> requests, ArrayView<bool> indexes);
161
162/*---------------------------------------------------------------------------*/
163/*---------------------------------------------------------------------------*/
164
171ARCCORE_MESSAGEPASSING_EXPORT void
172mpWait(IMessagePassingMng* pm, ArrayView<Request> requests,
173 ArrayView<bool> indexes, eWaitType wait_type);
174
175/*---------------------------------------------------------------------------*/
176/*---------------------------------------------------------------------------*/
177
195ARCCORE_MESSAGEPASSING_EXPORT MessageId
197
198/*---------------------------------------------------------------------------*/
199/*---------------------------------------------------------------------------*/
200
218ARCCORE_MESSAGEPASSING_EXPORT MessageSourceInfo
220
221/*---------------------------------------------------------------------------*/
222/*---------------------------------------------------------------------------*/
223
232ARCCORE_MESSAGEPASSING_EXPORT IMessagePassingMng*
233mpSplit(IMessagePassingMng* pm, bool keep);
234
235/*---------------------------------------------------------------------------*/
236/*---------------------------------------------------------------------------*/
237
243ARCCORE_MESSAGEPASSING_EXPORT void
245
246/*---------------------------------------------------------------------------*/
247/*---------------------------------------------------------------------------*/
248
252ARCCORE_MESSAGEPASSING_EXPORT Request
254
255/*---------------------------------------------------------------------------*/
256/*---------------------------------------------------------------------------*/
257
263ARCCORE_MESSAGEPASSING_EXPORT Ref<ISerializeMessageList>
265
267ARCCORE_MESSAGEPASSING_EXPORT Request
268mpSend(IMessagePassingMng* pm, const ISerializer* values, const PointToPointMessageInfo& message);
269
271ARCCORE_MESSAGEPASSING_EXPORT Request
272mpReceive(IMessagePassingMng* pm, ISerializer* values, const PointToPointMessageInfo& message);
273
275ARCCORE_MESSAGEPASSING_EXPORT void
276mpAllGather(IMessagePassingMng* pm, const ISerializer* send_serializer, ISerializer* recv_serializer);
277
278/*---------------------------------------------------------------------------*/
279/*---------------------------------------------------------------------------*/
280
290ARCCORE_MESSAGEPASSING_EXPORT Ref<ISerializeMessage>
292
298ARCCORE_MESSAGEPASSING_EXPORT Ref<ISerializeMessage>
300
309ARCCORE_MESSAGEPASSING_EXPORT Ref<ISerializeMessage>
311
320ARCCORE_MESSAGEPASSING_EXPORT Ref<ISerializeMessage>
322
323/*---------------------------------------------------------------------------*/
324/*---------------------------------------------------------------------------*/
325
326ARCCORE_GENERATE_MESSAGEPASSING_PROTOTYPE(char)
327ARCCORE_GENERATE_MESSAGEPASSING_PROTOTYPE(signed char)
328ARCCORE_GENERATE_MESSAGEPASSING_PROTOTYPE(unsigned char)
329
330ARCCORE_GENERATE_MESSAGEPASSING_PROTOTYPE(short)
331ARCCORE_GENERATE_MESSAGEPASSING_PROTOTYPE(unsigned short)
332ARCCORE_GENERATE_MESSAGEPASSING_PROTOTYPE(int)
333ARCCORE_GENERATE_MESSAGEPASSING_PROTOTYPE(unsigned int)
334ARCCORE_GENERATE_MESSAGEPASSING_PROTOTYPE(long)
335ARCCORE_GENERATE_MESSAGEPASSING_PROTOTYPE(unsigned long)
336ARCCORE_GENERATE_MESSAGEPASSING_PROTOTYPE(long long)
337ARCCORE_GENERATE_MESSAGEPASSING_PROTOTYPE(unsigned long long)
338
339ARCCORE_GENERATE_MESSAGEPASSING_PROTOTYPE(float)
340ARCCORE_GENERATE_MESSAGEPASSING_PROTOTYPE(double)
341ARCCORE_GENERATE_MESSAGEPASSING_PROTOTYPE(long double)
342
343ARCCORE_GENERATE_MESSAGEPASSING_PROTOTYPE(BFloat16)
344ARCCORE_GENERATE_MESSAGEPASSING_PROTOTYPE(Float16)
345
346#undef ARCCORE_GENERATE_MESSAGEPASSING_PROTOTYPE
347
348/*---------------------------------------------------------------------------*/
349/*---------------------------------------------------------------------------*/
350
351} // namespace Arcane::MessagePassing
352
353/*---------------------------------------------------------------------------*/
354/*---------------------------------------------------------------------------*/
355
357{
389} // namespace Arccore::MessagePassing
390
391/*---------------------------------------------------------------------------*/
392/*---------------------------------------------------------------------------*/
393
394#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:325
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:269
Ref< ISerializeMessage > mpCreateSendSerializeMessage(IMessagePassingMng *pm, MessageRank destination)
Creates a serialization message for sending.
Definition Messages.cc:337
MessageSourceInfo mpLegacyProbe(IMessagePassingMng *pm, const PointToPointMessageInfo &message)
Tests if a message is available.
Definition Messages.cc:230
Ref< ISerializeMessage > mpCreateReceiveSerializeMessage(IMessagePassingMng *pm, MessageRank source)
Creates a serialization message for receiving.
Definition Messages.cc:343
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:249
Request mpNonBlockingBarrier(IMessagePassingMng *pm)
Performs a non-blocking barrier.
Definition Messages.cc:259
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:309
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 new instance of IMessagePassingMng.
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:290
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:279
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...