Arcane  v3.15.0.0
Documentation utilisateur
Chargement...
Recherche...
Aucune correspondance
ParallelMngDispatcher.cc
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2024 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/* ParallelMngDispatcher.cc (C) 2000-2024 */
9/* */
10/* Redirection de la gestion des messages suivant le type des arguments. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/utils/Array.h"
15#include "arcane/utils/HPReal.h"
16#include "arcane/utils/NumericTypes.h"
17#include "arcane/utils/NotImplementedException.h"
18#include "arcane/utils/ScopedPtr.h"
19#include "arcane/utils/ITraceMng.h"
20#include "arcane/utils/ValueConvert.h"
21#include "arcane/utils/FatalErrorException.h"
22
23#include "arcane/core/ParallelMngDispatcher.h"
24#include "arcane/core/IParallelDispatch.h"
25#include "arcane/core/Timer.h"
26#include "arcane/core/ITimeStats.h"
27#include "arcane/core/IParallelNonBlockingCollective.h"
28#include "arcane/core/internal/IParallelMngInternal.h"
29
30#include "arcane/accelerator/core/Runner.h"
31#include "arcane/accelerator/core/RunQueueBuildInfo.h"
32
33#include "arccore/message_passing/Dispatchers.h"
35#include "arccore/message_passing/MessagePassingMng.h"
36#include "arccore/message_passing/IControlDispatcher.h"
37#include "arccore/message_passing/ISerializeDispatcher.h"
38#include "arccore/message_passing/PointToPointMessageInfo.h"
39#include "arccore/message_passing/IRequestList.h"
40#include "arccore/message_passing/ISerializeMessageList.h"
41#include "arccore/trace/TimeMetric.h"
42
43/*---------------------------------------------------------------------------*/
44/*---------------------------------------------------------------------------*/
45
46namespace Arcane
47{
48using namespace Arccore::MessagePassing;
49
50/*---------------------------------------------------------------------------*/
51/*---------------------------------------------------------------------------*/
52
53ParallelMngDispatcherBuildInfo::
54ParallelMngDispatcherBuildInfo(MP::Dispatchers* dispatchers,
56: m_comm_rank(mpm->commRank())
57, m_comm_size(mpm->commSize())
58, m_dispatchers(dispatchers)
59, m_message_passing_mng(mpm)
60{
61 _init();
62}
63
64/*---------------------------------------------------------------------------*/
65/*---------------------------------------------------------------------------*/
66
67ParallelMngDispatcherBuildInfo::
68ParallelMngDispatcherBuildInfo(Ref<MP::Dispatchers> dispatchers,
69 Ref<MP::MessagePassingMng> mpm_ref)
70: m_comm_rank(mpm_ref->commRank())
71, m_comm_size(mpm_ref->commSize())
72, m_dispatchers(dispatchers.get())
73, m_dispatchers_ref(dispatchers)
74, m_message_passing_mng(mpm_ref.get())
75, m_message_passing_mng_ref(mpm_ref)
76{
77 _init();
78}
79
80/*---------------------------------------------------------------------------*/
81/*---------------------------------------------------------------------------*/
82
83ParallelMngDispatcherBuildInfo::
84ParallelMngDispatcherBuildInfo(Int32 comm_rank,Int32 comm_size)
85: m_comm_rank(comm_rank)
86, m_comm_size(comm_size)
87, m_dispatchers(nullptr)
88, m_message_passing_mng(nullptr)
89{
90 _init();
91}
92
93/*---------------------------------------------------------------------------*/
94/*---------------------------------------------------------------------------*/
95
96void ParallelMngDispatcherBuildInfo::
97_init()
98{
99 if (!m_dispatchers){
100 m_dispatchers_ref = createRef<MP::Dispatchers>();
101 m_dispatchers = m_dispatchers_ref.get();
102 }
103 if (!m_message_passing_mng){
104 auto* x = new MP::MessagePassingMng(m_comm_rank,m_comm_size,m_dispatchers);
105 m_message_passing_mng = x;
106 m_message_passing_mng_ref = makeRef(x);
107 }
108 if (!m_message_passing_mng_ref.get())
109 m_message_passing_mng_ref = makeRef(m_message_passing_mng);
110}
111
112/*---------------------------------------------------------------------------*/
113/*---------------------------------------------------------------------------*/
114
115ParallelMngDispatcher::DefaultControlDispatcher::
116DefaultControlDispatcher(IParallelMng* pm)
117: m_parallel_mng(pm)
118{
119}
120
121
122void ParallelMngDispatcher::DefaultControlDispatcher::
123waitAllRequests(ArrayView<Request> requests)
124{
125 m_parallel_mng->waitAllRequests(requests);
126}
127
128void ParallelMngDispatcher::DefaultControlDispatcher::
129waitSomeRequests(ArrayView<Request> requests,ArrayView<bool> indexes,
130 bool is_non_blocking)
131{
132 UniqueArray<Integer> done_requests;
133 if (is_non_blocking)
134 done_requests = m_parallel_mng->testSomeRequests(requests);
135 else
136 done_requests = m_parallel_mng->waitSomeRequests(requests);
137 indexes.fill(false);
138 for( int x : done_requests )
139 indexes[x] = true;
140}
141
142IMessagePassingMng* ParallelMngDispatcher::DefaultControlDispatcher::
143commSplit(bool keep)
144{
145 ARCANE_UNUSED(keep);
146 ARCANE_THROW(NotImplementedException,"split from MessagePassing::IControlDispatcher");
147}
148
149void ParallelMngDispatcher::DefaultControlDispatcher::
150barrier()
151{
152 m_parallel_mng->barrier();
153}
154
155Request ParallelMngDispatcher::DefaultControlDispatcher::
156nonBlockingBarrier()
157{
158 return m_parallel_mng->nonBlockingCollective()->barrier();
159}
160
161MessageId ParallelMngDispatcher::DefaultControlDispatcher::
162probe(const PointToPointMessageInfo& message)
163{
164 return m_parallel_mng->probe(message);
165}
166
167MessageSourceInfo ParallelMngDispatcher::DefaultControlDispatcher::
168legacyProbe(const PointToPointMessageInfo& message)
169{
170 return m_parallel_mng->legacyProbe(message);
171}
172
173Ref<Parallel::IRequestList> ParallelMngDispatcher::DefaultControlDispatcher::
174createRequestListRef()
175{
176 return m_parallel_mng->createRequestListRef();
177}
178
179/*---------------------------------------------------------------------------*/
180/*---------------------------------------------------------------------------*/
181
182void ParallelMngDispatcher::DefaultControlDispatcher::
183setProfiler(MP::IProfiler* p)
184{
185 ARCANE_UNUSED(p);
186 ARCANE_THROW(NotImplementedException,"setProfiler() from MessagePassing::IControlDispatcher");
187}
188
189/*---------------------------------------------------------------------------*/
190/*---------------------------------------------------------------------------*/
191
194{
195 public:
196
198 : m_parallel_mng(pm)
199 {}
200
201 public:
202 Ref<ISerializeMessageList> createSerializeMessageListRef() override
203 {
204 return m_parallel_mng->createSerializeMessageListRef();
205 }
207 {
208 return m_parallel_mng->sendSerializer(s,message);
209 }
211 {
212 return m_parallel_mng->receiveSerializer(s,message);
213 }
214 private:
215 IParallelMng* m_parallel_mng;
216};
217
218/*---------------------------------------------------------------------------*/
219/*---------------------------------------------------------------------------*/
220
222: public IParallelMngInternal
223{
224 public:
225
226 explicit Impl(ParallelMngDispatcher* pm)
227 : m_parallel_mng(pm)
228 , m_runner(Accelerator::eExecutionPolicy::Sequential)
229 , m_queue(makeQueue(m_runner))
230 {
231 if (auto v = Convert::Type<Int32>::tryParseFromEnvironment("ARCANE_DISABLE_ACCELERATOR_AWARE_MESSAGE_PASSING", true))
232 m_is_accelerator_aware_disabled = (v.value()!=0);
233 }
234 ~Impl()
235 {
236 }
237 public:
238
239 Runner runner() const override { return m_runner; }
240 RunQueue queue() const override { return m_queue; }
241 bool isAcceleratorAware() const override
242 {
243 if (m_is_accelerator_aware_disabled)
244 return false;
245 if (m_queue.isNull())
246 return false;
247 if (!m_queue.isAcceleratorPolicy())
248 return false;
249 return m_parallel_mng->_isAcceleratorAware();
250 }
251 void setDefaultRunner(const Runner& runner) override
252 {
253 if (!m_runner.isInitialized())
254 ARCANE_FATAL("Can not set an unitialized Runner");
255
256 m_runner = runner;
257 Accelerator::RunQueueBuildInfo build_info(-5);
258 m_queue = makeQueue(m_runner,build_info);
259 m_queue.setAsync(true);
260 }
261 Ref<IParallelMng> createSubParallelMngRef(Int32 color, Int32 key) override
262 {
263 return m_parallel_mng->_createSubParallelMngRef(color, key);
264 }
265
266 private:
267
268 ParallelMngDispatcher* m_parallel_mng = nullptr;
269 Runner m_runner;
270 RunQueue m_queue;
271 bool m_is_accelerator_aware_disabled = false;
272};
273
274/*---------------------------------------------------------------------------*/
275/*---------------------------------------------------------------------------*/
276
277/*---------------------------------------------------------------------------*/
278/*---------------------------------------------------------------------------*/
279
280ParallelMngDispatcher::
281ParallelMngDispatcher(const ParallelMngDispatcherBuildInfo& bi)
282: m_char(nullptr)
283, m_unsigned_char(nullptr)
284, m_signed_char(nullptr)
285, m_short(nullptr)
286, m_unsigned_short(nullptr)
287, m_int(nullptr)
288, m_unsigned_int(nullptr)
289, m_long(nullptr)
290, m_unsigned_long(nullptr)
291, m_long_long(nullptr)
292, m_unsigned_long_long(nullptr)
293, m_float(nullptr)
294, m_double(nullptr)
295, m_long_double(nullptr)
296, m_apreal(nullptr)
297, m_real2(nullptr)
298, m_real3(nullptr)
299, m_real2x2(nullptr)
300, m_real3x3(nullptr)
301, m_hpreal(nullptr)
302, m_time_stats(nullptr)
303, m_mp_dispatchers_ref(bi.dispatchersRef())
304, m_message_passing_mng_ref(bi.messagePassingMngRef())
305, m_control_dispatcher(new DefaultControlDispatcher(this))
306, m_serialize_dispatcher(new SerializeDispatcher(this))
307, m_parallel_mng_internal(new Impl(this))
308{
309}
310
311/*---------------------------------------------------------------------------*/
312/*---------------------------------------------------------------------------*/
313
314ParallelMngDispatcher::
315~ParallelMngDispatcher()
316{
317 m_mp_dispatchers_ref.reset();
318
319 delete m_parallel_mng_internal;
320
321 delete m_serialize_dispatcher;
322 delete m_control_dispatcher;
323 delete m_char;
324 delete m_signed_char;
325 delete m_unsigned_char;
326 delete m_short;
327 delete m_unsigned_short;
328 delete m_int;
329 delete m_unsigned_int;
330 delete m_long;
331 delete m_unsigned_long;
332 delete m_long_long;
333 delete m_unsigned_long_long;
334 delete m_apreal;
335 delete m_float;
336 delete m_double;
337 delete m_long_double;
338 delete m_real2;
339 delete m_real3;
340 delete m_real2x2;
341 delete m_real3x3;
342 delete m_hpreal;
343}
344
345/*---------------------------------------------------------------------------*/
346/*---------------------------------------------------------------------------*/
347
348void ParallelMngDispatcher::
349_setControlDispatcher(MP::IControlDispatcher* d)
350{
351 delete m_control_dispatcher;
352 m_control_dispatcher = d;
353}
354
355/*---------------------------------------------------------------------------*/
356/*---------------------------------------------------------------------------*/
357
358void ParallelMngDispatcher::
359_setSerializeDispatcher(MP::ISerializeDispatcher* d)
360{
361 delete m_serialize_dispatcher;
362 m_serialize_dispatcher = d;
363}
364
365/*---------------------------------------------------------------------------*/
366/*---------------------------------------------------------------------------*/
367
368void ParallelMngDispatcher::
369_setArccoreDispatchers()
370{
371 m_mp_dispatchers_ref->setDispatcher(m_char->toArccoreDispatcher());
372 m_mp_dispatchers_ref->setDispatcher(m_signed_char->toArccoreDispatcher());
373 m_mp_dispatchers_ref->setDispatcher(m_unsigned_char->toArccoreDispatcher());
374 m_mp_dispatchers_ref->setDispatcher(m_short->toArccoreDispatcher());
375 m_mp_dispatchers_ref->setDispatcher(m_unsigned_short->toArccoreDispatcher());
376 m_mp_dispatchers_ref->setDispatcher(m_int->toArccoreDispatcher());
377 m_mp_dispatchers_ref->setDispatcher(m_unsigned_int->toArccoreDispatcher());
378 m_mp_dispatchers_ref->setDispatcher(m_long->toArccoreDispatcher());
379 m_mp_dispatchers_ref->setDispatcher(m_unsigned_long->toArccoreDispatcher());
380 m_mp_dispatchers_ref->setDispatcher(m_long_long->toArccoreDispatcher());
381 m_mp_dispatchers_ref->setDispatcher(m_unsigned_long_long->toArccoreDispatcher());
382 m_mp_dispatchers_ref->setDispatcher(m_float->toArccoreDispatcher());
383 m_mp_dispatchers_ref->setDispatcher(m_double->toArccoreDispatcher());
384 m_mp_dispatchers_ref->setDispatcher(m_long_double->toArccoreDispatcher());
385
386 ARCANE_CHECK_POINTER(m_control_dispatcher);
387 m_mp_dispatchers_ref->setDispatcher(m_control_dispatcher);
388 ARCANE_CHECK_POINTER(m_serialize_dispatcher);
389 m_mp_dispatchers_ref->setDispatcher(m_serialize_dispatcher);
390}
391
392/*---------------------------------------------------------------------------*/
393/*---------------------------------------------------------------------------*/
394
396messagePassingMng() const
397{
398 return m_message_passing_mng_ref.get();
399}
400
401/*---------------------------------------------------------------------------*/
402/*---------------------------------------------------------------------------*/
403
406{
407 ITimeMetricCollector* c = nullptr;
408 ITimeStats* s = m_time_stats;
409 if (s)
410 c = s->metricCollector();
411 return c;
412}
413
414/*---------------------------------------------------------------------------*/
415/*---------------------------------------------------------------------------*/
416
419{
420 m_time_stats = ts;
421 if (ts){
423 _messagePassingMng()->setTimeMetricCollector(c);
424 }
425}
426
427/*---------------------------------------------------------------------------*/
428/*---------------------------------------------------------------------------*/
429
430TimeMetricAction ParallelMngDispatcher::
431_communicationTimeMetricAction() const
432{
433 return Timer::phaseAction(timeStats(),TP_Communication);
434}
435
436/*---------------------------------------------------------------------------*/
437/*---------------------------------------------------------------------------*/
438
439void ParallelMngDispatcher::
440broadcastString(String& str,Int32 rank)
441{
442 Int64 len_info[1];
443 Int32 my_rank = commRank();
444 Span<const Byte> bytes = str.bytes();
445 if (rank==my_rank){
446 len_info[0] = bytes.size();
447 broadcast(Int64ArrayView(1,len_info),rank);
448 ByteUniqueArray utf8_array(bytes);
449 broadcast(utf8_array,rank);
450 }
451 else{
452 broadcast(Int64ArrayView(1,len_info),rank);
453 ByteUniqueArray utf8_array(len_info[0]);
454 broadcast(utf8_array,rank);
455 str = String::fromUtf8(utf8_array);
456 }
457}
458
459/*---------------------------------------------------------------------------*/
460/*---------------------------------------------------------------------------*/
461
464{
465 Int64 size = 0;
466 if (commRank()==rank){
467 size = bytes.largeSize();
468 }
469 {
470 Int64ArrayView bs(1,&size);
471 broadcast(bs,rank);
472 }
473 if (commRank()!=rank)
474 bytes.resize(size);
475 if (size!=0)
476 broadcast(bytes,rank);
477}
478
479/*---------------------------------------------------------------------------*/
480/*---------------------------------------------------------------------------*/
481
483allGather(ISerializer* send_serializer, ISerializer* recv_serializer)
484{
485 Timer::Phase tphase(timeStats(), TP_Communication);
486 mpAllGather(_messagePassingMng(), send_serializer, recv_serializer);
487}
488
489/*---------------------------------------------------------------------------*/
490/*---------------------------------------------------------------------------*/
491
494{
495 TimeMetricSentry tphase(Timer::phaseAction(timeStats(),TP_Communication));
497
498 Integer nb_message = messages.size();
499 for( Integer i=0; i<nb_message; ++i ){
500 ISerializeMessage* m = messages[i];
501 message_list->addMessage(m);
502 }
503 message_list->processPendingMessages();
504
505 message_list->waitMessages(Parallel::WaitAll);
506}
507
508/*---------------------------------------------------------------------------*/
509/*---------------------------------------------------------------------------*/
510
511Ref<ISerializeMessageList> ParallelMngDispatcher::
513{
514 return makeRef(_createSerializeMessageList());
515}
516
517/*---------------------------------------------------------------------------*/
518/*---------------------------------------------------------------------------*/
519
522{
523 return _createSerializeMessageList();
524}
525
526/*---------------------------------------------------------------------------*/
527/*---------------------------------------------------------------------------*/
528
531{
532 return _createSubParallelMng(kept_ranks);
533}
534
535/*---------------------------------------------------------------------------*/
536/*---------------------------------------------------------------------------*/
537
538Ref<IParallelMng> ParallelMngDispatcher::
540{
541 return makeRef(_createSubParallelMng(kept_ranks));
542}
543
544/*---------------------------------------------------------------------------*/
545/*---------------------------------------------------------------------------*/
546
547Ref<IParallelMng> ParallelMngDispatcher::
548_createSubParallelMngRef([[maybe_unused]] Int32 color, [[maybe_unused]] Int32 key)
549{
550 ARCANE_THROW(NotImplementedException, "Create sub-parallelmng with split semantic");
551}
552
553/*---------------------------------------------------------------------------*/
554/*---------------------------------------------------------------------------*/
555
556UniqueArray<Integer> ParallelMngDispatcher::
557_doWaitRequests(ArrayView<Request> requests,eWaitType wait_type)
558{
559 Timer::Phase tphase(timeStats(),TP_Communication);
560 Ref<IRequestList> request_list(createRequestListRef());
561 Integer nb_request = requests.size();
562 request_list->add(requests);
563 request_list->wait(wait_type);
564 // Ne pas oublier de recopier les requêtes car elles ont pu être modifiées
565 for (Integer i=0; i<nb_request; ++i )
566 requests[i] = request_list->request(i);
567 return request_list->doneRequestIndexes();
568}
569
570/*---------------------------------------------------------------------------*/
571/*---------------------------------------------------------------------------*/
572
575{
576 return _doWaitRequests(requests,Parallel::WaitSome);
577}
578
579/*---------------------------------------------------------------------------*/
580/*---------------------------------------------------------------------------*/
581
584{
585 return _doWaitRequests(requests,Parallel::WaitSomeNonBlocking);
586}
587
588/*---------------------------------------------------------------------------*/
589/*---------------------------------------------------------------------------*/
590
591#define ARCANE_PARALLEL_MANAGER_DISPATCH(field,type)\
592void ParallelMngDispatcher::\
593allGather(ConstArrayView<type> send_buf,ArrayView<type> recv_buf)\
594{\
595 Timer::Phase tphase(timeStats(),TP_Communication);\
596 field->allGather(send_buf,recv_buf);\
597}\
598void ParallelMngDispatcher::\
599gather(ConstArrayView<type> send_buf,ArrayView<type> recv_buf,Integer rank) \
600{\
601 Timer::Phase tphase(timeStats(),TP_Communication);\
602 field->gather(send_buf,recv_buf,rank); \
603}\
604void ParallelMngDispatcher::\
605allGatherVariable(ConstArrayView<type> send_buf,Array<type>& recv_buf)\
606{\
607 Timer::Phase tphase(timeStats(),TP_Communication);\
608 field->allGatherVariable(send_buf,recv_buf);\
609}\
610void ParallelMngDispatcher::\
611gatherVariable(ConstArrayView<type> send_buf,Array<type>& recv_buf,Integer rank) \
612{\
613 Timer::Phase tphase(timeStats(),TP_Communication);\
614 field->gatherVariable(send_buf,recv_buf,rank); \
615}\
616void ParallelMngDispatcher::\
617scatterVariable(ConstArrayView<type> send_buf,ArrayView<type> recv_buf,Integer root)\
618{\
619 Timer::Phase tphase(timeStats(),TP_Communication);\
620 field->scatterVariable(send_buf,recv_buf,root);\
621}\
622type ParallelMngDispatcher::\
623reduce(eReduceType rt,type v)\
624{\
625 Timer::Phase tphase(timeStats(),TP_Communication);\
626 return field->allReduce(rt,v);\
627}\
628void ParallelMngDispatcher::\
629reduce(eReduceType rt,ArrayView<type> v)\
630{\
631 Timer::Phase tphase(timeStats(),TP_Communication);\
632 field->allReduce(rt,v);\
633}\
634void ParallelMngDispatcher::\
635broadcast(ArrayView<type> send_buf,Integer id)\
636{ \
637 Timer::Phase tphase(timeStats(),TP_Communication);\
638 field->broadcast(send_buf,id);\
639}\
640void ParallelMngDispatcher::\
641send(ConstArrayView<type> values,Integer id)\
642{\
643 Timer::Phase tphase(timeStats(),TP_Communication);\
644 field->send(values,id);\
645}\
646void ParallelMngDispatcher::\
647recv(ArrayView<type> values,Integer id)\
648{\
649 Timer::Phase tphase(timeStats(),TP_Communication);\
650 field->recv(values,id);\
651}\
652Parallel::Request ParallelMngDispatcher::\
653send(ConstArrayView<type> values,Integer id,bool is_blocked)\
654{\
655 Timer::Phase tphase(timeStats(),TP_Communication);\
656 return field->send(values,id,is_blocked);\
657}\
658Request ParallelMngDispatcher::\
659send(Span<const type> values,const PointToPointMessageInfo& message) \
660{\
661 Timer::Phase tphase(timeStats(),TP_Communication);\
662 return field->send(values,message);\
663}\
664Parallel::Request ParallelMngDispatcher::\
665recv(ArrayView<type> values,Integer id,bool is_blocked)\
666{\
667 Timer::Phase tphase(timeStats(),TP_Communication);\
668 return field->recv(values,id,is_blocked);\
669}\
670Request ParallelMngDispatcher::\
671receive(Span<type> values,const PointToPointMessageInfo& message) \
672{\
673 Timer::Phase tphase(timeStats(),TP_Communication);\
674 return field->receive(values,message);\
675}\
676void ParallelMngDispatcher::\
677sendRecv(ConstArrayView<type> send_buf,ArrayView<type> recv_buf,Integer id)\
678{\
679 Timer::Phase tphase(timeStats(),TP_Communication);\
680 field->sendRecv(send_buf,recv_buf,id);\
681}\
682void ParallelMngDispatcher::\
683allToAll(ConstArrayView<type> send_buf,ArrayView<type> recv_buf,Integer count)\
684{\
685 Timer::Phase tphase(timeStats(),TP_Communication);\
686 field->allToAll(send_buf,recv_buf,count);\
687}\
688void ParallelMngDispatcher::\
689allToAllVariable(ConstArrayView<type> send_buf,Int32ConstArrayView send_count,\
690 Int32ConstArrayView send_index,ArrayView<type> recv_buf,\
691 Int32ConstArrayView recv_count,Int32ConstArrayView recv_index)\
692{\
693 Timer::Phase tphase(timeStats(),TP_Communication);\
694 field->allToAllVariable(send_buf,send_count,send_index,recv_buf,recv_count,recv_index);\
695}\
696type ParallelMngDispatcher::\
697scan(eReduceType rt,type v)\
698{\
699 Timer::Phase tphase(timeStats(),TP_Communication);\
700 return field->scan(rt,v);\
701}\
702void ParallelMngDispatcher::\
703computeMinMaxSum(type val,type& min_val,type& max_val,type& sum_val,Int32& min_proc,Int32& max_proc)\
704{\
705 Timer::Phase tphase(timeStats(),TP_Communication);\
706 field->computeMinMaxSum(val,min_val,max_val,sum_val,min_proc,max_proc);\
707}\
708IParallelDispatchT<type>* ParallelMngDispatcher::\
709dispatcher(type*)\
710{\
711 return field;\
712}\
713void ParallelMngDispatcher::\
714computeMinMaxSum(ConstArrayView<type> values, \
715 ArrayView<type> min_values, \
716 ArrayView<type> max_values, \
717 ArrayView<type> sum_values, \
718 ArrayView<Int32> min_ranks, \
719 ArrayView<Int32> max_ranks) \
720{\
721 Timer::Phase tphase(timeStats(),TP_Communication);\
722 field->computeMinMaxSum(values,min_values,max_values,sum_values,min_ranks,max_ranks);\
723}\
724void ParallelMngDispatcher::\
725scan(eReduceType rt,ArrayView<type> v)\
726{\
727 Timer::Phase tphase(timeStats(),TP_Communication);\
728 field->scan(rt,v);\
729}
730
731ARCANE_PARALLEL_MANAGER_DISPATCH(m_char,char)
732ARCANE_PARALLEL_MANAGER_DISPATCH(m_unsigned_char,unsigned char)
733ARCANE_PARALLEL_MANAGER_DISPATCH(m_signed_char,signed char)
734ARCANE_PARALLEL_MANAGER_DISPATCH(m_short,short)
735ARCANE_PARALLEL_MANAGER_DISPATCH(m_unsigned_short,unsigned short)
736ARCANE_PARALLEL_MANAGER_DISPATCH(m_int,int)
737ARCANE_PARALLEL_MANAGER_DISPATCH(m_unsigned_int,unsigned int)
738ARCANE_PARALLEL_MANAGER_DISPATCH(m_long,long)
739ARCANE_PARALLEL_MANAGER_DISPATCH(m_unsigned_long,unsigned long)
740ARCANE_PARALLEL_MANAGER_DISPATCH(m_long_long,long long)
741ARCANE_PARALLEL_MANAGER_DISPATCH(m_unsigned_long_long,unsigned long long)
742ARCANE_PARALLEL_MANAGER_DISPATCH(m_float,float)
743ARCANE_PARALLEL_MANAGER_DISPATCH(m_double,double)
744ARCANE_PARALLEL_MANAGER_DISPATCH(m_long_double,long double)
745ARCANE_PARALLEL_MANAGER_DISPATCH(m_apreal,APReal)
746ARCANE_PARALLEL_MANAGER_DISPATCH(m_real2,Real2)
747ARCANE_PARALLEL_MANAGER_DISPATCH(m_real3,Real3)
748ARCANE_PARALLEL_MANAGER_DISPATCH(m_real2x2,Real2x2)
749ARCANE_PARALLEL_MANAGER_DISPATCH(m_real3x3,Real3x3)
750ARCANE_PARALLEL_MANAGER_DISPATCH(m_hpreal,HPReal)
751
752/*---------------------------------------------------------------------------*/
753/*---------------------------------------------------------------------------*/
754
755} // End namespace Arcane
756
757/*---------------------------------------------------------------------------*/
758/*---------------------------------------------------------------------------*/
759
760namespace Arccore
761{
764}
765
766/*---------------------------------------------------------------------------*/
767/*---------------------------------------------------------------------------*/
#define ARCANE_CHECK_POINTER(ptr)
Macro retournant le pointeur ptr s'il est non nul ou lancant une exception s'il est nul.
#define ARCANE_THROW(exception_class,...)
Macro pour envoyer une exception avec formattage.
#define ARCANE_FATAL(...)
Macro envoyant une exception FatalErrorException.
Liste des fonctions d'échange de message.
#define ARCCORE_DEFINE_REFERENCE_COUNTED_CLASS(class_name)
Macro pour définir les méthodes et types une classe qui utilise un compteur de référence.
Informations pour créer une RunQueue.
File d'exécution pour un accélérateur.
Gestionnaire d'exécution pour accélérateur.
Definition core/Runner.h:68
Classe implémentant un réel Haute Précision.
Definition HPReal.h:161
Interface du gestionnaire de parallélisme pour un sous-domaine.
virtual Int32 commRank() const =0
Rang de cette instance dans le communicateur.
virtual Ref< Parallel::IRequestList > createRequestListRef()=0
Créé une liste de requêtes pour ce gestionnaire.
virtual ITimeMetricCollector * metricCollector()=0
Interface de collection associée.
Implémentation de Arccore::MessagePassing::IControlDispatcher.
Request sendSerializer(const ISerializer *s, const PointToPointMessageInfo &message) override
Message d'envoi.
Request receiveSerializer(ISerializer *s, const PointToPointMessageInfo &message) override
Message de réception.
Ref< ISerializeMessageList > createSerializeMessageListRef() override
Créé une liste de messages de sérialisation.
ISerializeMessageList * createSerializeMessageList() final
Créé une liste pour gérer les 'ISerializeMessage'.
void setTimeStats(ITimeStats *ts) override
Positionne le gestionnaire de statistiques.
void allGather(ISerializer *send_serializer, ISerializer *recv_serializer) override
Redéfinit ici allGather pour éviter de cacher le symbole dans les classes dérivées.
Ref< IParallelMng > createSubParallelMngRef(Int32ConstArrayView kept_ranks) override
Créé un nouveau gestionnaire de parallélisme pour un sous-ensemble des rangs.
void processMessages(ConstArrayView< ISerializeMessage * > messages) override
Exécute les opérations des messages messages.
IMessagePassingMng * messagePassingMng() const override
Gestionnaire de message de Arccore associé
ITimeMetricCollector * timeMetricCollector() const override
Collecteur Arccore des statistiques temporelles (peut être nul)
IParallelMng * createSubParallelMng(Int32ConstArrayView kept_ranks) final
Créé un nouveau gestionnaire de parallélisme pour un sous-ensemble des rangs.
UniqueArray< Integer > testSomeRequests(ArrayView< Request > requests) override
Test si une des requêtes rvalues est terminée.
ITimeStats * timeStats() const override
Gestionnaire de statistiques associé (peut être nul)
Ref< ISerializeMessageList > createSerializeMessageListRef() final
Créé une liste pour gérer les 'ISerializeMessage'.
UniqueArray< Integer > waitSomeRequests(ArrayView< Request > requests) override
Bloque en attendant qu'une des requêtes rvalues soit terminée.
void broadcastMemoryBuffer(ByteArray &bytes, Int32 rank) override
Effectue un broadcast d'une zone mémoire.
Classe gérant un vecteur de réel de dimension 2.
Definition Real2.h:121
Classe gérant une matrice de réel de dimension 2x2.
Definition Real2x2.h:53
Classe gérant un vecteur de réel de dimension 3.
Definition Real3.h:132
Classe gérant une matrice de réel de dimension 3x3.
Definition Real3x3.h:66
Encapsulation d'un pointeur qui se détruit automatiquement.
Definition ScopedPtr.h:44
Positionne la phase de l'action en cours d'exécution.
Definition Timer.h:128
Emulation de réel en précision arbitraire.
Int64 largeSize() const
Nombre d'éléments du vecteur (en 64 bits)
Vue modifiable d'un tableau d'un type T.
void fill(const T &o) noexcept
Remplit le tableau avec la valeur o.
constexpr Integer size() const noexcept
Retourne la taille du tableau.
Classe de base des vecteurs 1D de données.
void resize(Int64 s)
Change le nombre d'éléments du tableau à s.
Vue constante d'un tableau de type T.
constexpr Integer size() const noexcept
Nombre d'éléments du tableau.
Interface gérant les statistiques sur l'exécution.
Interface du conteneur des dispatchers.
Definition Dispatchers.h:34
Interface du gestionnaire des échanges de messages.
Interface d'un profiler pour les échanges de messages.
Definition IProfiler.h:31
Interface des messages de sérialisation.
Gestionnaire des échanges de messages.
Informations sur la source d'un message.
Informations pour envoyer/recevoir un message point à point.
Requête d'un message.
Definition Request.h:77
constexpr __host__ __device__ SizeType size() const noexcept
Retourne la taille du tableau.
Definition Span.h:209
Vue d'un tableau d'éléments de type T.
Definition Span.h:510
Chaîne de caractères unicode.
Span< const Byte > bytes() const
Retourne la conversion de l'instance dans l'encodage UTF-8.
Definition String.cc:291
Sentinelle pour collecter les informations temporelles.
Definition TimeMetric.h:101
Vecteur 1D de données avec sémantique par valeur (style STL).
RunQueue makeQueue(const Runner &runner)
Créé une file associée à runner.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
ArrayView< Int64 > Int64ArrayView
Equivalent C d'un tableau à une dimension d'entiers 64 bits.
Definition UtilsTypes.h:662
UniqueArray< Byte > ByteUniqueArray
Tableau dynamique à une dimension de caractères.
Definition UtilsTypes.h:546
Espace de nommage contenant les types et déclarations qui gèrent le mécanisme de parallélisme par éch...
void mpAllGather(IMessagePassingMng *pm, const ISerializer *send_serializer, ISerializer *receive_serialize)
Message allGather() pour une sérialisation.
Definition Messages.cc:307
Espace de nom de Arccore.
Definition ArcaneTypes.h:24
Int32 Integer
Type représentant un entier.
std::int64_t Int64
Type entier signé sur 64 bits.
std::int32_t Int32
Type entier signé sur 32 bits.