Arcane  4.2.3.0
User documentation
Loading...
Searching...
No Matches
IMessagePassingMng.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/* IMessagePassingMng.h (C) 2000-2026 */
9/* */
10/* Interface of the message passing manager. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCCORE_MESSAGEPASSING_IMESSAGEPASSINGMNG_H
13#define ARCCORE_MESSAGEPASSING_IMESSAGEPASSINGMNG_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
18
19/*---------------------------------------------------------------------------*/
20/*---------------------------------------------------------------------------*/
21
23{
24
25/*---------------------------------------------------------------------------*/
26/*---------------------------------------------------------------------------*/
27/*!
28 * \brief Destroys the message passing instance \a p.
29 *
30 * \warning This should only be used when using deprecated functions
31 * which do not return instances of Ref<IMessagePassingMng> and instead
32 * only return a IMessagePassingMng*.
33 */
34extern "C++" void ARCCORE_MESSAGEPASSING_EXPORT
36
37/*---------------------------------------------------------------------------*/
38/*---------------------------------------------------------------------------*/
39/*!
40 * \brief Interface of the message passing manager.
41 *
42 * This class uses a semantic by reference and instances are automatically
43 * destroyed when needed.
44 *
45 * Most of the operations on this class use free functions (like mpSend() or mpReceive())
46 * which are defined in file 'Messages.h'.
47 *
48 * %Arcane provides several implementation for message passing, using MPI,
49 * shared memory message passing or hybrid (MPI + shared memory) message passing.
50 * When using MPI, it is possible to create an instance of this class using
51 * the class StandaloneMpiMessagePassingMng.
52 */
53class ARCCORE_MESSAGEPASSING_EXPORT IMessagePassingMng
54{
55 friend void ARCCORE_MESSAGEPASSING_EXPORT mpDelete(IMessagePassingMng*);
57
58 public:
59
60 virtual ~IMessagePassingMng() = default;
61
62 public:
63
64 //! Rank of this instance in the communicator
65 virtual Int32 commRank() const = 0;
66
67 //! Number of instances in the communicator
68 virtual Int32 commSize() const = 0;
69
70 //! Interface for collecting execution times (can be null)
71 virtual ITimeMetricCollector* timeMetricCollector() const = 0;
72
73 /*!
74 * \brief MPI communicator associated with this instance.
75 *
76 * The communicator is only valid if the instance is associated with an
77 * MPI implementation. You can convert a communicator to a MPI communicator
78 * using helper methods toMpiCommunicator() and fillMpiCommunicatorIfValid()
79 * or like that:
80 *
81 * \code
82 * IMessagePassingMng* mpm = ...;
83 * Communicator comm = mpm->communicator();
84 * if (comm.isValid())
85 * MPI_Comm mpi_comm = static_cast<MPI_Comm>(comm).
86 * \endcode
87 */
88 virtual Communicator communicator() const;
89
90 public:
91
92 virtual IDispatchers* dispatchers() = 0;
93};
94
95/*---------------------------------------------------------------------------*/
96/*---------------------------------------------------------------------------*/
97
98} // namespace Arcane::MessagePassing
99
100/*---------------------------------------------------------------------------*/
101/*---------------------------------------------------------------------------*/
102
103#endif
General declarations for the 'message_passing' component.
#define ARCCORE_DECLARE_REFERENCE_COUNTED_INCLASS_METHODS()
Macro to declare the virtual methods managing reference counters.
Communicator for message exchange.
Interface of the dispatcher container.
Interface of the message passing manager.
friend void mpDelete(IMessagePassingMng *)
Destroys the message passing instance p.
virtual Int32 commRank() const =0
Rank of this instance in the communicator.
virtual Communicator communicator() const
MPI communicator associated with this instance.
virtual Int32 commSize() const =0
Number of instances in the communicator.
virtual ITimeMetricCollector * timeMetricCollector() const =0
Interface for collecting execution times (can be null).
Declarations of types and methods used by message exchange mechanisms.
void mpDelete(IMessagePassingMng *p)
Destroys the message passing instance p.
std::int32_t Int32
Signed integer type of 32 bits.