Arcane  4.2.3.0
User documentation
Loading...
Searching...
No Matches
ParallelMngDispatcher.cc
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 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-2026 */
9/* */
10/* Redirection of message handling based on argument type. */
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/NotSupportedException.h"
19#include "arcane/utils/ScopedPtr.h"
20#include "arcane/utils/ITraceMng.h"
21#include "arcane/utils/ValueConvert.h"
22#include "arcane/utils/FatalErrorException.h"
23
24#include "arcane/core/ParallelMngDispatcher.h"
25#include "arcane/core/IParallelDispatch.h"
26#include "arcane/core/Timer.h"
27#include "arcane/core/ITimeStats.h"
28#include "arcane/core/IParallelNonBlockingCollective.h"
29#include "arcane/core/internal/ParallelMngInternal.h"
30
31#include "arcane/accelerator/core/Runner.h"
32#include "arcane/accelerator/core/RunQueueBuildInfo.h"
33
34#include "arccore/message_passing/Dispatchers.h"
36#include "arccore/message_passing/MessagePassingMng.h"
37#include "arccore/message_passing/IControlDispatcher.h"
38#include "arccore/message_passing/ISerializeDispatcher.h"
39#include "arccore/message_passing/PointToPointMessageInfo.h"
40#include "arccore/message_passing/IRequestList.h"
41#include "arccore/message_passing/ISerializeMessageList.h"
42#include "arccore/trace/internal/TimeMetric.h"
43
44/*---------------------------------------------------------------------------*/
45/*---------------------------------------------------------------------------*/
46
47namespace Arcane
48{
49using namespace Arccore::MessagePassing;
50
51/*---------------------------------------------------------------------------*/
52/*---------------------------------------------------------------------------*/
53
54ParallelMngDispatcherBuildInfo::
55ParallelMngDispatcherBuildInfo(Int32 comm_rank, Int32 comm_size)
56: m_comm_rank(comm_rank)
57, m_comm_size(comm_size)
58{
59 _init();
60}
61
62
63/*---------------------------------------------------------------------------*/
64/*---------------------------------------------------------------------------*/
65
66ParallelMngDispatcherBuildInfo::
67ParallelMngDispatcherBuildInfo(Int32 comm_rank, Int32 comm_size, MP::Communicator communicator)
68: m_comm_rank(comm_rank)
69, m_comm_size(comm_size)
70, m_communicator(communicator)
71{
72 _init();
73}
74
75/*---------------------------------------------------------------------------*/
76/*---------------------------------------------------------------------------*/
77
78void ParallelMngDispatcherBuildInfo::
79_init()
80{
81 m_dispatchers_ref = createRef<MP::Dispatchers>();
82}
83
84/*---------------------------------------------------------------------------*/
85/*---------------------------------------------------------------------------*/
86
87ParallelMngDispatcher::DefaultControlDispatcher::
88DefaultControlDispatcher(ParallelMngDispatcher* pm)
89: m_parallel_mng(pm)
90{
91}
92
93void ParallelMngDispatcher::DefaultControlDispatcher::
94waitAllRequests(ArrayView<Request> requests)
95{
96 m_parallel_mng->waitAllRequests(requests);
97}
98
99void ParallelMngDispatcher::DefaultControlDispatcher::
100waitSomeRequests(ArrayView<Request> requests, ArrayView<bool> indexes,
101 bool is_non_blocking)
102{
103 UniqueArray<Integer> done_requests;
104 if (is_non_blocking)
105 done_requests = m_parallel_mng->testSomeRequests(requests);
106 else
107 done_requests = m_parallel_mng->waitSomeRequests(requests);
108 indexes.fill(false);
109 for (int x : done_requests)
110 indexes[x] = true;
111}
112
113IMessagePassingMng* ParallelMngDispatcher::DefaultControlDispatcher::
114commSplit(bool keep)
115{
116 ARCANE_UNUSED(keep);
117 ARCANE_THROW(NotSupportedException, "Use mpSplitCommunicator() instead");
118}
119
120Ref<IMessagePassingMng> ParallelMngDispatcher::DefaultControlDispatcher::
121splitCommunicator(bool keep)
122{
123 Ref<IParallelMng> new_pm = m_parallel_mng->_createSubParallelMngRef(keep);
124 // The new IParallelMng may be null if this rank is not in the new communicator
125 if (new_pm)
126 return makeRef<IMessagePassingMng>(new_pm->messagePassingMng());
127 return {};
128}
129
130void ParallelMngDispatcher::DefaultControlDispatcher::
131barrier()
132{
133 m_parallel_mng->barrier();
134}
135
136Request ParallelMngDispatcher::DefaultControlDispatcher::
137nonBlockingBarrier()
138{
139 return m_parallel_mng->nonBlockingCollective()->barrier();
140}
141
142MessageId ParallelMngDispatcher::DefaultControlDispatcher::
143probe(const PointToPointMessageInfo& message)
144{
145 return m_parallel_mng->probe(message);
146}
147
148MessageSourceInfo ParallelMngDispatcher::DefaultControlDispatcher::
149legacyProbe(const PointToPointMessageInfo& message)
150{
151 return m_parallel_mng->legacyProbe(message);
152}
153
154Ref<Parallel::IRequestList> ParallelMngDispatcher::DefaultControlDispatcher::
155createRequestListRef()
156{
157 return m_parallel_mng->createRequestListRef();
158}
159
160/*---------------------------------------------------------------------------*/
161/*---------------------------------------------------------------------------*/
162
163void ParallelMngDispatcher::DefaultControlDispatcher::
164setProfiler(MP::IProfiler* p)
165{
166 ARCANE_UNUSED(p);
167 ARCANE_THROW(NotImplementedException, "setProfiler() from MessagePassing::IControlDispatcher");
168}
169
170/*---------------------------------------------------------------------------*/
171/*---------------------------------------------------------------------------*/
172
174: public MP::ISerializeDispatcher
175{
176 public:
177
178 explicit SerializeDispatcher(IParallelMng* pm)
179 : m_parallel_mng(pm)
180 {}
181
182 public:
183
185 {
186 return m_parallel_mng->createSerializeMessageListRef();
187 }
188 Request sendSerializer(const ISerializer* s, const PointToPointMessageInfo& message) override
189 {
190 return m_parallel_mng->sendSerializer(s, message);
191 }
192 Request receiveSerializer(ISerializer* s, const PointToPointMessageInfo& message) override
193 {
194 return m_parallel_mng->receiveSerializer(s, message);
195 }
196
197 private:
198
199 IParallelMng* m_parallel_mng = nullptr;
200};
201
202/*---------------------------------------------------------------------------*/
203/*---------------------------------------------------------------------------*/
204
205/*---------------------------------------------------------------------------*/
206/*---------------------------------------------------------------------------*/
207
208ParallelMngDispatcher::
209ParallelMngDispatcher(const ParallelMngDispatcherBuildInfo& bi)
210: m_comm_rank(bi.commRank())
211, m_comm_size(bi.commSize())
212, m_communicator(bi.communicator())
213, m_char(nullptr)
214, m_unsigned_char(nullptr)
215, m_signed_char(nullptr)
216, m_short(nullptr)
217, m_unsigned_short(nullptr)
218, m_int(nullptr)
219, m_unsigned_int(nullptr)
220, m_long(nullptr)
221, m_unsigned_long(nullptr)
222, m_long_long(nullptr)
223, m_unsigned_long_long(nullptr)
224, m_float(nullptr)
225, m_double(nullptr)
226, m_long_double(nullptr)
227, m_apreal(nullptr)
228, m_real2(nullptr)
229, m_real3(nullptr)
230, m_real2x2(nullptr)
231, m_real3x3(nullptr)
232, m_hpreal(nullptr)
233, m_time_stats(nullptr)
234, m_mp_dispatchers_ref(bi.dispatchersRef())
235, m_control_dispatcher(new DefaultControlDispatcher(this))
236, m_serialize_dispatcher(new SerializeDispatcher(this))
237, m_parallel_mng_internal(new ParallelMngInternal(this))
238{
239 m_message_passing_mng = this;
240}
241
242/*---------------------------------------------------------------------------*/
243/*---------------------------------------------------------------------------*/
244
245ParallelMngDispatcher::
246~ParallelMngDispatcher()
247{
248 m_mp_dispatchers_ref.reset();
249
250 delete m_parallel_mng_internal;
251
252 delete m_serialize_dispatcher;
253 delete m_control_dispatcher;
254 delete m_char;
255 delete m_signed_char;
256 delete m_unsigned_char;
257 delete m_short;
258 delete m_unsigned_short;
259 delete m_int;
260 delete m_unsigned_int;
261 delete m_long;
262 delete m_unsigned_long;
263 delete m_long_long;
264 delete m_unsigned_long_long;
265 delete m_apreal;
266 delete m_float;
267 delete m_double;
268 delete m_long_double;
269 delete m_real2;
270 delete m_real3;
271 delete m_real2x2;
272 delete m_real3x3;
273 delete m_hpreal;
274}
275
276/*---------------------------------------------------------------------------*/
277/*---------------------------------------------------------------------------*/
278
279void ParallelMngDispatcher::
280_setControlDispatcher(MP::IControlDispatcher* d)
281{
282 delete m_control_dispatcher;
283 m_control_dispatcher = d;
284}
285
286/*---------------------------------------------------------------------------*/
287/*---------------------------------------------------------------------------*/
288
289void ParallelMngDispatcher::
290_setSerializeDispatcher(MP::ISerializeDispatcher* d)
291{
292 delete m_serialize_dispatcher;
293 m_serialize_dispatcher = d;
294}
295
296/*---------------------------------------------------------------------------*/
297/*---------------------------------------------------------------------------*/
298
299void ParallelMngDispatcher::
300_setArccoreDispatchers()
301{
302 m_mp_dispatchers_ref->setDispatcher(m_char->toArccoreDispatcher());
303 m_mp_dispatchers_ref->setDispatcher(m_signed_char->toArccoreDispatcher());
304 m_mp_dispatchers_ref->setDispatcher(m_unsigned_char->toArccoreDispatcher());
305 m_mp_dispatchers_ref->setDispatcher(m_short->toArccoreDispatcher());
306 m_mp_dispatchers_ref->setDispatcher(m_unsigned_short->toArccoreDispatcher());
307 m_mp_dispatchers_ref->setDispatcher(m_int->toArccoreDispatcher());
308 m_mp_dispatchers_ref->setDispatcher(m_unsigned_int->toArccoreDispatcher());
309 m_mp_dispatchers_ref->setDispatcher(m_long->toArccoreDispatcher());
310 m_mp_dispatchers_ref->setDispatcher(m_unsigned_long->toArccoreDispatcher());
311 m_mp_dispatchers_ref->setDispatcher(m_long_long->toArccoreDispatcher());
312 m_mp_dispatchers_ref->setDispatcher(m_unsigned_long_long->toArccoreDispatcher());
313 m_mp_dispatchers_ref->setDispatcher(m_float->toArccoreDispatcher());
314 m_mp_dispatchers_ref->setDispatcher(m_double->toArccoreDispatcher());
315 m_mp_dispatchers_ref->setDispatcher(m_long_double->toArccoreDispatcher());
316
317 ARCANE_CHECK_POINTER(m_control_dispatcher);
318 m_mp_dispatchers_ref->setDispatcher(m_control_dispatcher);
319 ARCANE_CHECK_POINTER(m_serialize_dispatcher);
320 m_mp_dispatchers_ref->setDispatcher(m_serialize_dispatcher);
321}
322
323/*---------------------------------------------------------------------------*/
324/*---------------------------------------------------------------------------*/
325
327messagePassingMng() const
328{
329 return m_message_passing_mng;
330}
331
332/*---------------------------------------------------------------------------*/
333/*---------------------------------------------------------------------------*/
334
335MP::IDispatchers* ParallelMngDispatcher::
336dispatchers()
337{
338 return m_mp_dispatchers_ref.get();
339}
340
341/*---------------------------------------------------------------------------*/
342/*---------------------------------------------------------------------------*/
343
344ITimeMetricCollector* ParallelMngDispatcher::
346{
347 ITimeMetricCollector* c = nullptr;
348 ITimeStats* s = m_time_stats;
349 if (s)
350 c = s->metricCollector();
351 return c;
352}
353
354/*---------------------------------------------------------------------------*/
355/*---------------------------------------------------------------------------*/
356
359{
360 m_time_stats = ts;
361 if (ts) {
362 ITimeMetricCollector* c = ts->metricCollector();
363 m_time_metric_collector = c;
364 }
365}
366
367/*---------------------------------------------------------------------------*/
368/*---------------------------------------------------------------------------*/
369
370TimeMetricAction ParallelMngDispatcher::
371_communicationTimeMetricAction() const
372{
373 return Timer::phaseAction(timeStats(), TP_Communication);
374}
375
376/*---------------------------------------------------------------------------*/
377/*---------------------------------------------------------------------------*/
378
379void ParallelMngDispatcher::
380broadcastString(String& str, Int32 rank)
381{
382 Int64 len_info[1];
383 Int32 my_rank = commRank();
384 Span<const Byte> bytes = str.bytes();
385 if (rank == my_rank) {
386 len_info[0] = bytes.size();
387 broadcast(Int64ArrayView(1, len_info), rank);
388 ByteUniqueArray utf8_array(bytes);
389 broadcast(utf8_array, rank);
390 }
391 else {
392 broadcast(Int64ArrayView(1, len_info), rank);
393 ByteUniqueArray utf8_array(len_info[0]);
394 broadcast(utf8_array, rank);
395 str = String::fromUtf8(utf8_array);
396 }
397}
398
399/*---------------------------------------------------------------------------*/
400/*---------------------------------------------------------------------------*/
401
404{
405 Int64 size = 0;
406 if (commRank() == rank) {
407 size = bytes.largeSize();
408 }
409 {
410 Int64ArrayView bs(1, &size);
411 broadcast(bs, rank);
412 }
413 if (commRank() != rank)
414 bytes.resize(size);
415 if (size != 0)
416 broadcast(bytes, rank);
417}
418
419/*---------------------------------------------------------------------------*/
420/*---------------------------------------------------------------------------*/
421
423allGather(ISerializer* send_serializer, ISerializer* recv_serializer)
424{
425 Timer::Phase tphase(timeStats(), TP_Communication);
426 mpAllGather(_messagePassingMng(), send_serializer, recv_serializer);
427}
428
429/*---------------------------------------------------------------------------*/
430/*---------------------------------------------------------------------------*/
431
434{
435 TimeMetricSentry tphase(Timer::phaseAction(timeStats(), TP_Communication));
437
438 for (ISerializeMessage* m : messages)
439 message_list->addMessage(m);
440
441 message_list->waitMessages(Parallel::WaitAll);
442}
443
444/*---------------------------------------------------------------------------*/
445/*---------------------------------------------------------------------------*/
446
449{
450 TimeMetricSentry tphase(Timer::phaseAction(timeStats(), TP_Communication));
452
453 for (const Ref<ISerializeMessage>& v : messages)
454 message_list->addMessage(v.get());
455
456 message_list->waitMessages(Parallel::WaitAll);
457}
458
459/*---------------------------------------------------------------------------*/
460/*---------------------------------------------------------------------------*/
461
464{
465 return makeRef(_createSerializeMessageList());
466}
467
468/*---------------------------------------------------------------------------*/
469/*---------------------------------------------------------------------------*/
470
473{
474 return _createSerializeMessageList();
475}
476
477/*---------------------------------------------------------------------------*/
478/*---------------------------------------------------------------------------*/
479
482{
483 return _createSubParallelMng(kept_ranks);
484}
485
486/*---------------------------------------------------------------------------*/
487/*---------------------------------------------------------------------------*/
488
491{
492 return makeRef(_createSubParallelMng(kept_ranks));
493}
494
495/*---------------------------------------------------------------------------*/
496/*---------------------------------------------------------------------------*/
497
498Ref<IParallelMng> ParallelMngDispatcher::
499_createSubParallelMngRef([[maybe_unused]] Int32 color, [[maybe_unused]] Int32 key)
500{
501 ARCANE_THROW(NotImplementedException, "Create sub-parallelmng with split semantic");
502}
503
504/*---------------------------------------------------------------------------*/
505/*---------------------------------------------------------------------------*/
506
507Ref<IParallelMng> ParallelMngDispatcher::
508_createSubParallelMngRef(bool is_kept)
509{
510 // This method is generic but is re-implemented for MpiParallelMng
511 // to use MPI_Comm_split without the need to do an allGather.
512 Int32 nb_rank = commSize();
513 UniqueArray<Int8> all_kept(nb_rank);
514 Int8 kept = (is_kept) ? 1 : 0;
515 ArrayView<Int8> my_value(1, &kept);
516 this->allGather(my_value, all_kept);
517 UniqueArray<Int32> kept_ranks;
518 kept_ranks.reserve(nb_rank);
519 for (Int32 i = 0; i < nb_rank; ++i)
520 if (all_kept[i] != 0)
521 kept_ranks.add(i);
522 return createSubParallelMngRef(kept_ranks);
523}
524
525/*---------------------------------------------------------------------------*/
526/*---------------------------------------------------------------------------*/
527
528UniqueArray<Integer> ParallelMngDispatcher::
529_doWaitRequests(ArrayView<Request> requests, eWaitType wait_type)
530{
531 Timer::Phase tphase(timeStats(), TP_Communication);
532 Ref<IRequestList> request_list(createRequestListRef());
533 Integer nb_request = requests.size();
534 request_list->add(requests);
535 request_list->wait(wait_type);
536 // Don't forget to copy the requests, as they might have been modified
537 for (Integer i = 0; i < nb_request; ++i)
538 requests[i] = request_list->request(i);
539 return request_list->doneRequestIndexes();
540}
541
542/*---------------------------------------------------------------------------*/
543/*---------------------------------------------------------------------------*/
544
547{
548 return _doWaitRequests(requests, Parallel::WaitSome);
549}
550
551/*---------------------------------------------------------------------------*/
552/*---------------------------------------------------------------------------*/
553
559
560/*---------------------------------------------------------------------------*/
561/*---------------------------------------------------------------------------*/
562
563#define ARCANE_PARALLEL_MANAGER_DISPATCH(field, type) \
564 void ParallelMngDispatcher:: \
565 allGather(ConstArrayView<type> send_buf, ArrayView<type> recv_buf) \
566 { \
567 Timer::Phase tphase(timeStats(), TP_Communication); \
568 (field)->allGather(send_buf, recv_buf); \
569 } \
570 void ParallelMngDispatcher:: \
571 gather(ConstArrayView<type> send_buf, ArrayView<type> recv_buf, Integer rank) \
572 { \
573 Timer::Phase tphase(timeStats(), TP_Communication); \
574 (field)->gather(send_buf, recv_buf, rank); \
575 } \
576 void ParallelMngDispatcher:: \
577 allGatherVariable(ConstArrayView<type> send_buf, Array<type>& recv_buf) \
578 { \
579 Timer::Phase tphase(timeStats(), TP_Communication); \
580 (field)->allGatherVariable(send_buf, recv_buf); \
581 } \
582 void ParallelMngDispatcher:: \
583 gatherVariable(ConstArrayView<type> send_buf, Array<type>& recv_buf, Integer rank) \
584 { \
585 Timer::Phase tphase(timeStats(), TP_Communication); \
586 (field)->gatherVariable(send_buf, recv_buf, rank); \
587 } \
588 void ParallelMngDispatcher:: \
589 scatterVariable(ConstArrayView<type> send_buf, ArrayView<type> recv_buf, Integer root) \
590 { \
591 Timer::Phase tphase(timeStats(), TP_Communication); \
592 (field)->scatterVariable(send_buf, recv_buf, root); \
593 } \
594 type ParallelMngDispatcher:: \
595 reduce(eReduceType rt, type v) \
596 { \
597 Timer::Phase tphase(timeStats(), TP_Communication); \
598 return (field)->allReduce(rt, v); \
599 } \
600 void ParallelMngDispatcher:: \
601 reduce(eReduceType rt, ArrayView<type> v) \
602 { \
603 Timer::Phase tphase(timeStats(), TP_Communication); \
604 (field)->allReduce(rt, v); \
605 } \
606 void ParallelMngDispatcher:: \
607 broadcast(ArrayView<type> send_buf, Integer id) \
608 { \
609 Timer::Phase tphase(timeStats(), TP_Communication); \
610 (field)->broadcast(send_buf, id); \
611 } \
612 void ParallelMngDispatcher:: \
613 send(ConstArrayView<type> values, Integer id) \
614 { \
615 Timer::Phase tphase(timeStats(), TP_Communication); \
616 (field)->send(values, id); \
617 } \
618 void ParallelMngDispatcher:: \
619 recv(ArrayView<type> values, Integer id) \
620 { \
621 Timer::Phase tphase(timeStats(), TP_Communication); \
622 (field)->recv(values, id); \
623 } \
624 Parallel::Request ParallelMngDispatcher:: \
625 send(ConstArrayView<type> values, Integer id, bool is_blocked) \
626 { \
627 Timer::Phase tphase(timeStats(), TP_Communication); \
628 return (field)->send(values, id, is_blocked); \
629 } \
630 Request ParallelMngDispatcher:: \
631 send(Span<const type> values, const PointToPointMessageInfo& message) \
632 { \
633 Timer::Phase tphase(timeStats(), TP_Communication); \
634 return (field)->send(values, message); \
635 } \
636 Parallel::Request ParallelMngDispatcher:: \
637 recv(ArrayView<type> values, Integer id, bool is_blocked) \
638 { \
639 Timer::Phase tphase(timeStats(), TP_Communication); \
640 return (field)->recv(values, id, is_blocked); \
641 } \
642 Request ParallelMngDispatcher:: \
643 receive(Span<type> values, const PointToPointMessageInfo& message) \
644 { \
645 Timer::Phase tphase(timeStats(), TP_Communication); \
646 return (field)->receive(values, message); \
647 } \
648 void ParallelMngDispatcher:: \
649 sendRecv(ConstArrayView<type> send_buf, ArrayView<type> recv_buf, Integer id) \
650 { \
651 Timer::Phase tphase(timeStats(), TP_Communication); \
652 (field)->sendRecv(send_buf, recv_buf, id); \
653 } \
654 void ParallelMngDispatcher:: \
655 allToAll(ConstArrayView<type> send_buf, ArrayView<type> recv_buf, Integer count) \
656 { \
657 Timer::Phase tphase(timeStats(), TP_Communication); \
658 (field)->allToAll(send_buf, recv_buf, count); \
659 } \
660 void ParallelMngDispatcher:: \
661 allToAllVariable(ConstArrayView<type> send_buf, Int32ConstArrayView send_count, \
662 Int32ConstArrayView send_index, ArrayView<type> recv_buf, \
663 Int32ConstArrayView recv_count, Int32ConstArrayView recv_index) \
664 { \
665 Timer::Phase tphase(timeStats(), TP_Communication); \
666 (field)->allToAllVariable(send_buf, send_count, send_index, recv_buf, recv_count, recv_index); \
667 } \
668 type ParallelMngDispatcher:: \
669 scan(eReduceType rt, type v) \
670 { \
671 Timer::Phase tphase(timeStats(), TP_Communication); \
672 return (field)->scan(rt, v); \
673 } \
674 void ParallelMngDispatcher:: \
675 computeMinMaxSum(type val, type& min_val, type& max_val, type& sum_val, Int32& min_proc, Int32& max_proc) \
676 { \
677 Timer::Phase tphase(timeStats(), TP_Communication); \
678 (field)->computeMinMaxSum(val, min_val, max_val, sum_val, min_proc, max_proc); \
679 } \
680 IParallelDispatchT<type>* ParallelMngDispatcher:: \
681 dispatcher(type*) \
682 { \
683 return (field); \
684 } \
685 void ParallelMngDispatcher:: \
686 computeMinMaxSum(ConstArrayView<type> values, \
687 ArrayView<type> min_values, \
688 ArrayView<type> max_values, \
689 ArrayView<type> sum_values, \
690 ArrayView<Int32> min_ranks, \
691 ArrayView<Int32> max_ranks) \
692 { \
693 Timer::Phase tphase(timeStats(), TP_Communication); \
694 (field)->computeMinMaxSum(values, min_values, max_values, sum_values, min_ranks, max_ranks); \
695 } \
696 void ParallelMngDispatcher:: \
697 scan(eReduceType rt, ArrayView<type> v) \
698 { \
699 Timer::Phase tphase(timeStats(), TP_Communication); \
700 (field)->scan(rt, v); \
701 }
702
703ARCANE_PARALLEL_MANAGER_DISPATCH(m_char, char)
704ARCANE_PARALLEL_MANAGER_DISPATCH(m_unsigned_char, unsigned char)
705ARCANE_PARALLEL_MANAGER_DISPATCH(m_signed_char, signed char)
706ARCANE_PARALLEL_MANAGER_DISPATCH(m_short, short)
707ARCANE_PARALLEL_MANAGER_DISPATCH(m_unsigned_short, unsigned short)
708ARCANE_PARALLEL_MANAGER_DISPATCH(m_int, int)
709ARCANE_PARALLEL_MANAGER_DISPATCH(m_unsigned_int, unsigned int)
710ARCANE_PARALLEL_MANAGER_DISPATCH(m_long, long)
711ARCANE_PARALLEL_MANAGER_DISPATCH(m_unsigned_long, unsigned long)
712ARCANE_PARALLEL_MANAGER_DISPATCH(m_long_long, long long)
713ARCANE_PARALLEL_MANAGER_DISPATCH(m_unsigned_long_long, unsigned long long)
714ARCANE_PARALLEL_MANAGER_DISPATCH(m_float, float)
715ARCANE_PARALLEL_MANAGER_DISPATCH(m_double, double)
716ARCANE_PARALLEL_MANAGER_DISPATCH(m_long_double, long double)
717ARCANE_PARALLEL_MANAGER_DISPATCH(m_apreal, APReal)
718ARCANE_PARALLEL_MANAGER_DISPATCH(m_real2, Real2)
719ARCANE_PARALLEL_MANAGER_DISPATCH(m_real3, Real3)
720ARCANE_PARALLEL_MANAGER_DISPATCH(m_real2x2, Real2x2)
721ARCANE_PARALLEL_MANAGER_DISPATCH(m_real3x3, Real3x3)
722ARCANE_PARALLEL_MANAGER_DISPATCH(m_hpreal, HPReal)
723
724/*---------------------------------------------------------------------------*/
725/*---------------------------------------------------------------------------*/
726
727} // End namespace Arcane
728
729/*---------------------------------------------------------------------------*/
730/*---------------------------------------------------------------------------*/
731
732namespace Arccore
733{
736} // namespace Arccore
737
738/*---------------------------------------------------------------------------*/
739/*---------------------------------------------------------------------------*/
#define ARCANE_CHECK_POINTER(ptr)
Macro returning the pointer ptr if it is not null or throwing an exception if it is null.
#define ARCANE_THROW(exception_class,...)
Macro for throwing an exception with formatting.
Brief list of message exchange functions.
#define ARCCORE_DEFINE_REFERENCE_COUNTED_CLASS(class_name)
Macro to define methods and types for a class that uses a reference counter.
Emulation of real number in arbitrary precision.
Int64 largeSize() const
Number of elements in the vector (in 64 bits).
Modifiable view of an array of type T.
void fill(const T &o) noexcept
Fills the array with the value o.
constexpr Integer size() const noexcept
Returns the size of the array.
void resize(Int64 s)
Changes the number of elements in the array to s.
void add(ConstReferenceType val)
Adds element val to the end of the array.
void reserve(Int64 new_capacity)
Reserves memory for new_capacity elements.
Constant view of an array of type T.
Class implementing a High-Precision real number.
Interface of the parallelism manager for a subdomain.
virtual Ref< Parallel::IRequestList > createRequestListRef()=0
Creates a request list for this manager.
virtual ITimeMetricCollector * metricCollector()=0
Associated collection interface.
Interface of the message passing manager.
Information about the source of a message.
Information for sending/receiving a point-to-point message.
Request sendSerializer(const ISerializer *s, const PointToPointMessageInfo &message) override
Sending message.
Request receiveSerializer(ISerializer *s, const PointToPointMessageInfo &message) override
Receiving message.
Ref< ISerializeMessageList > createSerializeMessageListRef() override
Create a list of serialization messages.
ISerializeMessageList * createSerializeMessageList() final
Creates a list to manage 'ISerializeMessage'.
void setTimeStats(ITimeStats *ts) override
Sets the statistics manager.
void allGather(ISerializer *send_serializer, ISerializer *recv_serializer) override
Redefines allGather here to avoid hiding the symbol in derived classes.
Ref< IParallelMng > createSubParallelMngRef(Int32ConstArrayView kept_ranks) override
Creates a new parallelism manager for a subset of ranks.
Int32 commSize() const override
Number of instances in the communicator.
void processMessages(ConstArrayView< ISerializeMessage * > messages) override
Executes the operations of messages messages.
IMessagePassingMng * messagePassingMng() const override
Associated Arccore message passing manager.
Int32 commRank() const override
Rank of this instance in the communicator.
ITimeMetricCollector * timeMetricCollector() const override
Interface for collecting execution times (can be null).
IParallelMng * createSubParallelMng(Int32ConstArrayView kept_ranks) final
Creates a new parallelism manager for a subset of ranks.
UniqueArray< Integer > testSomeRequests(ArrayView< Request > requests) override
Tests if one of the rvalues requests is complete.
ITimeStats * timeStats() const override
Associated statistics manager (can be null).
Ref< ISerializeMessageList > createSerializeMessageListRef() final
Creates a list to manage 'ISerializeMessage'.
UniqueArray< Integer > waitSomeRequests(ArrayView< Request > requests) override
Blocks while waiting for one of the rvalues requests to complete.
void broadcastMemoryBuffer(ByteArray &bytes, Int32 rank) override
Performs a broadcast of a memory region.
Class managing a 2-dimensional real vector.
Class managing a 2x2 matrix of reals.
Class managing a 3-dimensional real vector.
Class managing a 3x3 real matrix.
void reset()
Positions the instance to the null pointer.
InstanceType * get() const
Associated instance or nullptr if none.
Reference to an instance.
constexpr __host__ __device__ SizeType size() const noexcept
Returns the size of the array.
Definition Span.h:325
View of an array of elements of type T.
Definition Span.h:633
Span< const Byte > bytes() const
Returns the conversion of the instance into UTF-8 encoding.
Definition String.cc:293
Positions the phase of the currently executing action.
Definition Timer.h:142
1D data vector with value semantics (STL style).
@ WaitSome
Wait until all messages in the list are processed.
void mpAllGather(IMessagePassingMng *pm, const ISerializer *send_serializer, ISerializer *receive_serialize)
allGather() message for serialization
Definition Messages.cc:319
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
ArrayView< Int64 > Int64ArrayView
C equivalent of a 1D array of 64-bit integers.
Definition UtilsTypes.h:445
std::int64_t Int64
Signed integer type of 64 bits.
Int32 Integer
Type representing an integer.
Array< Byte > ByteArray
Dynamic one-dimensional array of characters.
Definition UtilsTypes.h:115
ConstArrayView< Int32 > Int32ConstArrayView
C equivalent of a 1D array of 32-bit integers.
Definition UtilsTypes.h:476
UniqueArray< Byte > ByteUniqueArray
Dynamic 1D array of characters.
Definition UtilsTypes.h:329
auto makeRef(InstanceType *t) -> Ref< InstanceType >
Creates a reference on a pointer.
std::int32_t Int32
Signed integer type of 32 bits.
Namespace of Arccore.
Ref< TrueType > createRef(Args &&... args)
Creates an instance of type TrueType with arguments Args and returns a reference to it.
auto makeRef(InstanceType *t) -> Ref< InstanceType >
Creates a reference on a pointer.
Arcane::Int8 Int8
Type representing an 8-bit integer.