Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
SerializeMessageList.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/* SerializeMessageList.h (C) 2000-2025 */
9/* */
10/* Serialization message list. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCCORE_MESSAGEPASSING_INTERNAL_SERIALIZEMESSAGEMESSAGELIST_H
13#define ARCCORE_MESSAGEPASSING_INTERNAL_SERIALIZEMESSAGEMESSAGELIST_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arccore/message_passing/ISerializeMessageList.h"
18
19#include "arccore/message_passing/PointToPointMessageInfo.h"
20#include "arccore/base/Ref.h"
21#include "arccore/trace/internal/TimeMetric.h"
22#include "arccore/collections/Array.h"
23
24/*---------------------------------------------------------------------------*/
25/*---------------------------------------------------------------------------*/
26
27namespace Arcane::MessagePassing::internal
28{
29/*---------------------------------------------------------------------------*/
30/*---------------------------------------------------------------------------*/
31
40class ARCCORE_MESSAGEPASSING_EXPORT SerializeMessageList
42{
43 using SerializeMessageContainer = UniqueArray<BasicSerializeMessage*>;
44
45 struct ProbeInfo
46 {
47 public:
48
49 ProbeInfo() = default;
50 ProbeInfo(BasicSerializeMessage* sm, const PointToPointMessageInfo& message_info)
51 : m_serialize_message(sm)
52 , m_message_info(message_info)
53 {}
54
55 public:
56
57 BasicSerializeMessage* m_serialize_message = nullptr;
58 PointToPointMessageInfo m_message_info;
59 bool m_is_probe_done = false;
60 };
61
62 public:
63
64 explicit SerializeMessageList(IMessagePassingMng* mpm);
65
66 public:
67
68 void addMessage(ISerializeMessage* msg) override;
69 void processPendingMessages() override;
70 Integer waitMessages(eWaitType wait_type) override;
73
74 void setAllowAnyRankReceive(bool v) { m_allow_any_rank_receive = v; }
75
76 private:
77
78 IMessagePassingMng* m_message_passing_mng = nullptr;
79 SerializeMessageContainer m_messages_to_process;
80 Ref<IRequestList> m_request_list;
81 SerializeMessageContainer m_messages_serialize;
82 SerializeMessageContainer m_remaining_serialize_messages;
83 UniqueArray<ProbeInfo> m_messages_to_probe;
84 bool m_allow_any_rank_receive = true;
85 TimeMetricAction m_message_passing_phase;
86
87 Integer _waitMessages(eWaitType wait_type);
88 void _addMessage(BasicSerializeMessage* sm, const PointToPointMessageInfo& message_info);
89 PointToPointMessageInfo buildMessageInfo(ISerializeMessage* sm);
90 void _doProbe();
91};
92
93/*---------------------------------------------------------------------------*/
94/*---------------------------------------------------------------------------*/
95
96} // namespace Arcane::MessagePassing::internal
97
98/*---------------------------------------------------------------------------*/
99/*---------------------------------------------------------------------------*/
100
101#endif
Management of references to a C++ class.
Interface of the message passing manager.
Information for sending/receiving a point-to-point message.
Serializing message using a BasicSerializer.
void processPendingMessages() override
Sends the messages in the list that have not yet been sent.
Ref< ISerializeMessage > createAndAddMessage(MessageRank destination, ePointToPointMessageType type) override
Creates and adds a serialization message.
void addMessage(ISerializeMessage *msg) override
Adds a message to the list.
Integer waitMessages(eWaitType wait_type) override
Waits until the messages have finished execution.
Reference to an instance.
1D data vector with value semantics (STL style).
ePointToPointMessageType
Point-to-point message type.
Int32 Integer
Type representing an integer.