Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
ParallelExchanger.h
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/* ParallelExchanger.h (C) 2000-2022 */
9/* */
10/* Information exchange between processors. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_PARALLELEXCHANGER_H
13#define ARCANE_PARALLELEXCHANGER_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/utils/TraceAccessor.h"
18#include "arcane/utils/Array.h"
19#include "arcane/utils/String.h"
20#include "arcane/utils/Ref.h"
21
22#include "arcane/core/IParallelExchanger.h"
23#include "arcane/core/Timer.h"
24
25/*---------------------------------------------------------------------------*/
26/*---------------------------------------------------------------------------*/
27
28namespace Arcane
29{
30
31/*---------------------------------------------------------------------------*/
32/*---------------------------------------------------------------------------*/
33
35
36/*---------------------------------------------------------------------------*/
37/*---------------------------------------------------------------------------*/
38
44class ARCANE_IMPL_EXPORT ParallelExchanger
45: public TraceAccessor
46, public IParallelExchanger
47{
48 friend ARCANE_IMPL_EXPORT Ref<IParallelExchanger> createParallelExchangerImpl(Ref<IParallelMng> pm);
49
50 public:
51
52 [[deprecated("Y2022: Use Arcane::createParallelExchangerImpl() instead")]]
53 ParallelExchanger(IParallelMng* pm);
54 ~ParallelExchanger() override;
55
56 private:
57
58 ParallelExchanger(Ref<IParallelMng> pm);
59
60 public:
61
64 void processExchange() override;
65 void processExchange(const ParallelExchangerOptions& options) override;
66
67 public:
68
69 IParallelMng* parallelMng() const override;
70 Integer nbSender() const override { return m_send_ranks.size(); }
71 Int32ConstArrayView senderRanks() const override { return m_send_ranks; }
72 void addSender(Int32 rank) override { m_send_ranks.add(rank); }
73 ISerializeMessage* messageToSend(Integer i) override;
74 Integer nbReceiver() const override { return m_recv_ranks.size(); }
76 ISerializeMessage* messageToReceive(Integer i) override;
77
78 void setExchangeMode(eExchangeMode mode) override { m_exchange_mode = mode; }
79 eExchangeMode exchangeMode() const override { return m_exchange_mode; }
80
81 void setVerbosityLevel(Int32 v) override;
82 Int32 verbosityLevel() const override { return m_verbosity_level; }
83
84 void setName(const String& name) override;
85 String name() const override { return m_name; }
86
87 private:
88
89 Ref<IParallelMng> m_parallel_mng;
90
93
96
99
102
105
108
111
114
117
120
123
124 private:
125
126 void _initializeCommunicationsMessages();
127 void _processExchangeCollective();
128 void _processExchangeWithControl(Int32 max_pending_message);
129 void _processExchange(const ParallelExchangerOptions& options);
130};
131
132/*---------------------------------------------------------------------------*/
133/*---------------------------------------------------------------------------*/
134
135extern "C++" ARCANE_IMPL_EXPORT Ref<IParallelExchanger>
136createParallelExchangerImpl(Ref<IParallelMng> pm);
137
138/*---------------------------------------------------------------------------*/
139/*---------------------------------------------------------------------------*/
140
141} // End namespace Arcane
142
143/*---------------------------------------------------------------------------*/
144/*---------------------------------------------------------------------------*/
145
146#endif
Information exchange between processors.
@ EM_Independant
Uses point-to-point exchanges (send/recv).
Interface of the parallelism manager for a subdomain.
Options for IParallelMng::processExchange().
Int32UniqueArray m_send_ranks
List of subdomains to send.
String m_name
Instance name used for display.
void setExchangeMode(eExchangeMode mode) override
Sets the exchange mode.
Integer nbSender() const override
Number of processors to which we send.
bool initializeCommunicationsMessages() override
Calculates communications.
UniqueArray< SerializeMessage * > m_recv_serialize_infos
List of messages to receive.
eExchangeMode exchangeMode() const override
Specified exchange mode.
void processExchange() override
Performs the exchange using the default options of ParallelExchangerOptions.
Int32ConstArrayView senderRanks() const override
List of ranks of processors to which we send.
void _processExchangeWithControl(Int32 max_pending_message)
Exchange with control over the maximum number of messages in flight.
Int32 m_verbosity_level
Verbosity level.
void addSender(Int32 rank) override
Adds a processor to send to.
SerializeMessage * m_own_send_message
Message sent to self.
Timer m_timer
Timer to measure time spent in exchanges.
String name() const override
Instance name.
Int32 verbosityLevel() const override
Verbosity level.
Integer nbReceiver() const override
Number of processors from which we will receive messages.
UniqueArray< SerializeMessage * > m_send_serialize_infos
List of messages to receive.
Int32UniqueArray m_recv_ranks
List of subdomains to receive.
SerializeMessage * m_own_recv_message
Message received by self.
eExchangeMode m_exchange_mode
Exchange mode.
Int32ConstArrayView receiverRanks() override
List of ranks of processors from which we will receive messages.
UniqueArray< ISerializeMessage * > m_comms_buf
List of messages to send and receive.
Reference to an instance.
Message using a SerializeBuffer.
Management of a timer.
Definition Timer.h:63
TraceAccessor(ITraceMng *m)
Constructs an accessor via the trace manager m.
1D data vector with value semantics (STL style).
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Int32 Integer
Type representing an integer.
ConstArrayView< Int32 > Int32ConstArrayView
C equivalent of a 1D array of 32-bit integers.
Definition UtilsTypes.h:482
UniqueArray< Int32 > Int32UniqueArray
Dynamic 1D array of 32-bit integers.
Definition UtilsTypes.h:341
std::int32_t Int32
Signed integer type of 32 bits.