Arcane  v3.16.4.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-2025 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-2025 */
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,
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
193: public MP::ISerializeDispatcher
194{
195 public:
196
197 explicit SerializeDispatcher(IParallelMng* pm)
198 : m_parallel_mng(pm)
199 {}
200
201 public:
203 {
204 return m_parallel_mng->createSerializeMessageListRef();
205 }
206 Request sendSerializer(const ISerializer* s,const PointToPointMessageInfo& message) override
207 {
208 return m_parallel_mng->sendSerializer(s,message);
209 }
210 Request receiveSerializer(ISerializer* s,const PointToPointMessageInfo& message) override
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)
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 // Attention à bien supprimer la référence sur la RunQueue
257 // avant de détruire le Runner car s'il n'y a pas d'autres
258 // références sur \a m_runner il sera détruit avec \a m_queue
259 // et ce dernier aura un \a m_runner détruit.
260 m_queue = RunQueue{};
261 m_runner = runner;
262 Accelerator::RunQueueBuildInfo build_info(-5);
263 m_queue = makeQueue(m_runner,build_info);
264 m_queue.setAsync(true);
265 }
266 Ref<IParallelMng> createSubParallelMngRef(Int32 color, Int32 key) override
267 {
268 return m_parallel_mng->_createSubParallelMngRef(color, key);
269 }
270
271 private:
272
273 ParallelMngDispatcher* m_parallel_mng = nullptr;
274 Runner m_runner;
275 RunQueue m_queue;
276 bool m_is_accelerator_aware_disabled = false;
277};
278
279/*---------------------------------------------------------------------------*/
280/*---------------------------------------------------------------------------*/
281
282/*---------------------------------------------------------------------------*/
283/*---------------------------------------------------------------------------*/
284
285ParallelMngDispatcher::
286ParallelMngDispatcher(const ParallelMngDispatcherBuildInfo& bi)
287: m_char(nullptr)
288, m_unsigned_char(nullptr)
289, m_signed_char(nullptr)
290, m_short(nullptr)
291, m_unsigned_short(nullptr)
292, m_int(nullptr)
293, m_unsigned_int(nullptr)
294, m_long(nullptr)
295, m_unsigned_long(nullptr)
296, m_long_long(nullptr)
297, m_unsigned_long_long(nullptr)
298, m_float(nullptr)
299, m_double(nullptr)
300, m_long_double(nullptr)
301, m_apreal(nullptr)
302, m_real2(nullptr)
303, m_real3(nullptr)
304, m_real2x2(nullptr)
305, m_real3x3(nullptr)
306, m_hpreal(nullptr)
307, m_time_stats(nullptr)
308, m_mp_dispatchers_ref(bi.dispatchersRef())
309, m_message_passing_mng_ref(bi.messagePassingMngRef())
310, m_control_dispatcher(new DefaultControlDispatcher(this))
311, m_serialize_dispatcher(new SerializeDispatcher(this))
312, m_parallel_mng_internal(new Impl(this))
313{
314}
315
316/*---------------------------------------------------------------------------*/
317/*---------------------------------------------------------------------------*/
318
319ParallelMngDispatcher::
320~ParallelMngDispatcher()
321{
322 m_mp_dispatchers_ref.reset();
323
324 delete m_parallel_mng_internal;
325
326 delete m_serialize_dispatcher;
327 delete m_control_dispatcher;
328 delete m_char;
329 delete m_signed_char;
330 delete m_unsigned_char;
331 delete m_short;
332 delete m_unsigned_short;
333 delete m_int;
334 delete m_unsigned_int;
335 delete m_long;
336 delete m_unsigned_long;
337 delete m_long_long;
338 delete m_unsigned_long_long;
339 delete m_apreal;
340 delete m_float;
341 delete m_double;
342 delete m_long_double;
343 delete m_real2;
344 delete m_real3;
345 delete m_real2x2;
346 delete m_real3x3;
347 delete m_hpreal;
348}
349
350/*---------------------------------------------------------------------------*/
351/*---------------------------------------------------------------------------*/
352
353void ParallelMngDispatcher::
354_setControlDispatcher(MP::IControlDispatcher* d)
355{
356 delete m_control_dispatcher;
357 m_control_dispatcher = d;
358}
359
360/*---------------------------------------------------------------------------*/
361/*---------------------------------------------------------------------------*/
362
363void ParallelMngDispatcher::
364_setSerializeDispatcher(MP::ISerializeDispatcher* d)
365{
366 delete m_serialize_dispatcher;
367 m_serialize_dispatcher = d;
368}
369
370/*---------------------------------------------------------------------------*/
371/*---------------------------------------------------------------------------*/
372
373void ParallelMngDispatcher::
374_setArccoreDispatchers()
375{
376 m_mp_dispatchers_ref->setDispatcher(m_char->toArccoreDispatcher());
377 m_mp_dispatchers_ref->setDispatcher(m_signed_char->toArccoreDispatcher());
378 m_mp_dispatchers_ref->setDispatcher(m_unsigned_char->toArccoreDispatcher());
379 m_mp_dispatchers_ref->setDispatcher(m_short->toArccoreDispatcher());
380 m_mp_dispatchers_ref->setDispatcher(m_unsigned_short->toArccoreDispatcher());
381 m_mp_dispatchers_ref->setDispatcher(m_int->toArccoreDispatcher());
382 m_mp_dispatchers_ref->setDispatcher(m_unsigned_int->toArccoreDispatcher());
383 m_mp_dispatchers_ref->setDispatcher(m_long->toArccoreDispatcher());
384 m_mp_dispatchers_ref->setDispatcher(m_unsigned_long->toArccoreDispatcher());
385 m_mp_dispatchers_ref->setDispatcher(m_long_long->toArccoreDispatcher());
386 m_mp_dispatchers_ref->setDispatcher(m_unsigned_long_long->toArccoreDispatcher());
387 m_mp_dispatchers_ref->setDispatcher(m_float->toArccoreDispatcher());
388 m_mp_dispatchers_ref->setDispatcher(m_double->toArccoreDispatcher());
389 m_mp_dispatchers_ref->setDispatcher(m_long_double->toArccoreDispatcher());
390
391 ARCANE_CHECK_POINTER(m_control_dispatcher);
392 m_mp_dispatchers_ref->setDispatcher(m_control_dispatcher);
393 ARCANE_CHECK_POINTER(m_serialize_dispatcher);
394 m_mp_dispatchers_ref->setDispatcher(m_serialize_dispatcher);
395}
396
397/*---------------------------------------------------------------------------*/
398/*---------------------------------------------------------------------------*/
399
401messagePassingMng() const
402{
403 return m_message_passing_mng_ref.get();
404}
405
406/*---------------------------------------------------------------------------*/
407/*---------------------------------------------------------------------------*/
408
411{
412 ITimeMetricCollector* c = nullptr;
413 ITimeStats* s = m_time_stats;
414 if (s)
415 c = s->metricCollector();
416 return c;
417}
418
419/*---------------------------------------------------------------------------*/
420/*---------------------------------------------------------------------------*/
421
424{
425 m_time_stats = ts;
426 if (ts){
428 _messagePassingMng()->setTimeMetricCollector(c);
429 }
430}
431
432/*---------------------------------------------------------------------------*/
433/*---------------------------------------------------------------------------*/
434
435TimeMetricAction ParallelMngDispatcher::
436_communicationTimeMetricAction() const
437{
438 return Timer::phaseAction(timeStats(),TP_Communication);
439}
440
441/*---------------------------------------------------------------------------*/
442/*---------------------------------------------------------------------------*/
443
444void ParallelMngDispatcher::
445broadcastString(String& str,Int32 rank)
446{
447 Int64 len_info[1];
448 Int32 my_rank = commRank();
449 Span<const Byte> bytes = str.bytes();
450 if (rank==my_rank){
451 len_info[0] = bytes.size();
452 broadcast(Int64ArrayView(1,len_info),rank);
453 ByteUniqueArray utf8_array(bytes);
454 broadcast(utf8_array,rank);
455 }
456 else{
457 broadcast(Int64ArrayView(1,len_info),rank);
458 ByteUniqueArray utf8_array(len_info[0]);
459 broadcast(utf8_array,rank);
460 str = String::fromUtf8(utf8_array);
461 }
462}
463
464/*---------------------------------------------------------------------------*/
465/*---------------------------------------------------------------------------*/
466
469{
470 Int64 size = 0;
471 if (commRank()==rank){
472 size = bytes.largeSize();
473 }
474 {
475 Int64ArrayView bs(1,&size);
476 broadcast(bs,rank);
477 }
478 if (commRank()!=rank)
479 bytes.resize(size);
480 if (size!=0)
481 broadcast(bytes,rank);
482}
483
484/*---------------------------------------------------------------------------*/
485/*---------------------------------------------------------------------------*/
486
488allGather(ISerializer* send_serializer, ISerializer* recv_serializer)
489{
490 Timer::Phase tphase(timeStats(), TP_Communication);
491 mpAllGather(_messagePassingMng(), send_serializer, recv_serializer);
492}
493
494/*---------------------------------------------------------------------------*/
495/*---------------------------------------------------------------------------*/
496
499{
500 TimeMetricSentry tphase(Timer::phaseAction(timeStats(),TP_Communication));
502
503 for (ISerializeMessage* m : messages)
504 message_list->addMessage(m);
505
506 message_list->waitMessages(Parallel::WaitAll);
507}
508
509/*---------------------------------------------------------------------------*/
510/*---------------------------------------------------------------------------*/
511
514{
515 TimeMetricSentry tphase(Timer::phaseAction(timeStats(), TP_Communication));
517
518 for (const Ref<ISerializeMessage>& v : messages)
519 message_list->addMessage(v.get());
520
521 message_list->waitMessages(Parallel::WaitAll);
522}
523
524/*---------------------------------------------------------------------------*/
525/*---------------------------------------------------------------------------*/
526
529{
530 return makeRef(_createSerializeMessageList());
531}
532
533/*---------------------------------------------------------------------------*/
534/*---------------------------------------------------------------------------*/
535
538{
539 return _createSerializeMessageList();
540}
541
542/*---------------------------------------------------------------------------*/
543/*---------------------------------------------------------------------------*/
544
547{
548 return _createSubParallelMng(kept_ranks);
549}
550
551/*---------------------------------------------------------------------------*/
552/*---------------------------------------------------------------------------*/
553
556{
557 return makeRef(_createSubParallelMng(kept_ranks));
558}
559
560/*---------------------------------------------------------------------------*/
561/*---------------------------------------------------------------------------*/
562
563Ref<IParallelMng> ParallelMngDispatcher::
564_createSubParallelMngRef([[maybe_unused]] Int32 color, [[maybe_unused]] Int32 key)
565{
566 ARCANE_THROW(NotImplementedException, "Create sub-parallelmng with split semantic");
567}
568
569/*---------------------------------------------------------------------------*/
570/*---------------------------------------------------------------------------*/
571
572UniqueArray<Integer> ParallelMngDispatcher::
573_doWaitRequests(ArrayView<Request> requests,eWaitType wait_type)
574{
575 Timer::Phase tphase(timeStats(),TP_Communication);
577 Integer nb_request = requests.size();
578 request_list->add(requests);
579 request_list->wait(wait_type);
580 // Ne pas oublier de recopier les requêtes car elles ont pu être modifiées
581 for (Integer i=0; i<nb_request; ++i )
582 requests[i] = request_list->request(i);
583 return request_list->doneRequestIndexes();
584}
585
586/*---------------------------------------------------------------------------*/
587/*---------------------------------------------------------------------------*/
588
591{
592 return _doWaitRequests(requests,Parallel::WaitSome);
593}
594
595/*---------------------------------------------------------------------------*/
596/*---------------------------------------------------------------------------*/
597
603
604/*---------------------------------------------------------------------------*/
605/*---------------------------------------------------------------------------*/
606
607#define ARCANE_PARALLEL_MANAGER_DISPATCH(field,type)\
608void ParallelMngDispatcher::\
609allGather(ConstArrayView<type> send_buf,ArrayView<type> recv_buf)\
610{\
611 Timer::Phase tphase(timeStats(),TP_Communication);\
612 field->allGather(send_buf,recv_buf);\
613}\
614void ParallelMngDispatcher::\
615gather(ConstArrayView<type> send_buf,ArrayView<type> recv_buf,Integer rank) \
616{\
617 Timer::Phase tphase(timeStats(),TP_Communication);\
618 field->gather(send_buf,recv_buf,rank); \
619}\
620void ParallelMngDispatcher::\
621allGatherVariable(ConstArrayView<type> send_buf,Array<type>& recv_buf)\
622{\
623 Timer::Phase tphase(timeStats(),TP_Communication);\
624 field->allGatherVariable(send_buf,recv_buf);\
625}\
626void ParallelMngDispatcher::\
627gatherVariable(ConstArrayView<type> send_buf,Array<type>& recv_buf,Integer rank) \
628{\
629 Timer::Phase tphase(timeStats(),TP_Communication);\
630 field->gatherVariable(send_buf,recv_buf,rank); \
631}\
632void ParallelMngDispatcher::\
633scatterVariable(ConstArrayView<type> send_buf,ArrayView<type> recv_buf,Integer root)\
634{\
635 Timer::Phase tphase(timeStats(),TP_Communication);\
636 field->scatterVariable(send_buf,recv_buf,root);\
637}\
638type ParallelMngDispatcher::\
639reduce(eReduceType rt,type v)\
640{\
641 Timer::Phase tphase(timeStats(),TP_Communication);\
642 return field->allReduce(rt,v);\
643}\
644void ParallelMngDispatcher::\
645reduce(eReduceType rt,ArrayView<type> v)\
646{\
647 Timer::Phase tphase(timeStats(),TP_Communication);\
648 field->allReduce(rt,v);\
649}\
650void ParallelMngDispatcher::\
651broadcast(ArrayView<type> send_buf,Integer id)\
652{ \
653 Timer::Phase tphase(timeStats(),TP_Communication);\
654 field->broadcast(send_buf,id);\
655}\
656void ParallelMngDispatcher::\
657send(ConstArrayView<type> values,Integer id)\
658{\
659 Timer::Phase tphase(timeStats(),TP_Communication);\
660 field->send(values,id);\
661}\
662void ParallelMngDispatcher::\
663recv(ArrayView<type> values,Integer id)\
664{\
665 Timer::Phase tphase(timeStats(),TP_Communication);\
666 field->recv(values,id);\
667}\
668Parallel::Request ParallelMngDispatcher::\
669send(ConstArrayView<type> values,Integer id,bool is_blocked)\
670{\
671 Timer::Phase tphase(timeStats(),TP_Communication);\
672 return field->send(values,id,is_blocked);\
673}\
674Request ParallelMngDispatcher::\
675send(Span<const type> values,const PointToPointMessageInfo& message) \
676{\
677 Timer::Phase tphase(timeStats(),TP_Communication);\
678 return field->send(values,message);\
679}\
680Parallel::Request ParallelMngDispatcher::\
681recv(ArrayView<type> values,Integer id,bool is_blocked)\
682{\
683 Timer::Phase tphase(timeStats(),TP_Communication);\
684 return field->recv(values,id,is_blocked);\
685}\
686Request ParallelMngDispatcher::\
687receive(Span<type> values,const PointToPointMessageInfo& message) \
688{\
689 Timer::Phase tphase(timeStats(),TP_Communication);\
690 return field->receive(values,message);\
691}\
692void ParallelMngDispatcher::\
693sendRecv(ConstArrayView<type> send_buf,ArrayView<type> recv_buf,Integer id)\
694{\
695 Timer::Phase tphase(timeStats(),TP_Communication);\
696 field->sendRecv(send_buf,recv_buf,id);\
697}\
698void ParallelMngDispatcher::\
699allToAll(ConstArrayView<type> send_buf,ArrayView<type> recv_buf,Integer count)\
700{\
701 Timer::Phase tphase(timeStats(),TP_Communication);\
702 field->allToAll(send_buf,recv_buf,count);\
703}\
704void ParallelMngDispatcher::\
705allToAllVariable(ConstArrayView<type> send_buf,Int32ConstArrayView send_count,\
706 Int32ConstArrayView send_index,ArrayView<type> recv_buf,\
707 Int32ConstArrayView recv_count,Int32ConstArrayView recv_index)\
708{\
709 Timer::Phase tphase(timeStats(),TP_Communication);\
710 field->allToAllVariable(send_buf,send_count,send_index,recv_buf,recv_count,recv_index);\
711}\
712type ParallelMngDispatcher::\
713scan(eReduceType rt,type v)\
714{\
715 Timer::Phase tphase(timeStats(),TP_Communication);\
716 return field->scan(rt,v);\
717}\
718void ParallelMngDispatcher::\
719computeMinMaxSum(type val,type& min_val,type& max_val,type& sum_val,Int32& min_proc,Int32& max_proc)\
720{\
721 Timer::Phase tphase(timeStats(),TP_Communication);\
722 field->computeMinMaxSum(val,min_val,max_val,sum_val,min_proc,max_proc);\
723}\
724IParallelDispatchT<type>* ParallelMngDispatcher::\
725dispatcher(type*)\
726{\
727 return field;\
728}\
729void ParallelMngDispatcher::\
730computeMinMaxSum(ConstArrayView<type> values, \
731 ArrayView<type> min_values, \
732 ArrayView<type> max_values, \
733 ArrayView<type> sum_values, \
734 ArrayView<Int32> min_ranks, \
735 ArrayView<Int32> max_ranks) \
736{\
737 Timer::Phase tphase(timeStats(),TP_Communication);\
738 field->computeMinMaxSum(values,min_values,max_values,sum_values,min_ranks,max_ranks);\
739}\
740void ParallelMngDispatcher::\
741scan(eReduceType rt,ArrayView<type> v)\
742{\
743 Timer::Phase tphase(timeStats(),TP_Communication);\
744 field->scan(rt,v);\
745}
746
747ARCANE_PARALLEL_MANAGER_DISPATCH(m_char,char)
748ARCANE_PARALLEL_MANAGER_DISPATCH(m_unsigned_char,unsigned char)
749ARCANE_PARALLEL_MANAGER_DISPATCH(m_signed_char,signed char)
750ARCANE_PARALLEL_MANAGER_DISPATCH(m_short,short)
751ARCANE_PARALLEL_MANAGER_DISPATCH(m_unsigned_short,unsigned short)
752ARCANE_PARALLEL_MANAGER_DISPATCH(m_int,int)
753ARCANE_PARALLEL_MANAGER_DISPATCH(m_unsigned_int,unsigned int)
754ARCANE_PARALLEL_MANAGER_DISPATCH(m_long,long)
755ARCANE_PARALLEL_MANAGER_DISPATCH(m_unsigned_long,unsigned long)
756ARCANE_PARALLEL_MANAGER_DISPATCH(m_long_long,long long)
757ARCANE_PARALLEL_MANAGER_DISPATCH(m_unsigned_long_long,unsigned long long)
758ARCANE_PARALLEL_MANAGER_DISPATCH(m_float,float)
759ARCANE_PARALLEL_MANAGER_DISPATCH(m_double,double)
760ARCANE_PARALLEL_MANAGER_DISPATCH(m_long_double,long double)
761ARCANE_PARALLEL_MANAGER_DISPATCH(m_apreal,APReal)
762ARCANE_PARALLEL_MANAGER_DISPATCH(m_real2,Real2)
763ARCANE_PARALLEL_MANAGER_DISPATCH(m_real3,Real3)
764ARCANE_PARALLEL_MANAGER_DISPATCH(m_real2x2,Real2x2)
765ARCANE_PARALLEL_MANAGER_DISPATCH(m_real3x3,Real3x3)
766ARCANE_PARALLEL_MANAGER_DISPATCH(m_hpreal,HPReal)
767
768/*---------------------------------------------------------------------------*/
769/*---------------------------------------------------------------------------*/
770
771} // End namespace Arcane
772
773/*---------------------------------------------------------------------------*/
774/*---------------------------------------------------------------------------*/
775
776namespace Arccore
777{
780}
781
782/*---------------------------------------------------------------------------*/
783/*---------------------------------------------------------------------------*/
#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.
Emulation de réel en précision arbitraire.
Int64 largeSize() const
Nombre d'éléments du vecteur (en 64 bits)
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
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.
void resize(Int64 s)
Change le nombre d'éléments du tableau à s.
Vue constante d'un tableau de type T.
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.
Interface gérant les statistiques sur l'exécution.
virtual ITimeMetricCollector * metricCollector()=0
Interface de collection associée.
Interface du conteneur des dispatchers.
Definition Dispatchers.h:34
Interface du gestionnaire des échanges de messages.
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
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
Référence à une instance.
constexpr __host__ __device__ SizeType size() const noexcept
Retourne la taille du tableau.
Definition Span.h:212
Vue d'un tableau d'éléments de type T.
Definition Span.h:513
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
Positionne la phase de l'action en cours d'exécution.
Definition Timer.h:128
Vecteur 1D de données avec sémantique par valeur (style STL).
void reset()
Positionne l'instance au pointeur nul.
RunQueue makeQueue(const Runner &runner)
Créé une file associée à runner.
@ Sequential
Politique d'exécution séquentielle.
@ WaitSome
Attend que tous les messages de la liste soient traités.
void mpAllGather(IMessagePassingMng *pm, const ISerializer *send_serializer, ISerializer *receive_serialize)
Message allGather() pour une sérialisation.
Definition Messages.cc:308
-*- 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:538
std::int64_t Int64
Type entier signé sur 64 bits.
Int32 Integer
Type représentant un entier.
Array< Byte > ByteArray
Tableau dynamique à une dimension de caractères.
Definition UtilsTypes.h:208
ConstArrayView< Int32 > Int32ConstArrayView
Equivalent C d'un tableau à une dimension d'entiers 32 bits.
Definition UtilsTypes.h:569
UniqueArray< Byte > ByteUniqueArray
Tableau dynamique à une dimension de caractères.
Definition UtilsTypes.h:422
auto makeRef(InstanceType *t) -> Ref< InstanceType >
Créé une référence sur un pointeur.
std::int32_t Int32
Type entier signé sur 32 bits.
Espace de nom de Arccore.
Ref< TrueType > createRef(Args &&... args)
Créé une instance de type TrueType avec les arguments Args et retourne une référence dessus.
auto makeRef(InstanceType *t) -> Ref< InstanceType >
Créé une référence sur un pointeur.