14#include "arcane/utils/MemoryView.h"
16#include "arcane/parallel/mpi/MpiParallelMng.h"
17#include "arcane/parallel/mpi/MpiDatatypeList.h"
18#include "arcane/parallel/mpi/MpiDatatype.h"
19#include "arcane/parallel/mpi/MpiTimeInterval.h"
20#include "arcane/parallel/IStat.h"
22#include "arcane/impl/IDataSynchronizeBuffer.h"
23#include "arcane/impl/IDataSynchronizeImplementation.h"
25#include "arccore/message_passing_mpi/internal/MpiAdapter.h"
38class MpiDirectSendrecvVariableSynchronizerDispatcher
44 explicit MpiDirectSendrecvVariableSynchronizerDispatcher(
Factory* f);
48 void compute()
override {}
69 : m_mpi_parallel_mng(mpi_pm)
74 auto* x =
new MpiDirectSendrecvVariableSynchronizerDispatcher(
this);
87arcaneCreateMpiDirectSendrecvVariableSynchronizerFactory(
MpiParallelMng* mpi_pm)
96MpiDirectSendrecvVariableSynchronizerDispatcher::
97MpiDirectSendrecvVariableSynchronizerDispatcher(Factory* f)
98: m_mpi_parallel_mng(f->m_mpi_parallel_mng)
105void MpiDirectSendrecvVariableSynchronizerDispatcher::
106beginSynchronize(IDataSynchronizeBuffer* vs_buf)
108 Int32 nb_message = vs_buf->nbRank();
110 constexpr int serialize_tag = 523;
112 MpiParallelMng* pm = m_mpi_parallel_mng;
113 MpiDatatypeList* dtlist = pm->datatypes();
114 const MPI_Datatype mpi_dt = dtlist->datatype(
Byte())->datatype();
116 double sync_copy_send_time = 0.0;
117 double sync_copy_recv_time = 0.0;
118 double sync_wait_time = 0.0;
121 MpiTimeInterval tit(&sync_copy_send_time);
122 vs_buf->copyAllSend();
126 MpiTimeInterval tit(&sync_wait_time);
127 for(
Integer i=0; i<nb_message; ++i ){
128 Int32 target_rank = vs_buf->targetRank(i);
129 auto rbuf = vs_buf->receiveBuffer(i).bytes().smallView();
130 auto sbuf = vs_buf->sendBuffer(i).bytes().smallView();
132 MPI_Sendrecv(sbuf.data(), sbuf.size(), mpi_dt, target_rank, serialize_tag,
133 rbuf.data(), rbuf.size(), mpi_dt, target_rank, serialize_tag,
134 pm->communicator(), MPI_STATUS_IGNORE);
139 MpiTimeInterval tit(&sync_copy_recv_time);
140 vs_buf->copyAllReceive();
143 pm->stat()->add(
"SyncCopySend",sync_copy_send_time,1);
144 pm->stat()->add(
"SyncWait",sync_wait_time,1);
145 pm->stat()->add(
"SyncCopyRecv",sync_copy_recv_time,1);
Buffer générique pour la synchronisation de données.
Interface d'une fabrique dispatcher générique.
Gestionnaire du parallélisme utilisant MPI.
Référence à une instance.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
Int32 Integer
Type représentant un entier.
unsigned char Byte
Type d'un octet.
auto makeRef(InstanceType *t) -> Ref< InstanceType >
Créé une référence sur un pointeur.
std::int32_t Int32
Type entier signé sur 32 bits.