16#include "arccore/base/NotSupportedException.h"
17#include "arccore/base/FatalErrorException.h"
18#include "arccore/base/NotImplementedException.h"
20#include "arccore/serialize/BasicSerializer.h"
21#include "arccore/serialize/internal/BasicSerializerInternal.h"
23#include "arccore/message_passing/BasicSerializeMessage.h"
24#include "arccore/message_passing/ISerializeDispatcher.h"
25#include "arccore/message_passing/IControlDispatcher.h"
26#include "arccore/message_passing/MessageId.h"
27#include "arccore/message_passing/PointToPointMessageInfo.h"
51 template <
typename DataType>
void
56 recv_buffer.
copy(buf);
63void BasicSerializeGatherMessage::
89 sizes[0] = send_real.
size();
90 sizes[1] = send_int16.
size();
91 sizes[2] = send_int32.
size();
92 sizes[3] = send_int64.
size();
93 sizes[4] = send_byte.
size();
94 sizes[5] = send_int8.
size();
95 sizes[6] = send_float16.
size();
96 sizes[7] = send_bfloat16.
size();
97 sizes[8] = send_float32.
size();
98 sizes[9] = send_float128.
size();
99 sizes[10] = send_int128.
size();
103 Int64 recv_nb_real = sizes[0];
104 Int64 recv_nb_int16 = sizes[1];
105 Int64 recv_nb_int32 = sizes[2];
106 Int64 recv_nb_int64 = sizes[3];
107 Int64 recv_nb_byte = sizes[4];
108 Int64 recv_nb_int8 = sizes[5];
109 Int64 recv_nb_float16 = sizes[6];
110 Int64 recv_nb_bfloat16 = sizes[7];
111 Int64 recv_nb_float32 = sizes[8];
112 Int64 recv_nb_float128 = sizes[9];
113 Int64 recv_nb_int128 = sizes[10];
115 if (recv_nb_float16 != 0)
117 if (recv_nb_bfloat16 != 0)
119 if (recv_nb_float128 != 0)
121 if (recv_nb_int128 != 0)
124 recv_p2->allocateBuffer(recv_nb_real, recv_nb_int16, recv_nb_int32, recv_nb_int64, recv_nb_byte,
125 recv_nb_int8, recv_nb_float16, recv_nb_bfloat16, recv_nb_float32, recv_nb_float128, recv_nb_int128);
127 auto recv_p = recv_buf->_p();
129 _doGatherOne(pm, send_real, recv_p->getRealBuffer());
130 _doGatherOne(pm, send_int32, recv_p->getInt32Buffer());
131 _doGatherOne(pm, send_int16, recv_p->getInt16Buffer());
132 _doGatherOne(pm, send_int64, recv_p->getInt64Buffer());
133 _doGatherOne(pm, send_byte, recv_p->getByteBuffer());
134 _doGatherOne(pm, send_int8, recv_p->getInt8Buffer());
135 _doGatherOne(pm, send_float32, recv_p->getFloat32Buffer());
156 auto d = pm->dispatchers()->controlDispatcher();
165 auto d = pm->dispatchers()->controlDispatcher();
166 d->waitAllRequests(requests);
182 auto d = pm->dispatchers()->controlDispatcher();
183 d->waitSomeRequests(requests, indexes,
false);
191 auto d = pm->dispatchers()->controlDispatcher();
192 d->waitSomeRequests(requests, indexes,
true);
221 auto d = pm->dispatchers()->controlDispatcher();
222 return d->probe(message);
231 auto d = pm->dispatchers()->controlDispatcher();
232 return d->legacyProbe(message);
241 auto d = pm->dispatchers()->controlDispatcher();
242 return d->commSplit(keep);
251 auto d = pm->dispatchers()->controlDispatcher();
252 return d->splitCommunicator(keep);
260 auto d = pm->dispatchers()->controlDispatcher();
270 auto d = pm->dispatchers()->controlDispatcher();
271 return d->nonBlockingBarrier();
280 auto d = pm->dispatchers()->serializeDispatcher();
291 auto d = pm->dispatchers()->serializeDispatcher();
302 auto d = pm->dispatchers()->serializeDispatcher();
325 ARCCORE_FATAL(
"receive_serializer is not a BasicSerializer");
327 message.doAllGather(pm, s, r);
366 DataType* x =
nullptr;
367 auto* dispatcher = pm->dispatchers()->dispatcher(x);
373#define ARCCORE_GENERATE_MESSAGEPASSING_DEFINITION(type) \
374 void mpAllGather(IMessagePassingMng* pm, Span<const type> send_buf, Span<type> recv_buf) \
376 _getDispatcher<type>(pm)->allGather(send_buf, recv_buf); \
378 void mpGather(IMessagePassingMng* pm, Span<const type> send_buf, Span<type> recv_buf, Int32 rank) \
380 _getDispatcher<type>(pm)->gather(send_buf, recv_buf, rank); \
382 Request mpNonBlockingAllGather(IMessagePassingMng* pm, Span<const type> send_buf, Span<type> recv_buf) \
384 return _getDispatcher<type>(pm)->nonBlockingAllGather(send_buf, recv_buf); \
386 Request mpNonBlockingGather(IMessagePassingMng* pm, Span<const type> send_buf, Span<type> recv_buf, Int32 rank) \
388 return _getDispatcher<type>(pm)->nonBlockingGather(send_buf, recv_buf, rank); \
390 void mpAllGatherVariable(IMessagePassingMng* pm, Span<const type> send_buf, Array<type>& recv_buf) \
392 _getDispatcher<type>(pm)->allGatherVariable(send_buf, recv_buf); \
394 void mpGatherVariable(IMessagePassingMng* pm, Span<const type> send_buf, Array<type>& recv_buf, Int32 rank) \
396 _getDispatcher<type>(pm)->gatherVariable(send_buf, recv_buf, rank); \
398 Request mpGather(IMessagePassingMng* pm, GatherMessageInfo<type>& gather_info) \
400 return _getDispatcher<type>(pm)->gather(gather_info); \
402 void mpScatterVariable(IMessagePassingMng* pm, Span<const type> send_buf, Span<type> recv_buf, Int32 root) \
404 return _getDispatcher<type>(pm)->scatterVariable(send_buf, recv_buf, root); \
406 type mpAllReduce(IMessagePassingMng* pm, eReduceType rt, type v) \
408 return _getDispatcher<type>(pm)->allReduce(rt, v); \
410 void mpAllReduce(IMessagePassingMng* pm, eReduceType rt, Span<type> buf) \
412 _getDispatcher<type>(pm)->allReduce(rt, buf); \
414 void mpAllReduce(IMessagePassingMng* pm, eReduceType rt, Span<const type> send_buf, Span<type> receive_buf) \
416 _getDispatcher<type>(pm)->allReduce(rt, send_buf, receive_buf); \
418 void mpScanExclusive(IMessagePassingMng* pm, eReduceType rt, Span<const type> send_buf, Span<type> receive_buf) \
420 _getDispatcher<type>(pm)->scanExclusive(rt, send_buf, receive_buf); \
422 Request mpNonBlockingAllReduce(IMessagePassingMng* pm, eReduceType rt, Span<const type> send_buf, Span<type> recv_buf) \
424 return _getDispatcher<type>(pm)->nonBlockingAllReduce(rt, send_buf, recv_buf); \
426 void mpBroadcast(IMessagePassingMng* pm, Span<type> send_buf, Int32 rank) \
428 _getDispatcher<type>(pm)->broadcast(send_buf, rank); \
430 Request mpNonBlockingBroadcast(IMessagePassingMng* pm, Span<type> send_buf, Int32 rank) \
432 return _getDispatcher<type>(pm)->nonBlockingBroadcast(send_buf, rank); \
434 void mpSend(IMessagePassingMng* pm, Span<const type> values, Int32 rank) \
436 _getDispatcher<type>(pm)->send(values, rank, true); \
438 void mpReceive(IMessagePassingMng* pm, Span<type> values, Int32 rank) \
440 _getDispatcher<type>(pm)->receive(values, rank, true); \
442 Request mpSend(IMessagePassingMng* pm, Span<const type> values, Int32 rank, bool is_blocked) \
444 return _getDispatcher<type>(pm)->send(values, rank, is_blocked); \
446 Request mpSend(IMessagePassingMng* pm, Span<const type> values, const PointToPointMessageInfo& message) \
448 return _getDispatcher<type>(pm)->send(values, message); \
450 Request mpReceive(IMessagePassingMng* pm, Span<type> values, Int32 rank, bool is_blocked) \
452 return _getDispatcher<type>(pm)->receive(values, rank, is_blocked); \
454 Request mpReceive(IMessagePassingMng* pm, Span<type> values, const PointToPointMessageInfo& message) \
456 return _getDispatcher<type>(pm)->receive(values, message); \
458 void mpAllToAll(IMessagePassingMng* pm, Span<const type> send_buf, Span<type> recv_buf, Int32 count) \
460 return _getDispatcher<type>(pm)->allToAll(send_buf, recv_buf, count); \
462 Request mpNonBlockingAllToAll(IMessagePassingMng* pm, Span<const type> send_buf, Span<type> recv_buf, Int32 count) \
464 return _getDispatcher<type>(pm)->nonBlockingAllToAll(send_buf, recv_buf, count); \
466 void mpAllToAllVariable(IMessagePassingMng* pm, Span<const type> send_buf, ConstArrayView<Int32> send_count, \
467 ConstArrayView<Int32> send_index, Span<type> recv_buf, \
468 ConstArrayView<Int32> recv_count, ConstArrayView<Int32> recv_index) \
470 _getDispatcher<type>(pm)->allToAllVariable(send_buf, send_count, send_index, recv_buf, recv_count, recv_index); \
472 Request mpNonBlockingAllToAllVariable(IMessagePassingMng* pm, Span<const type> send_buf, ConstArrayView<Int32> send_count, \
473 ConstArrayView<Int32> send_index, Span<type> recv_buf, \
474 ConstArrayView<Int32> recv_count, ConstArrayView<Int32> recv_index) \
476 return _getDispatcher<type>(pm)->nonBlockingAllToAllVariable(send_buf, send_count, send_index, recv_buf, recv_count, recv_index); \
482ARCCORE_GENERATE_MESSAGEPASSING_DEFINITION(
char)
483ARCCORE_GENERATE_MESSAGEPASSING_DEFINITION(
signed char)
484ARCCORE_GENERATE_MESSAGEPASSING_DEFINITION(
unsigned char)
486ARCCORE_GENERATE_MESSAGEPASSING_DEFINITION(
short)
487ARCCORE_GENERATE_MESSAGEPASSING_DEFINITION(
unsigned short)
488ARCCORE_GENERATE_MESSAGEPASSING_DEFINITION(
int)
489ARCCORE_GENERATE_MESSAGEPASSING_DEFINITION(
unsigned int)
490ARCCORE_GENERATE_MESSAGEPASSING_DEFINITION(
long)
491ARCCORE_GENERATE_MESSAGEPASSING_DEFINITION(
unsigned long)
492ARCCORE_GENERATE_MESSAGEPASSING_DEFINITION(
long long)
493ARCCORE_GENERATE_MESSAGEPASSING_DEFINITION(
unsigned long long)
495ARCCORE_GENERATE_MESSAGEPASSING_DEFINITION(
float)
496ARCCORE_GENERATE_MESSAGEPASSING_DEFINITION(
double)
497ARCCORE_GENERATE_MESSAGEPASSING_DEFINITION(
long double)
499ARCCORE_GENERATE_MESSAGEPASSING_DEFINITION(BFloat16)
500ARCCORE_GENERATE_MESSAGEPASSING_DEFINITION(
Float16)
#define ARCCORE_FATAL(...)
Macro envoyant une exception FatalErrorException.
#define ARCCORE_THROW(exception_class,...)
Macro pour envoyer une exception avec formattage.
#define ARCCORE_CHECK_POINTER(ptr)
Macro retournant le pointeur ptr s'il est non nul ou lancant une exception s'il est nul.
Liste des fonctions d'échange de message.
Vue modifiable d'un tableau d'un type T.
void fill(const T &o) noexcept
Remplit le tableau avec la valeur o.
Implémentation basique de 'ISerializer'.
Interface d'un sérialiseur.
virtual Ref< IRequestList > createRequestListRef()=0
Création d'une liste de requêtes associé à ce gestionnaire.
Interface du gestionnaire des échanges de messages.
virtual Int32 commRank() const =0
Rang de cette instance dans le communicateur.
virtual Request receiveSerializer(ISerializer *s, const PointToPointMessageInfo &message)=0
Message de réception.
virtual Request sendSerializer(const ISerializer *s, const PointToPointMessageInfo &message)=0
Message d'envoi.
virtual Ref< ISerializeMessageList > createSerializeMessageListRef()=0
Créé une liste de messages de sérialisation.
Gestion des messages parallèles pour le type Type.
Informations sur la source d'un message.
Informations pour envoyer/recevoir un message point à point.
Exception lorsqu'une fonction n'est pas implémentée.
Exception lorsqu'une opération n'est pas supportée.
Référence à une instance.
__host__ __device__ void copy(const U ©_array)
Recopie le tableau copy_array dans l'instance.
constexpr __host__ __device__ SizeType size() const noexcept
Retourne la taille du tableau.
Vue d'un tableau d'éléments de type T.
Vecteur 1D de données avec sémantique par valeur (style STL).
Déclarations des types et méthodes utilisés par les mécanismes d'échange de messages.
Ref< ISerializeMessage > mpCreateSerializeMessage(IMessagePassingMng *pm, MessageRank target, ePointToPointMessageType type)
Créé un message de sérialisation.
void mpTestSome(IMessagePassingMng *pm, ArrayView< Request > requests, ArrayView< bool > indexes)
Teste si des requêtes de request sont terminées.
Ref< ISerializeMessageList > mpCreateSerializeMessageListRef(IMessagePassingMng *pm)
Créé une liste de messages de sérialisation.
Ref< ISerializeMessage > mpCreateSendSerializeMessage(IMessagePassingMng *pm, MessageRank destination)
Créé un message de sérialisation en envoi.
MessageSourceInfo mpLegacyProbe(IMessagePassingMng *pm, const PointToPointMessageInfo &message)
Teste si un message est disponible.
Ref< IMessagePassingMng > mpSplitCommunicator(IMessagePassingMng *pm, bool keep)
Créé un sous-communicateur.
Ref< ISerializeMessage > mpCreateReceiveSerializeMessage(IMessagePassingMng *pm, MessageRank source)
Créé un message de sérialisation en envoi.
MessageId mpProbe(IMessagePassingMng *pm, const PointToPointMessageInfo &message)
Teste si un message est disponible.
C char mpAllReduce(IMessagePassingMng *pm, eReduceType rt, char v)
Ref< IRequestList > mpCreateRequestListRef(IMessagePassingMng *pm)
Créé une liste de requêtes.
C void mpAllGatherVariable(IMessagePassingMng *pm, Span< const char > send_buf, Array< char > &recv_buf)
@ WaitSome
Attend que tous les messages de la liste soient traités.
void mpBarrier(IMessagePassingMng *pm)
Effectue une barrière.
Request mpNonBlockingBarrier(IMessagePassingMng *pm)
Effectue une barrière non bloquante.
void mpWait(IMessagePassingMng *pm, Request request)
Bloque jusqu'à ce que la requête request soit terminée.
void mpAllGather(IMessagePassingMng *pm, const ISerializer *send_serializer, ISerializer *receive_serialize)
Message allGather() pour une sérialisation.
void mpWaitAll(IMessagePassingMng *pm, ArrayView< Request > requests)
Bloque tant que les requêtes de requests ne sont pas terminées.
IMessagePassingMng * mpSplit(IMessagePassingMng *pm, bool keep)
Créé un sous-communicateur.
ePointToPointMessageType
Type de message point à point.
@ ReduceSum
Somme des valeurs.
Request mpReceive(IMessagePassingMng *pm, ISerializer *values, const PointToPointMessageInfo &message)
Message de réception utilisant un ISerializer.
void mpWaitSome(IMessagePassingMng *pm, ArrayView< Request > requests, ArrayView< bool > indexes)
Bloque jusqu'à ce qu'au moins une des requêtes de request soit terminée.
Request mpSend(IMessagePassingMng *pm, const ISerializer *values, const PointToPointMessageInfo &message)
Message d'envoi utilisant un ISerializer.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
std::int64_t Int64
Type entier signé sur 64 bits.
@ Float16
Donnée de type Float16.