UPstreamAllToAll.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"
29 #include "Map.H"
30 #include "UPstreamWrapping.H"
31 
32 #include <cinttypes>
33 
34 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 
36 #undef Pstream_CommonRoutines
37 #define Pstream_CommonRoutines(Native, TaggedType) \
38 void Foam::UPstream::allToAll \
39 ( \
40  const UList<Native>& sendData, \
41  UList<Native>& recvData, \
42  const label comm \
43 ) \
44 { \
45  PstreamDetail::allToAll \
46  ( \
47  sendData, recvData, TaggedType, comm \
48  ); \
49 }
50 
51 
52 Pstream_CommonRoutines(int32_t, MPI_INT32_T);
53 Pstream_CommonRoutines(int64_t, MPI_INT64_T);
54 // Future?
55 // Pstream_CommonRoutines(uint32_t, MPI_UINT32_T);
56 // Pstream_CommonRoutines(uint64_t, MPI_UINT64_T);
57 
58 #undef Pstream_CommonRoutines
59 
60 
61 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
62 
63 #undef Pstream_CommonRoutines
64 #define Pstream_CommonRoutines(Native, TaggedType) \
65 void Foam::UPstream::allToAllConsensus \
66 ( \
67  const UList<Native>& sendData, \
68  UList<Native>& recvData, \
69  const int tag, \
70  const label comm \
71 ) \
72 { \
73  PstreamDetail::allToAllConsensus \
74  ( \
75  sendData, recvData, TaggedType, tag, comm \
76  ); \
77 } \
78  \
79 void Foam::UPstream::allToAllConsensus \
80 ( \
81  const Map<Native>& sendData, \
82  Map<Native>& recvData, \
83  const int tag, \
84  const label comm \
85 ) \
86 { \
87  PstreamDetail::allToAllConsensus \
88  ( \
89  sendData, recvData, TaggedType, tag, comm \
90  ); \
91 }
92 
93 
94 Pstream_CommonRoutines(int32_t, MPI_INT32_T);
95 Pstream_CommonRoutines(int64_t, MPI_INT64_T);
96 
97 #undef Pstream_CommonRoutines
98 
99 
100 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
101 
102 #undef Pstream_CommonRoutines
103 #define Pstream_CommonRoutines(Native, TaggedType) \
104 void Foam::UPstream::allToAll \
105 ( \
106  const Native* sendData, \
107  const UList<int>& sendCounts, \
108  const UList<int>& sendOffsets, \
109  Native* recvData, \
110  const UList<int>& recvCounts, \
111  const UList<int>& recvOffsets, \
112  const label comm \
113 ) \
114 { \
115  PstreamDetail::allToAllv \
116  ( \
117  sendData, sendCounts, sendOffsets, \
118  recvData, recvCounts, recvOffsets, \
119  TaggedType, comm \
120  ); \
121 }
122 
123 // Unused: Pstream_CommonRoutines(char, MPI_BYTE);
124 
125 #undef Pstream_CommonRoutines
126 
127 // ************************************************************************* //
Functions to wrap MPI_Bcast, MPI_Allreduce, MPI_Iallreduce etc.
#define Pstream_CommonRoutines(Native, TaggedType)