UPstreamGatherScatter.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) 2022-2023 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 "Pstream.H"
30 
31 #include <cinttypes>
32 
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 
35 #undef Pstream_CommonRoutines
36 #define Pstream_CommonRoutines(Native, TaggedType) \
37  \
38 void Foam::UPstream::mpiGather \
39 ( \
40  const Native* sendData, \
41  Native* recvData, \
42  int count, \
43  const label comm \
44 ) \
45 { \
46  PstreamDetail::gather \
47  ( \
48  sendData, recvData, count, \
49  TaggedType, comm \
50  ); \
51 } \
52  \
53  \
54 void Foam::UPstream::mpiScatter \
55 ( \
56  const Native* sendData, \
57  Native* recvData, \
58  int count, \
59  const label comm \
60 ) \
61 { \
62  PstreamDetail::scatter \
63  ( \
64  sendData, recvData, count, \
65  TaggedType, comm \
66  ); \
67 } \
68  \
69  \
70 void Foam::UPstream::mpiAllGather \
71 ( \
72  Native* allData, \
73  int count, \
74  const label comm \
75 ) \
76 { \
77  PstreamDetail::allGather \
78  ( \
79  allData, count, \
80  TaggedType, comm \
81  ); \
82 } \
83  \
84 void Foam::UPstream::gather \
85 ( \
86  const Native* sendData, \
87  int sendCount, \
88  \
89  Native* recvData, \
90  const UList<int>& recvCounts, \
91  const UList<int>& recvOffsets, \
92  const label comm \
93 ) \
94 { \
95  PstreamDetail::gatherv \
96  ( \
97  sendData, sendCount, \
98  recvData, recvCounts, recvOffsets, \
99  TaggedType, comm \
100  ); \
101 } \
102  \
103 void Foam::UPstream::scatter \
104 ( \
105  const Native* sendData, \
106  const UList<int>& sendCounts, \
107  const UList<int>& sendOffsets, \
108  \
109  Native* recvData, \
110  int recvCount, \
111  const label comm \
112 ) \
113 { \
114  PstreamDetail::scatterv \
115  ( \
116  sendData, sendCounts, sendOffsets, \
117  recvData, recvCount, \
118  TaggedType, comm \
119  ); \
120 }
121 
122 
123 //TDB: Pstream_CommonRoutines(bool, MPI_C_BOOL);
124 Pstream_CommonRoutines(char, MPI_BYTE);
125 Pstream_CommonRoutines(int32_t, MPI_INT32_T);
126 Pstream_CommonRoutines(int64_t, MPI_INT64_T);
127 Pstream_CommonRoutines(uint32_t, MPI_UINT32_T);
128 Pstream_CommonRoutines(uint64_t, MPI_UINT64_T);
129 Pstream_CommonRoutines(float, MPI_FLOAT);
130 Pstream_CommonRoutines(double, MPI_DOUBLE);
131 
132 #undef Pstream_CommonRoutines
133 
134 // ************************************************************************* //
Functions to wrap MPI_Bcast, MPI_Allreduce, MPI_Iallreduce etc.
#define Pstream_CommonRoutines(Native, TaggedType)