UPstreamWindow.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2025 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "UPstream.H"
29 
30 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31 
33 :
34  UPstream::Window(nullptr)
35 {}
36 
37 
38 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
39 
41 {
42  return false;
43 }
44 
45 
47 {}
48 
49 
51 {
52  return 0;
53 }
54 
55 
56 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
57 
58 std::pair<void*,int64_t>
60 (
61  std::streamsize num_elements,
62  int disp_unit,
64  const bool shared
65 )
66 {
68  return {nullptr, 0};
69 }
70 
71 
72 std::pair<void*,int64_t>
74 (
75  std::streamsize num_elements,
76  int disp_unit,
77  int communicator,
78  const bool shared
79 )
80 {
82  return {nullptr, 0};
83 }
84 
85 
87 (
88  void *baseptr,
89  std::streamsize num_elements,
90  int disp_unit,
92 )
93 {
95  return false;
96 }
97 
98 
100 (
101  void *baseptr,
102  std::streamsize num_elements,
103  int disp_unit,
104  int communicator
105 )
106 {
108  return false;
109 }
110 
111 
112 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
115 {}
116 
118 // * * * * * * * * * * * * * * * Synchronization * * * * * * * * * * * * * * //
119 
121 {}
122 
123 
125 {}
126 
127 
128 void Foam::UPstream::Window::mpi_win_locking(int rank, bool exclusive)
129 {}
130 
131 
133 {}
134 
135 
136 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
137 
139 (
140  void* origin,
141  std::streamsize count,
142  const UPstream::dataTypes dataTypeId,
143  int target_rank,
144  int target_disp
145 ) const
146 {
148  return false;
149 }
150 
151 
153 (
154  const void* origin,
155  std::streamsize count,
156  const UPstream::dataTypes dataTypeId,
157  int target_rank,
158  int target_disp
159 ) const
160 {
162  return false;
163 }
164 
165 
167 (
168  const UPstream::opCodes opCodeId,
169  const void* origin,
170  std::streamsize count,
171  const UPstream::dataTypes dataTypeId,
172  int target_rank,
173  int target_disp
174 ) const
175 {
177  return false;
178 }
179 
180 
182 (
183  const UPstream::opCodes opCodeId,
184  const void* origin,
185  void* result,
186  const UPstream::dataTypes dataTypeId,
187  int target_rank,
188  int target_disp
189 ) const
190 {
192  return false;
193 }
194 
195 
196 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
197 
198 bool Foam::UPstream::Window::is_shared(const bool failNonShared) const
199 {
200  return false;
201 }
202 
203 
204 std::pair<void*,int64_t>
206 (
207  UPstream::Window window,
208  const int expected_disp_unit
209 )
210 {
211  // No window to query
213  return {nullptr, 0};
214 }
215 
216 
217 std::pair<void*,int64_t>
219 (
220  UPstream::Window window,
221  int target_rank,
222  const int expected_disp_unit
223 )
224 {
225  // No window to query
227  return {nullptr, 0};
228 }
229 
230 
231 // ************************************************************************* //
int size() const
The number of ranks associated with the window group.
bool mpi_win_create(void *baseptr, std::streamsize num_elements, int disp_unit, UPstream::Communicator communicator)
Create window onto existing memory with MPI_Win_create().
void mpi_win_flushing(int rank, bool local=false)
Entry point to MPI_Win_flush(), MPI_Win_flush_all(), MPI_Win_flush_local(), MPI_Win_flush_local_all()...
An opaque wrapper for MPI_Comm with a vendor-independent representation without any <mpi...
Definition: UPstream.H:2451
void mpi_win_unlocking(int rank)
Entry point to MPI_Win_unlock(), MPI_Win_unlock_all().
An opaque wrapper for MPI_Win with a vendor-independent representation and without any <mpi...
static std::pair< void *, int64_t > mpi_win_query(UPstream::Window window, const int expected_disp_unit)
Retrieve window sizing information as address/count tuple. The expected sizeof(Type) is supplied as a...
bool good() const noexcept
True if not equal to MPI_WIN_NULL.
bool mpi_fetch_and_op(const UPstream::opCodes opCodeId, const void *origin, void *result, const UPstream::dataTypes dataTypeId, int target_rank, int target_disp=0) const
Retrieve the remote content (a single value) and then combine in new content.
opCodes
Mapping of some MPI op codes.
Definition: UPstream.H:145
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of &#39;true&#39; entries.
Definition: BitOps.H:73
Window() noexcept
Default construct as MPI_WIN_NULL.
void sync()
MPI_Win_sync() - ignored if the window is not active.
bool get_data(void *origin, std::streamsize count, const UPstream::dataTypes dataTypeId, int target_rank, int target_disp=0) const
Get buffer contents from given rank.
std::pair< void *, int64_t > mpi_win_allocate(std::streamsize num_elements, int disp_unit, UPstream::Communicator communicator, const bool shared=false)
Allocate a local or shared memory window. Uses MPI_Win_allocate() or MPI_Win_allocate_shared(), respectively.
bool local
Definition: EEqn.H:20
bool is_shared(const bool failNonShared=false) const
Test if the window is a shared memory window.
bool put_data(const void *origin, std::streamsize count, const UPstream::dataTypes dataTypeId, int target_rank, int target_disp=0) const
Put buffer contents to given rank.
void close()
MPI_Win_free(). Closes the window view and frees any associated memory,.
const direction noexcept
Definition: scalarImpl.H:255
dataTypes
Mapping of some fundamental and aggregate types to MPI data types.
Definition: UPstream.H:103
void mpi_win_locking(int rank, bool exclusive=false)
Entry point to MPI_Win_lock(), MPI_Win_lock_all(), optionally as exclusive lock.
Wrapper for internally indexed communicator label. Always invokes UPstream::allocateCommunicatorCompo...
Definition: UPstream.H:2237
static std::pair< void *, int64_t > mpi_win_query_shared(UPstream::Window window, int target_rank, const int expected_disp_unit)
Retrieve shared window information as address/count tuple. The expected sizeof(Type) is supplied as a...
::Foam::direction rank(const expressions::valueTypeCode) noexcept
The vector-space rank associated with given valueTypeCode.
Definition: exprTraits.C:70
void reset() noexcept
Reset to default constructed value (MPI_WIN_NULL)
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:688
Inter-processor communications stream.
Definition: UPstream.H:65