14#include "arcane/utils/ArcanePrecomp.h"
16#include "arcane/utils/ArrayView.h"
18#include "arcane/utils/Real2.h"
19#include "arcane/utils/Real3.h"
20#include "arcane/utils/Real2x2.h"
21#include "arcane/utils/Real3x3.h"
22#include "arcane/utils/HPReal.h"
24#include "arcane/ParallelNonBlockingCollectiveDispatcher.h"
25#include "arcane/IParallelMng.h"
26#include "arcane/Timer.h"
38ParallelNonBlockingCollectiveDispatcher::
39ParallelNonBlockingCollectiveDispatcher(IParallelMng* pm)
51, m_unsigned_long_long(0)
66ParallelNonBlockingCollectiveDispatcher::
67~ParallelNonBlockingCollectiveDispatcher()
71 delete m_unsigned_char;
73 delete m_unsigned_short;
75 delete m_unsigned_int;
77 delete m_unsigned_long;
79 delete m_unsigned_long_long;
80#ifdef ARCANE_REAL_NOT_BUILTIN
96void ParallelNonBlockingCollectiveDispatcher::
97_setDispatchers(IParallelNonBlockingCollectiveDispatchT<char>* c,
98 IParallelNonBlockingCollectiveDispatchT<signed char>* sc,
99 IParallelNonBlockingCollectiveDispatchT<unsigned char>* uc,
100 IParallelNonBlockingCollectiveDispatchT<short>* s,
101 IParallelNonBlockingCollectiveDispatchT<unsigned short>* us,
102 IParallelNonBlockingCollectiveDispatchT<int>* i,
103 IParallelNonBlockingCollectiveDispatchT<unsigned int>* ui,
104 IParallelNonBlockingCollectiveDispatchT<long>* l,
105 IParallelNonBlockingCollectiveDispatchT<unsigned long>* ul,
106 IParallelNonBlockingCollectiveDispatchT<long long>* ll,
107 IParallelNonBlockingCollectiveDispatchT<unsigned long long>* ull,
108#ifdef ARCANE_REAL_NOT_BUILTIN
109 IParallelNonBlockingCollectiveDispatchT<Real>* r,
111 IParallelNonBlockingCollectiveDispatchT<float>* f,
112 IParallelNonBlockingCollectiveDispatchT<double>* d,
113 IParallelNonBlockingCollectiveDispatchT<long double>* ld,
114 IParallelNonBlockingCollectiveDispatchT<Real2>* r2,
115 IParallelNonBlockingCollectiveDispatchT<Real3>* r3,
116 IParallelNonBlockingCollectiveDispatchT<Real2x2>* r22,
117 IParallelNonBlockingCollectiveDispatchT<Real3x3>* r33,
118 IParallelNonBlockingCollectiveDispatchT<HPReal>* hpr)
122 m_unsigned_char = uc;
124 m_unsigned_short = us;
128 m_unsigned_long = ul;
130 m_unsigned_long_long = ull;
131#ifdef ARCANE_REAL_NOT_BUILTIN
147ITimeStats* ParallelNonBlockingCollectiveDispatcher::
150 return m_parallel_mng->timeStats();
156#define ARCANE_PARALLEL_MANAGER_DISPATCH(field,type)\
157Parallel::Request ParallelNonBlockingCollectiveDispatcher:: \
158allGather(ConstArrayView<type> send_buf,ArrayView<type> recv_buf)\
160 Timer::Phase tphase(timeStats(),TP_Communication);\
161 return field->allGather(send_buf,recv_buf); \
163Parallel::Request ParallelNonBlockingCollectiveDispatcher::\
164gather(ConstArrayView<type> send_buf,ArrayView<type> recv_buf,Integer rank) \
166 Timer::Phase tphase(timeStats(),TP_Communication);\
167 return field->gather(send_buf,recv_buf,rank); \
169Parallel::Request ParallelNonBlockingCollectiveDispatcher::\
170allGatherVariable(ConstArrayView<type> send_buf,Array<type>& recv_buf)\
172 Timer::Phase tphase(timeStats(),TP_Communication);\
173 return field->allGatherVariable(send_buf,recv_buf);\
175Parallel::Request ParallelNonBlockingCollectiveDispatcher::\
176gatherVariable(ConstArrayView<type> send_buf,Array<type>& recv_buf,Integer rank) \
178 Timer::Phase tphase(timeStats(),TP_Communication);\
179 return field->gatherVariable(send_buf,recv_buf,rank); \
181Parallel::Request ParallelNonBlockingCollectiveDispatcher::\
182scatterVariable(ConstArrayView<type> send_buf,ArrayView<type> recv_buf,Integer root)\
184 Timer::Phase tphase(timeStats(),TP_Communication);\
185 return field->scatterVariable(send_buf,recv_buf,root);\
187Parallel::Request ParallelNonBlockingCollectiveDispatcher::\
188allReduce(eReduceType rt,ConstArrayView<type> send_buf,ArrayView<type> v)\
190 Timer::Phase tphase(timeStats(),TP_Communication);\
191 return field->allReduce(rt,send_buf,v);\
193Parallel::Request ParallelNonBlockingCollectiveDispatcher::\
194broadcast(ArrayView<type> send_buf,Integer id)\
196 Timer::Phase tphase(timeStats(),TP_Communication);\
197 return field->broadcast(send_buf,id);\
199Parallel::Request ParallelNonBlockingCollectiveDispatcher::\
200allToAll(ConstArrayView<type> send_buf,ArrayView<type> recv_buf,Integer count)\
202 Timer::Phase tphase(timeStats(),TP_Communication);\
203 return field->allToAll(send_buf,recv_buf,count); \
205Parallel::Request ParallelNonBlockingCollectiveDispatcher::\
206allToAllVariable(ConstArrayView<type> send_buf,Int32ConstArrayView send_count,\
207 Int32ConstArrayView send_index,ArrayView<type> recv_buf,\
208 Int32ConstArrayView recv_count,Int32ConstArrayView recv_index)\
210 Timer::Phase tphase(timeStats(),TP_Communication);\
211 return field->allToAllVariable(send_buf,send_count,send_index,recv_buf,recv_count,recv_index);\
213IParallelNonBlockingCollectiveDispatchT<type>* ParallelNonBlockingCollectiveDispatcher::\
219ARCANE_PARALLEL_MANAGER_DISPATCH(m_char,
char)
220ARCANE_PARALLEL_MANAGER_DISPATCH(m_unsigned_char,
unsigned char)
221ARCANE_PARALLEL_MANAGER_DISPATCH(m_signed_char,
signed char)
222ARCANE_PARALLEL_MANAGER_DISPATCH(m_short,
short)
223ARCANE_PARALLEL_MANAGER_DISPATCH(m_unsigned_short,
unsigned short)
224ARCANE_PARALLEL_MANAGER_DISPATCH(m_int,
int)
225ARCANE_PARALLEL_MANAGER_DISPATCH(m_unsigned_int,
unsigned int)
226ARCANE_PARALLEL_MANAGER_DISPATCH(m_long,
long)
227ARCANE_PARALLEL_MANAGER_DISPATCH(m_unsigned_long,
unsigned long)
228ARCANE_PARALLEL_MANAGER_DISPATCH(m_long_long,
long long)
229ARCANE_PARALLEL_MANAGER_DISPATCH(m_unsigned_long_long,
unsigned long long)
230ARCANE_PARALLEL_MANAGER_DISPATCH(m_float,
float)
231ARCANE_PARALLEL_MANAGER_DISPATCH(m_double,
double)
232ARCANE_PARALLEL_MANAGER_DISPATCH(m_long_double,
long double)
233#ifdef ARCANE_REAL_NOT_BUILTIN
234ARCANE_PARALLEL_MANAGER_DISPATCH(m_real,Real)
236ARCANE_PARALLEL_MANAGER_DISPATCH(m_real2,Real2)
237ARCANE_PARALLEL_MANAGER_DISPATCH(m_real3,Real3)
238ARCANE_PARALLEL_MANAGER_DISPATCH(m_real2x2,Real2x2)
239ARCANE_PARALLEL_MANAGER_DISPATCH(m_real3x3,Real3x3)
240ARCANE_PARALLEL_MANAGER_DISPATCH(m_hpreal,HPReal)