Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
IParallelSuperMng.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/* IParallelSuperMng.h (C) 2000-2025 */
9/* */
10/* Parallelism supervisor interface. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_CORE_IPARALLELSUPERMNG_H
13#define ARCANE_CORE_IPARALLELSUPERMNG_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
18
20
21/*---------------------------------------------------------------------------*/
22/*---------------------------------------------------------------------------*/
23
24namespace Arcane
25{
26
27/*---------------------------------------------------------------------------*/
28/*---------------------------------------------------------------------------*/
29
30class IApplication;
31class IParallelMng;
32class IThreadMng;
33
34/*---------------------------------------------------------------------------*/
35/*---------------------------------------------------------------------------*/
36
37/*!
38 * \internal
39 * \brief Abstract class of the parallelism supervisor.
40 */
41class ARCANE_CORE_EXPORT IParallelSuperMng
42{
43 public:
44
45 typedef Parallel::Request Request;
46 typedef Parallel::eReduceType eReduceType;
47
48 public:
49
50 virtual ~IParallelSuperMng() {} //!< Frees resources.
51
52 public:
53
54 /*!
55 * \brief Constructs the instance members.
56 *
57 * The instance is not usable until this method has been called.
58 * This method must be called before initialize().
59 *
60 * \warning This method must only be called once.
61 */
62 virtual void build() = 0;
63
64 /*!
65 * \brief Initializes the instance.
66 *
67 * The instance is not usable until this method has been called.
68 * \warning This method must only be called once.
69 */
70 virtual void initialize() = 0;
71
72 public:
73
74 //! Returns the main manager.
75 virtual IApplication* application() const = 0;
76
77 //! Thread manager.
78 virtual IThreadMng* threadMng() const = 0;
79
80 //! Returns true if the execution is parallel
81 virtual bool isParallel() const = 0;
82
83 //! Returns the process number (between 0 and nbProcess()-1)
84 virtual Int32 commRank() const = 0;
85
86 //! Returns the total number of processes used
87 virtual Int32 commSize() const = 0;
88
89 //! Rank of this instance for traces.
90 virtual Int32 traceRank() const = 0;
91
92 /*!
93 * \brief Address of the MPI communicator associated with this manager.
94 *
95 * The communicator is only valid if MPI is used. Otherwise, the returned address
96 * is 0. The returned value is of type (MPI_Comm*).
97 */
98
99 virtual void* getMPICommunicator() = 0;
100
101 /*!
102 * \brief MPI communicator associated with this manager
103 *
104 * \sa IParallelMng::communicator()
105 */
107
108 /*!
109 * \internal
110 * \brief Creates a parallelism manager for all allocated cores.
111 *
112 * This operation is collective.
113 *
114 * This method must only be called once during initialization.
115 *
116 * \a local_rank is the local rank of the caller in the list of ranks.
117 * In pure MPI mode, this rank is always 0 because there is only one
118 * thread. In Thread or Thread/MPI mode, it is the rank of the thread used
119 * during creation.
120 *
121 * The returned manager remains the property of this instance and
122 * must not be destroyed.
123 *
124 * For internal use only.
125 */
126 virtual Ref<IParallelMng> internalCreateWorldParallelMng(Int32 local_rank) = 0;
127
128 /*!
129 * \brief Number of subdomains to create locally.
130 * - 1 if sequential.
131 * - 1 if pure MPI
132 * - n if THREAD or THREAD/MPI
133 */
134 virtual Int32 nbLocalSubDomain() = 0;
135
136 /*!
137 * \brief Attempts to abort.
138 *
139 * This method is called when an exception has been generated and the
140 * current execution case must stop. It allows performing cleanup operations
141 * on the manager if necessary.
142 */
143 virtual void tryAbort() = 0;
144
145 //! Returns true if the instance is a master I/O manager.
146 virtual bool isMasterIO() const = 0;
147
148 /*!
149 \brief Rank of the instance managing input/output (for which isMasterIO() is true)
150 *
151 * In the current implementation, this is always the rank 0 processor.
152 */
153 virtual Int32 masterIORank() const = 0;
154
155 /*!
156 * \brief Parallelism manager for all allocated resources.
157 */
158 //virtual IParallelMng* worldParallelMng() const =0;
159
160 //! Performs a barrier
161 virtual void barrier() = 0;
162
163 public:
164
165 //! @name broadcast operations
166 //@{
167 /*!
168 * \brief Sends an array of values to all processes
169 * This operation synchronizes the value array send_buf across all
170 * processes. The array used is that of the process whose
171 * identifier (processId()) is process_id.
172 * All processes must call this method with
173 * the same parameter process_id and have a send_buf array
174 * containing the same number of elements.
175 */
176 virtual void broadcast(ByteArrayView send_buf, Integer process_id) = 0;
177 virtual void broadcast(Int32ArrayView send_buf, Integer process_id) = 0;
178 virtual void broadcast(Int64ArrayView send_buf, Integer process_id) = 0;
179 virtual void broadcast(RealArrayView send_buf, Integer process_id) = 0;
180 //@}
181};
182
183/*---------------------------------------------------------------------------*/
184/*---------------------------------------------------------------------------*/
185
186} // End namespace Arcane
187
188/*---------------------------------------------------------------------------*/
189/*---------------------------------------------------------------------------*/
190
191#endif
File containing declarations concerning the message passing model.
Declarations of types used in Arcane.
Application interface.
Interface of the parallelism manager for a subdomain.
virtual void broadcast(ByteArrayView send_buf, Integer process_id)=0
Sends an array of values to all processes This operation synchronizes the value array send_buf across...
virtual void tryAbort()=0
Attempts to abort.
virtual ~IParallelSuperMng()
Frees resources.
virtual IThreadMng * threadMng() const =0
Thread manager.
virtual bool isMasterIO() const =0
Returns true if the instance is a master I/O manager.
virtual Int32 traceRank() const =0
Rank of this instance for traces.
virtual Int32 commRank() const =0
Returns the process number (between 0 and nbProcess()-1).
virtual void barrier()=0
Parallelism manager for all allocated resources.
virtual Parallel::Communicator communicator() const =0
MPI communicator associated with this manager.
virtual bool isParallel() const =0
Returns true if the execution is parallel.
virtual void * getMPICommunicator()=0
Address of the MPI communicator associated with this manager.
virtual IApplication * application() const =0
Returns the main manager.
virtual Int32 nbLocalSubDomain()=0
Number of subdomains to create locally.
virtual void initialize()=0
Initializes the instance.
virtual Int32 masterIORank() const =0
Rank of the instance managing input/output (for which isMasterIO() is true).
virtual void build()=0
Constructs the instance members.
virtual Int32 commSize() const =0
Returns the total number of processes used.
Interface of a thread manager.
Definition IThreadMng.h:32
Communicator for message exchange.
Reference to an instance.
eReduceType
Supported reduction types.
-- 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:451
ArrayView< Byte > ByteArrayView
C equivalent of a 1D array of characters.
Definition UtilsTypes.h:447
Int32 Integer
Type representing an integer.
ArrayView< Int32 > Int32ArrayView
C equivalent of a 1D array of 32-bit integers.
Definition UtilsTypes.h:453
ArrayView< Real > RealArrayView
C equivalent of a 1D array of reals.
Definition UtilsTypes.h:459
std::int32_t Int32
Signed integer type of 32 bits.