Arcane  v3.14.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
ParallelNonBlockingCollectiveDispatcher.cc
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2022 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/* ParallelNonBlockingCollectiveDispatcher.cc (C) 2000-2016 */
9/* */
10/* Redirection de la gestion des messages suivant le type des arguments. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/utils/ArcanePrecomp.h"
15
16#include "arcane/utils/ArrayView.h"
17
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"
23
24#include "arcane/ParallelNonBlockingCollectiveDispatcher.h"
25#include "arcane/IParallelMng.h"
26#include "arcane/Timer.h"
27
28#include <iostream>
29
30/*---------------------------------------------------------------------------*/
31/*---------------------------------------------------------------------------*/
32
33ARCANE_BEGIN_NAMESPACE
34
35/*---------------------------------------------------------------------------*/
36/*---------------------------------------------------------------------------*/
37
38ParallelNonBlockingCollectiveDispatcher::
39ParallelNonBlockingCollectiveDispatcher(IParallelMng* pm)
40: m_parallel_mng(pm)
41, m_char(0)
42, m_unsigned_char(0)
43, m_signed_char(0)
44, m_short(0)
45, m_unsigned_short(0)
46, m_int(0)
47, m_unsigned_int(0)
48, m_long(0)
49, m_unsigned_long(0)
50, m_long_long(0)
51, m_unsigned_long_long(0)
52, m_float(0)
53, m_double(0)
54, m_long_double(0)
55, m_real2(0)
56, m_real3(0)
57, m_real2x2(0)
58, m_real3x3(0)
59, m_hpreal(0)
60{
61}
62
63/*---------------------------------------------------------------------------*/
64/*---------------------------------------------------------------------------*/
65
66ParallelNonBlockingCollectiveDispatcher::
67~ParallelNonBlockingCollectiveDispatcher()
68{
69 delete m_char;
70 delete m_signed_char;
71 delete m_unsigned_char;
72 delete m_short;
73 delete m_unsigned_short;
74 delete m_int;
75 delete m_unsigned_int;
76 delete m_long;
77 delete m_unsigned_long;
78 delete m_long_long;
79 delete m_unsigned_long_long;
80#ifdef ARCANE_REAL_NOT_BUILTIN
81 delete m_real;
82#endif
83 delete m_float;
84 delete m_double;
85 delete m_long_double;
86 delete m_real2;
87 delete m_real3;
88 delete m_real2x2;
89 delete m_real3x3;
90 delete m_hpreal;
91}
92
93/*---------------------------------------------------------------------------*/
94/*---------------------------------------------------------------------------*/
95
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,
110#endif
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)
119{
120 m_char = c;
121 m_signed_char = sc;
122 m_unsigned_char = uc;
123 m_short = s;
124 m_unsigned_short = us;
125 m_int = i;
126 m_unsigned_int = ui;
127 m_long = l;
128 m_unsigned_long = ul;
129 m_long_long = ll;
130 m_unsigned_long_long = ull;
131#ifdef ARCANE_REAL_NOT_BUILTIN
132 m_real = r;
133#endif
134 m_float = f;
135 m_double = d;
136 m_long_double = ld;
137 m_real2 = r2;
138 m_real3 = r3;
139 m_real2x2 = r22;
140 m_real3x3 = r33;
141 m_hpreal = hpr;
142}
143
144/*---------------------------------------------------------------------------*/
145/*---------------------------------------------------------------------------*/
146
147ITimeStats* ParallelNonBlockingCollectiveDispatcher::
148timeStats()
149{
150 return m_parallel_mng->timeStats();
151}
152
153/*---------------------------------------------------------------------------*/
154/*---------------------------------------------------------------------------*/
155
156#define ARCANE_PARALLEL_MANAGER_DISPATCH(field,type)\
157Parallel::Request ParallelNonBlockingCollectiveDispatcher:: \
158allGather(ConstArrayView<type> send_buf,ArrayView<type> recv_buf)\
159{\
160 Timer::Phase tphase(timeStats(),TP_Communication);\
161 return field->allGather(send_buf,recv_buf); \
162}\
163Parallel::Request ParallelNonBlockingCollectiveDispatcher::\
164gather(ConstArrayView<type> send_buf,ArrayView<type> recv_buf,Integer rank) \
165{\
166 Timer::Phase tphase(timeStats(),TP_Communication);\
167 return field->gather(send_buf,recv_buf,rank); \
168}\
169Parallel::Request ParallelNonBlockingCollectiveDispatcher::\
170allGatherVariable(ConstArrayView<type> send_buf,Array<type>& recv_buf)\
171{\
172 Timer::Phase tphase(timeStats(),TP_Communication);\
173 return field->allGatherVariable(send_buf,recv_buf);\
174}\
175Parallel::Request ParallelNonBlockingCollectiveDispatcher::\
176gatherVariable(ConstArrayView<type> send_buf,Array<type>& recv_buf,Integer rank) \
177{\
178 Timer::Phase tphase(timeStats(),TP_Communication);\
179 return field->gatherVariable(send_buf,recv_buf,rank); \
180}\
181Parallel::Request ParallelNonBlockingCollectiveDispatcher::\
182scatterVariable(ConstArrayView<type> send_buf,ArrayView<type> recv_buf,Integer root)\
183{\
184 Timer::Phase tphase(timeStats(),TP_Communication);\
185 return field->scatterVariable(send_buf,recv_buf,root);\
186}\
187Parallel::Request ParallelNonBlockingCollectiveDispatcher::\
188allReduce(eReduceType rt,ConstArrayView<type> send_buf,ArrayView<type> v)\
189{\
190 Timer::Phase tphase(timeStats(),TP_Communication);\
191 return field->allReduce(rt,send_buf,v);\
192}\
193Parallel::Request ParallelNonBlockingCollectiveDispatcher::\
194broadcast(ArrayView<type> send_buf,Integer id)\
195{ \
196 Timer::Phase tphase(timeStats(),TP_Communication);\
197 return field->broadcast(send_buf,id);\
198}\
199Parallel::Request ParallelNonBlockingCollectiveDispatcher::\
200allToAll(ConstArrayView<type> send_buf,ArrayView<type> recv_buf,Integer count)\
201{\
202 Timer::Phase tphase(timeStats(),TP_Communication);\
203 return field->allToAll(send_buf,recv_buf,count); \
204}\
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)\
209{\
210 Timer::Phase tphase(timeStats(),TP_Communication);\
211 return field->allToAllVariable(send_buf,send_count,send_index,recv_buf,recv_count,recv_index);\
212}\
213IParallelNonBlockingCollectiveDispatchT<type>* ParallelNonBlockingCollectiveDispatcher::\
214dispatcher(type*)\
215{\
216 return field;\
217}\
218
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)
235#endif
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)
241
242/*---------------------------------------------------------------------------*/
243/*---------------------------------------------------------------------------*/
244
245ARCANE_END_NAMESPACE
246
247/*---------------------------------------------------------------------------*/
248/*---------------------------------------------------------------------------*/
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Definition Lima.cc:120