Files
openfoam/src/Pstream/mpi/UPstreamGatherScatter.C
Mark Olesen 8818201196 ENH: extend mpiAllGather to include integer and float types
- was previously limited to 'char' whereas gatherv/scatterv
  already supported various integer and float types

STYLE: rebundle allToAll declarations with macros

ENH: provide a version of allToAllConsensus returning the Map

- simplifies use and avoids ambiguities in the send/recv parameters

- the Map version will now also transmit zero value data if they exist
  in the Map. Unlike the List version, zero values are not necessary to
  signal connectivity with a Map.

COMP: forwarding template parameters for NBX routines

ENH: consolidate PstreamBuffers size exchange options

- had a variety of nearly identical backends for all-to-all,
  gather/scatter. Now combined internally with a dispatch enumeration
  which provides better control over which size exchange algorithm
  is used.

DEFEATURE: remove experimental full-NBX PstreamBuffers variant

- no advantages seen compared to the hybrid NBX/PEX approach.
  Removal reduces some code cruft.

DEFEATURE: remove experimental "double non-blocking" NBX version

- the idea was to avoid blocking receives for very large data transfers,
  but that is usually better accomplished with a hybrid NBX/PEX approach
  like PstreamBuffers allows
2023-11-20 09:39:35 +01:00

135 lines
8.4 KiB
C

/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2022-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "Pstream.H"
#include "UPstreamWrapping.H"
#include <cinttypes>
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#undef Pstream_CommonRoutines
#define Pstream_CommonRoutines(Native, TaggedType) \
\
void Foam::UPstream::mpiGather \
( \
const Native* sendData, \
Native* recvData, \
int count, \
const label comm \
) \
{ \
PstreamDetail::gather \
( \
sendData, recvData, count, \
TaggedType, comm \
); \
} \
\
\
void Foam::UPstream::mpiScatter \
( \
const Native* sendData, \
Native* recvData, \
int count, \
const label comm \
) \
{ \
PstreamDetail::scatter \
( \
sendData, recvData, count, \
TaggedType, comm \
); \
} \
\
\
void Foam::UPstream::mpiAllGather \
( \
Native* allData, \
int count, \
const label comm \
) \
{ \
PstreamDetail::allGather \
( \
allData, count, \
TaggedType, comm \
); \
} \
\
void Foam::UPstream::gather \
( \
const Native* sendData, \
int sendCount, \
\
Native* recvData, \
const UList<int>& recvCounts, \
const UList<int>& recvOffsets, \
const label comm \
) \
{ \
PstreamDetail::gatherv \
( \
sendData, sendCount, \
recvData, recvCounts, recvOffsets, \
TaggedType, comm \
); \
} \
\
void Foam::UPstream::scatter \
( \
const Native* sendData, \
const UList<int>& sendCounts, \
const UList<int>& sendOffsets, \
\
Native* recvData, \
int recvCount, \
const label comm \
) \
{ \
PstreamDetail::scatterv \
( \
sendData, sendCounts, sendOffsets, \
recvData, recvCount, \
TaggedType, comm \
); \
}
//TDB: Pstream_CommonRoutines(bool, MPI_C_BOOL);
Pstream_CommonRoutines(char, MPI_BYTE);
Pstream_CommonRoutines(int32_t, MPI_INT32_T);
Pstream_CommonRoutines(int64_t, MPI_INT64_T);
Pstream_CommonRoutines(uint32_t, MPI_UINT32_T);
Pstream_CommonRoutines(uint64_t, MPI_UINT64_T);
Pstream_CommonRoutines(float, MPI_FLOAT);
Pstream_CommonRoutines(double, MPI_DOUBLE);
#undef Pstream_CommonRoutines
// ************************************************************************* //