Arcane  v3.16.8.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
MpiDynamicMachineMemoryWindowBaseInternal.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2025 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/* MpiDynamicMachineMemoryWindowBaseInternal.h (C) 2000-2025 */
9/* */
10/* Classe permettant de créer des fenêtres mémoires pour un noeud de calcul. */
11/* Les segments de ces fenêtres ne sont pas contigües en mémoire et peuvent */
12/* être redimensionnées. */
13/*---------------------------------------------------------------------------*/
14
15#ifndef ARCCORE_MESSAGEPASSINGMPI_INTERNAL_MPIDYNAMICMACHINEMEMORYWINDOWBASEINTERNAL_H
16#define ARCCORE_MESSAGEPASSINGMPI_INTERNAL_MPIDYNAMICMACHINEMEMORYWINDOWBASEINTERNAL_H
17
18/*---------------------------------------------------------------------------*/
19/*---------------------------------------------------------------------------*/
20
21#include "arccore/collections/Array.h"
22#include "arccore/message_passing/internal/IDynamicMachineMemoryWindowBaseInternal.h"
23
24#include "arccore/message_passing_mpi/MessagePassingMpiGlobal.h"
25
26/*---------------------------------------------------------------------------*/
27/*---------------------------------------------------------------------------*/
28
29namespace Arcane::MessagePassing::Mpi
30{
31
32class ARCCORE_MESSAGEPASSINGMPI_EXPORT MpiDynamicMachineMemoryWindowBaseInternal
34{
35 public:
36
37 explicit MpiDynamicMachineMemoryWindowBaseInternal(Int64 sizeof_segment, Int32 sizeof_type, const MPI_Comm& comm_machine, Int32 comm_machine_rank, Int32 comm_machine_size, ConstArrayView<Int32> machine_ranks);
38
39 ~MpiDynamicMachineMemoryWindowBaseInternal() override;
40
41 public:
42
43 Int32 sizeofOneElem() const override;
44 ConstArrayView<Int32> machineRanks() const override;
45 void barrier() const override;
46
48 Span<std::byte> segmentView(Int32 rank) override;
49
51 Span<const std::byte> segmentConstView(Int32 rank) const override;
52
53 void add(Span<const std::byte> elem) override;
54 void add() override;
55
56 void addToAnotherSegment(Int32 rank, Span<const std::byte> elem) override;
57 void addToAnotherSegment() override;
58
59 void reserve(Int64 new_capacity) override;
60 void reserve() override;
61
62 void resize(Int64 new_size) override;
63 void resize() override;
64
65 void shrink() override;
66
67 private:
68
69 void _reallocBarrier(Int64 new_sizeof);
70 void _reallocBarrier(Int32 machine_rank, Int64 new_sizeof);
71 void _reallocBarrier();
72 void _reallocCollective();
73
74 Int32 _worldToMachine(Int32 world) const;
75 Int32 _machineToWorld(Int32 machine) const;
76
77 private:
78
79 UniqueArray<MPI_Win> m_all_mpi_win;
80 Span<std::byte> m_reserved_part_span;
81
82 MPI_Win m_win_need_resize;
83 Span<Int64> m_need_resize;
84
85 MPI_Win m_win_actual_sizeof;
86 Span<Int64> m_sizeof_used_part;
87
88 MPI_Win m_win_target_segments;
89 Span<Int32> m_target_segments;
90
91 MPI_Comm m_comm_machine;
92 Int32 m_comm_machine_size = 0;
93 Int32 m_comm_machine_rank = 0;
94
95 Int32 m_sizeof_type = 0;
96
97 ConstArrayView<Int32> m_machine_ranks;
98};
99
100/*---------------------------------------------------------------------------*/
101/*---------------------------------------------------------------------------*/
102
103} // namespace Arcane::MessagePassing::Mpi
104
105/*---------------------------------------------------------------------------*/
106/*---------------------------------------------------------------------------*/
107
108#endif
Vue constante d'un tableau de type T.
Classe permettant de créer des fenêtres mémoires pour un noeud de calcul.
void add(Span< const std::byte > elem) override
Méthode permettant d'ajouter des élements dans notre segment.
ConstArrayView< Int32 > machineRanks() const override
Méthode permettant d'obtenir les rangs qui possèdent un segment dans la fenêtre.
void barrier() const override
Méthode permettant d'attendre que tous les processus/threads du noeud appellent cette méthode pour co...
void resize(Int64 new_size) override
Méthode permettant de redimensionner notre segment.
void reserve(Int64 new_capacity) override
Méthode permettant de réserver de l'espace mémoire dans notre segment.
void addToAnotherSegment(Int32 rank, Span< const std::byte > elem) override
Méthode permettant d'ajouter des éléments dans le segment d'un autre sous-domaine.
void shrink() override
Méthode permettant de réduire l'espace mémoire réservé pour les segments au minimum nécessaire.
Int32 sizeofOneElem() const override
Méthode permettant d'obtenir la taille d'un élement de la fenêtre.
Span< const std::byte > segmentConstView() const override
Méthode permettant d'obtenir une vue sur notre segment.
Span< std::byte > segmentView() override
Méthode permettant d'obtenir une vue sur notre segment.
Vue d'un tableau d'éléments de type T.
Definition Span.h:513
Vecteur 1D de données avec sémantique par valeur (style STL).
std::int64_t Int64
Type entier signé sur 64 bits.
std::int32_t Int32
Type entier signé sur 32 bits.