ENH: use List containers for Pstream read/write calls

- using the List containers, and not their low-level data_bytes(),
  size_bytes() methods is more convenient and allows future
  adjustments to be centralized

ENH: trivial intptr_t wrapper for MPI_Win

STYLE: minor adjustments to mpirunDebug
This commit is contained in:
Mark Olesen
2025-01-30 09:27:06 +01:00
parent 0adc745b50
commit 0ba4f36c60
32 changed files with 461 additions and 190 deletions

View File

@ -24,7 +24,6 @@
. "${WM_PROJECT_DIR:?}"/bin/tools/RunFunctions # Run functions . "${WM_PROJECT_DIR:?}"/bin/tools/RunFunctions # Run functions
printHelp() { printHelp() {
exec 1>&2
cat<<USAGE cat<<USAGE
Usage: ${0##*/} [OPTION] -np <N> <executable> <args> Usage: ${0##*/} [OPTION] -np <N> <executable> <args>
@ -203,7 +202,7 @@ do
# Processing application arguments # Processing application arguments
case "$1" in case "$1" in
(-help* | --help*) usage ;; (-help* | --help*) printHelp ;;
('') ;; ## Ignore junk ('') ;; ## Ignore junk
(-np) (-np)
@ -235,15 +234,16 @@ done
# Cleanup only # Cleanup only
if [ -n "$optClean" ] if [ -n "$optClean" ]
then then
echo "Cleanup old mpirunDebug files..." 1>&2 exec 1>&2
rm -f gdbCommands mpirun.schema echo "Cleanup old mpirunDebug files..."
rm -rf mpirun.log mpirun.files rm -f gdbCommands mpirun.schema vgcore.*
rm -f processor*.log processor*.sh rm -f processor*.log processor*.sh
echo " gdbCommands mpirun.schema" 1>&2 rm -rf mpirun.log mpirun.files
echo " mpirun.{files,log}/" 1>&2 echo " gdbCommands mpirun.schema vgcore.*"
echo " processor*.{log,sh}" 1>&2 echo " processor*.{log,sh}"
echo "Done" 1>&2 echo " mpirun.{files,log}/"
exit 0 echo "Done"
exit 0 # A clean exit
fi fi
@ -344,12 +344,15 @@ esac
echo "**sourceFoam: $sourceFoam" 1>&2 echo "**sourceFoam: $sourceFoam" 1>&2
rm -f ./mpirun.schema
touch ./mpirun.schema
mkdir -p ./mpirun.files mkdir -p ./mpirun.files
mkdir -p ./mpirun.log mkdir -p ./mpirun.log
schema_file="$PWD/mpirun.files/mpirun.schema"
rm -f "$schema_file"
touch "$schema_file"
proc=0 proc=0
xpos=0 xpos=0
ypos=0 ypos=0
@ -374,8 +377,8 @@ COMMANDS
# Add to the mpirun.schema # Add to the mpirun.schema
case "$method" in case "$method" in
(*xterm*) echo "${node}${xterm} -e ${procCmdFile}" >> "$PWD"/mpirun.schema ;; (*xterm*) echo "${node}${xterm} -e ${procCmdFile}" >> "$schema_file" ;;
(*) echo "${node}${procCmdFile}" >> "$PWD"/mpirun.schema ;; (*) echo "${node}${procCmdFile}" >> "$schema_file" ;;
esac esac
case "$method" in case "$method" in
@ -421,17 +424,33 @@ COMMANDS
fi fi
done done
for ((proc=0; proc<$nProcs; proc++))
do if [ "$nProcs" -lt 10 ]
then
for ((proc = 0; proc < $nProcs; proc++))
do
procLog="mpirun.log/processor${proc}.log" procLog="mpirun.log/processor${proc}.log"
echo " tail -f $procLog" 1>&2 echo " tail -f $procLog" 1>&2
done done
else
for ((proc = 0; proc < 4; proc++))
do
procLog="mpirun.log/processor${proc}.log"
echo " tail -f $procLog" 1>&2
done
echo " ..." 1>&2
for ((proc = $nProcs-2; proc < $nProcs; proc++))
do
procLog="mpirun.log/processor${proc}.log"
echo " tail -f $procLog" 1>&2
done
fi
unset cmd unset cmd
case "$WM_MPLIB" in case "$WM_MPLIB" in
*OPENMPI*) *OPENMPI*)
cmd="mpirun --oversubscribe -app $PWD/mpirun.schema </dev/null" cmd="mpirun --oversubscribe -app "$schema_file" </dev/null"
;; ;;
MPICH) MPICH)
cmd="mpiexec" cmd="mpiexec"
@ -448,7 +467,7 @@ MPICH)
cmd="${cmd} :" cmd="${cmd} :"
fi fi
cmd="${cmd} -n 1 ${procXtermCmdFile}" cmd="${cmd} -n 1 ${procXtermCmdFile}"
done < "$PWD"/mpirun.schema done < "$schema_file"
;; ;;
*) *)
die "Unsupported WM_MPLIB setting : $WM_MPLIB" die "Unsupported WM_MPLIB setting : $WM_MPLIB"
@ -456,7 +475,7 @@ MPICH)
esac esac
echo 1>&2 echo 1>&2
echo "Constructed $PWD/mpirun.schema file:" 1>&2 echo "Constructed $schema_file file:" 1>&2
echo 1>&2 echo 1>&2
echo " $cmd" 1>&2 echo " $cmd" 1>&2
echo 1>&2 echo 1>&2

View File

@ -182,8 +182,7 @@ void Foam::Pstream::listCombineGather
( (
UPstream::commsTypes::scheduled, UPstream::commsTypes::scheduled,
belowID, belowID,
received.data_bytes(), received,
received.size_bytes(),
tag, tag,
comm comm
); );
@ -239,8 +238,7 @@ void Foam::Pstream::listCombineGather
( (
UPstream::commsTypes::scheduled, UPstream::commsTypes::scheduled,
myComm.above(), myComm.above(),
values.cdata_bytes(), values,
values.size_bytes(),
tag, tag,
comm comm
); );

View File

@ -80,8 +80,7 @@ void Foam::Pstream::gatherList
( (
UPstream::commsTypes::scheduled, UPstream::commsTypes::scheduled,
belowID, belowID,
received.data_bytes(), received,
received.size_bytes(),
tag, tag,
comm comm
); );
@ -155,8 +154,7 @@ void Foam::Pstream::gatherList
( (
UPstream::commsTypes::scheduled, UPstream::commsTypes::scheduled,
myComm.above(), myComm.above(),
sending.cdata_bytes(), sending,
sending.size_bytes(),
tag, tag,
comm comm
); );
@ -231,8 +229,7 @@ void Foam::Pstream::scatterList
( (
UPstream::commsTypes::scheduled, UPstream::commsTypes::scheduled,
myComm.above(), myComm.above(),
received.data_bytes(), received,
received.size_bytes(),
tag, tag,
comm comm
); );
@ -286,8 +283,7 @@ void Foam::Pstream::scatterList
( (
UPstream::commsTypes::scheduled, UPstream::commsTypes::scheduled,
belowID, belowID,
sending.cdata_bytes(), sending,
sending.size_bytes(),
tag, tag,
comm comm
); );

View File

@ -94,7 +94,7 @@ static List<int> getHostGroupIds(const label parentCommunicator)
( (
myDigest.cdata_bytes(), // Send myDigest.cdata_bytes(), // Send
digests.data_bytes(), // Recv digests.data_bytes(), // Recv
SHA1Digest::max_size(), // Num send/recv data per rank SHA1Digest::size_bytes(), // Num send/recv data per rank
parentCommunicator parentCommunicator
); );

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2015-2024 OpenCFD Ltd. Copyright (C) 2015-2025 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -99,6 +99,9 @@ public:
//- Wrapper for MPI_Request //- Wrapper for MPI_Request
class Request; // Forward Declaration class Request; // Forward Declaration
//- Wrapper for MPI_Win
class Window; // Forward Declaration
//- Structure for communicating between processors //- Structure for communicating between processors
class commsStruct class commsStruct
{ {
@ -1462,6 +1465,12 @@ UList<UPstream::commsStruct>::operator[](const label procID) const;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Traits, nested classes etc
#include "UPstreamTraits.H"
#include "UPstreamWindow.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository #ifdef NoRepository
#include "UPstreamTemplates.C" #include "UPstreamTemplates.C"
#endif #endif

View File

@ -0,0 +1,46 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2025 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/>.
Description
A set of traits associated with UPstream communication
SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef Foam_UPstreamTraits_H
#define Foam_UPstreamTraits_H
#include "UPstream.H"
#include <cstdint>
#include <ios> // For streamsize
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,152 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2025 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/>.
Class
Foam::UPstream::Window
Description
An opaque wrapper for MPI_Win with a vendor-independent
representation and without any \c <mpi.h> header dependency.
Note
The MPI standard states that MPI_Win is always an opaque object.
Generally it is either an integer (eg, mpich) or a pointer (eg, openmpi).
SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef Foam_UPstreamWindow_H
#define Foam_UPstreamWindow_H
#include "UPstream.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class UPstream::Window Declaration
\*---------------------------------------------------------------------------*/
class UPstream::Window
{
public:
// Public Types
//- Storage for MPI_Win (as integer or pointer)
typedef std::intptr_t value_type;
private:
// Private Data
//- The MPI_Win (as wrapped value)
value_type value_;
public:
// Generated Methods
//- Copy construct
Window(const Window&) noexcept = default;
//- Move construct
Window(Window&&) noexcept = default;
//- Copy assignment
Window& operator=(const Window&) noexcept = default;
//- Move assignment
Window& operator=(Window&&) noexcept = default;
// Member Operators
//- Test for equality
bool operator==(const Window& rhs) const noexcept
{
return (value_ == rhs.value_);
}
//- Test for inequality
bool operator!=(const Window& rhs) const noexcept
{
return (value_ != rhs.value_);
}
// Constructors
//- Default construct as MPI_WIN_NULL
Window() noexcept;
//- Construct from MPI_Win (as pointer type)
explicit Window(const void* p) noexcept
:
value_(reinterpret_cast<value_type>(p))
{}
//- Construct from MPI_Win (as integer type)
explicit Window(value_type val) noexcept
:
value_(val)
{}
// Member Functions
// Basic handling
//- Return raw value
value_type value() const noexcept { return value_; }
//- Return as pointer value
const void* pointer() const noexcept
{
return reinterpret_cast<const void*>(value_);
}
//- True if not equal to MPI_WIN_NULL
bool good() const noexcept;
//- Reset to default constructed value (MPI_WIN_NULL)
void reset() noexcept;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2020-2023 OpenCFD Ltd. Copyright (C) 2020-2025 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -113,8 +113,7 @@ void Foam::processorCyclicPointPatchField<Type>::initSwapAddSeparated
( (
commsType, commsType,
procPatch_.neighbProcNo(), procPatch_.neighbProcNo(),
recvBuf_.data_bytes(), recvBuf_,
recvBuf_.size_bytes(),
procPatch_.tag(), procPatch_.tag(),
procPatch_.comm() procPatch_.comm()
); );
@ -123,8 +122,7 @@ void Foam::processorCyclicPointPatchField<Type>::initSwapAddSeparated
( (
commsType, commsType,
procPatch_.neighbProcNo(), procPatch_.neighbProcNo(),
sendBuf_.cdata_bytes(), sendBuf_,
sendBuf_.size_bytes(),
procPatch_.tag(), procPatch_.tag(),
procPatch_.comm() procPatch_.comm()
); );
@ -150,8 +148,7 @@ void Foam::processorCyclicPointPatchField<Type>::swapAddSeparated
( (
commsType, commsType,
procPatch_.neighbProcNo(), procPatch_.neighbProcNo(),
recvBuf_.data_bytes(), recvBuf_,
recvBuf_.size_bytes(),
procPatch_.tag(), procPatch_.tag(),
procPatch_.comm() procPatch_.comm()
); );

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2022-2023 OpenCFD Ltd. Copyright (C) 2022-2025 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -126,7 +126,7 @@ Foam::labelList Foam::fileOperation::getGlobalHostIORanks()
( (
myDigest.cdata_bytes(), // Send myDigest.cdata_bytes(), // Send
digests.data_bytes(), // Recv digests.data_bytes(), // Recv
SHA1Digest::max_size(), // Num send/recv per rank SHA1Digest::size_bytes(), // Num send/recv per rank
UPstream::worldComm UPstream::worldComm
); );

View File

@ -80,6 +80,20 @@ struct Cast
return static_cast<Type>(arg.value()); return static_cast<Type>(arg.value());
} }
} }
//- Cast UPstream::Window to MPI_Win
template<typename Type = MPI_Win>
static Type to_mpi(UPstream::Window arg) noexcept
{
if constexpr (std::is_pointer_v<Type>)
{
return reinterpret_cast<Type>(arg.value());
}
else // std::is_integral_v<Type>
{
return static_cast<Type>(arg.value());
}
}
}; };

View File

@ -78,8 +78,7 @@ void Foam::LUscalarMatrix::solve
( (
UPstream::commsTypes::nonBlocking, UPstream::commsTypes::nonBlocking,
proci, proci,
procSlot.data_bytes(), procSlot,
procSlot.size_bytes(),
tag, tag,
comm_ comm_
); );
@ -102,8 +101,7 @@ void Foam::LUscalarMatrix::solve
( (
UPstream::commsTypes::nonBlocking, UPstream::commsTypes::nonBlocking,
UPstream::masterNo(), UPstream::masterNo(),
x.cdata_bytes(), x,
x.size_bytes(),
tag, tag,
comm_ comm_
); );
@ -142,8 +140,7 @@ void Foam::LUscalarMatrix::solve
( (
UPstream::commsTypes::nonBlocking, UPstream::commsTypes::nonBlocking,
proci, proci,
procSlot.cdata_bytes(), procSlot,
procSlot.size_bytes(),
tag, tag,
comm_ comm_
); );
@ -166,8 +163,7 @@ void Foam::LUscalarMatrix::solve
( (
UPstream::commsTypes::nonBlocking, UPstream::commsTypes::nonBlocking,
UPstream::masterNo(), UPstream::masterNo(),
x.data_bytes(), x,
x.size_bytes(),
tag, tag,
comm_ comm_
); );

View File

@ -114,8 +114,7 @@ void Foam::lduCalculatedProcessorField<Type>::initInterfaceMatrixUpdate
( (
UPstream::commsTypes::nonBlocking, UPstream::commsTypes::nonBlocking,
procInterface_.neighbProcNo(), procInterface_.neighbProcNo(),
scalarRecvBuf_.data_bytes(), scalarRecvBuf_,
scalarRecvBuf_.size_bytes(),
procInterface_.tag(), procInterface_.tag(),
procInterface_.comm() procInterface_.comm()
); );
@ -125,8 +124,7 @@ void Foam::lduCalculatedProcessorField<Type>::initInterfaceMatrixUpdate
( (
UPstream::commsTypes::nonBlocking, UPstream::commsTypes::nonBlocking,
procInterface_.neighbProcNo(), procInterface_.neighbProcNo(),
scalarSendBuf_.cdata_bytes(), scalarSendBuf_,
scalarSendBuf_.size_bytes(),
procInterface_.tag(), procInterface_.tag(),
procInterface_.comm() procInterface_.comm()
); );

View File

@ -56,8 +56,7 @@ void Foam::processorLduInterface::send
( (
commsType, commsType,
neighbProcNo(), neighbProcNo(),
fld.cdata_bytes(), fld,
fld.size_bytes(),
tag(), tag(),
comm() comm()
); );
@ -133,8 +132,7 @@ void Foam::processorLduInterface::receive
( (
commsType, commsType,
neighbProcNo(), neighbProcNo(),
fld.data_bytes(), fld,
fld.size_bytes(),
tag(), tag(),
comm() comm()
); );

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2019-2023 OpenCFD Ltd. Copyright (C) 2019-2025 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -149,8 +149,7 @@ void Foam::processorGAMGInterfaceField::initInterfaceMatrixUpdate
( (
UPstream::commsTypes::nonBlocking, UPstream::commsTypes::nonBlocking,
procInterface_.neighbProcNo(), procInterface_.neighbProcNo(),
scalarRecvBuf_.data_bytes(), scalarRecvBuf_,
scalarRecvBuf_.size_bytes(),
procInterface_.tag(), procInterface_.tag(),
comm() comm()
); );
@ -160,8 +159,7 @@ void Foam::processorGAMGInterfaceField::initInterfaceMatrixUpdate
( (
UPstream::commsTypes::nonBlocking, UPstream::commsTypes::nonBlocking,
procInterface_.neighbProcNo(), procInterface_.neighbProcNo(),
scalarSendBuf_.cdata_bytes(), scalarSendBuf_,
scalarSendBuf_.size_bytes(),
procInterface_.tag(), procInterface_.tag(),
comm() comm()
); );

View File

@ -201,8 +201,7 @@ void Foam::mapDistributeBase::send
( (
UPstream::commsTypes::nonBlocking, UPstream::commsTypes::nonBlocking,
proci, proci,
subField.data_bytes(), subField,
subField.size_bytes(),
tag, tag,
comm comm
); );
@ -244,8 +243,7 @@ void Foam::mapDistributeBase::send
( (
UPstream::commsTypes::nonBlocking, UPstream::commsTypes::nonBlocking,
proci, proci,
subField.cdata_bytes(), subField,
subField.size_bytes(),
tag, tag,
comm comm
); );
@ -778,8 +776,7 @@ void Foam::mapDistributeBase::distribute
( (
UPstream::commsTypes::nonBlocking, UPstream::commsTypes::nonBlocking,
proci, proci,
subField.data_bytes(), subField,
subField.size_bytes(),
tag, tag,
comm comm
); );
@ -806,8 +803,7 @@ void Foam::mapDistributeBase::distribute
( (
UPstream::commsTypes::nonBlocking, UPstream::commsTypes::nonBlocking,
proci, proci,
subField.cdata_bytes(), subField,
subField.size_bytes(),
tag, tag,
comm comm
); );
@ -1218,8 +1214,7 @@ void Foam::mapDistributeBase::distribute
( (
UPstream::commsTypes::nonBlocking, UPstream::commsTypes::nonBlocking,
proci, proci,
subField.data_bytes(), subField,
subField.size_bytes(),
tag, tag,
comm comm
); );
@ -1246,8 +1241,7 @@ void Foam::mapDistributeBase::distribute
( (
UPstream::commsTypes::nonBlocking, UPstream::commsTypes::nonBlocking,
proci, proci,
subField.cdata_bytes(), subField,
subField.size_bytes(),
tag, tag,
comm comm
); );

View File

@ -1086,8 +1086,7 @@ void Foam::syncTools::syncBoundaryFaceList
( (
UPstream::commsTypes::nonBlocking, UPstream::commsTypes::nonBlocking,
procPatch.neighbProcNo(), procPatch.neighbProcNo(),
fld.data_bytes(), fld
fld.size_bytes()
); );
} }
} }
@ -1112,8 +1111,7 @@ void Foam::syncTools::syncBoundaryFaceList
( (
UPstream::commsTypes::nonBlocking, UPstream::commsTypes::nonBlocking,
procPatch.neighbProcNo(), procPatch.neighbProcNo(),
fld.cdata_bytes(), fld
fld.size_bytes()
); );
} }
} }

View File

@ -259,8 +259,7 @@ void Foam::globalIndex::gather
( (
commsType, commsType,
procIDs[i], procIDs[i],
procSlot.data_bytes(), procSlot,
procSlot.size_bytes(),
tag, tag,
comm comm
); );
@ -283,8 +282,7 @@ void Foam::globalIndex::gather
( (
commsType, commsType,
masterProci, masterProci,
fld.cdata_bytes(), fld,
fld.size_bytes(),
tag, tag,
comm comm
); );
@ -948,8 +946,7 @@ void Foam::globalIndex::scatter
( (
commsType, commsType,
procIDs[i], procIDs[i],
procSlot.cdata_bytes(), procSlot,
procSlot.size_bytes(),
tag, tag,
comm comm
); );
@ -984,8 +981,7 @@ void Foam::globalIndex::scatter
( (
commsType, commsType,
masterProci, masterProci,
fld.data_bytes(), fld,
fld.size_bytes(),
tag, tag,
comm comm
); );

View File

@ -5,6 +5,7 @@ UPstreamCommunicator.C
UPstreamGatherScatter.C UPstreamGatherScatter.C
UPstreamReduce.C UPstreamReduce.C
UPstreamRequest.C UPstreamRequest.C
UPstreamWindow.C
UIPstreamRead.C UIPstreamRead.C
UOPstreamWrite.C UOPstreamWrite.C

View File

@ -0,0 +1,50 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2025 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 "UPstream.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::UPstream::Window::Window() noexcept
:
UPstream::Window(nullptr)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::UPstream::Window::good() const noexcept
{
return false;
}
void Foam::UPstream::Window::reset() noexcept
{}
// ************************************************************************* //

View File

@ -6,6 +6,7 @@ UPstreamCommunicator.C
UPstreamGatherScatter.C UPstreamGatherScatter.C
UPstreamReduce.C UPstreamReduce.C
UPstreamRequest.C UPstreamRequest.C
UPstreamWindow.C
UIPstreamRead.C UIPstreamRead.C
UOPstreamWrite.C UOPstreamWrite.C

View File

@ -0,0 +1,53 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2025 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 "PstreamGlobals.H"
#include "profilingPstream.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::UPstream::Window::Window() noexcept
:
UPstream::Window(MPI_WIN_NULL)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::UPstream::Window::good() const noexcept
{
return MPI_WIN_NULL != PstreamUtils::Cast::to_mpi(*this);
}
void Foam::UPstream::Window::reset() noexcept
{
*this = UPstream::Window(MPI_WIN_NULL);
}
// ************************************************************************* //

View File

@ -217,8 +217,7 @@ void Foam::ensightOutput::Detail::writeFieldComponents
( (
UPstream::commsTypes::scheduled, UPstream::commsTypes::scheduled,
proci, proci,
slot.data_bytes(), slot
slot.size_bytes()
); );
} }
} }
@ -244,8 +243,7 @@ void Foam::ensightOutput::Detail::writeFieldComponents
( (
UPstream::commsTypes::scheduled, UPstream::commsTypes::scheduled,
UPstream::masterNo(), UPstream::masterNo(),
scratch.cdata_bytes(), scratch
scratch.size_bytes()
); );
} }
} }

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2016-2022 OpenCFD Ltd. Copyright (C) 2016-2025 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -155,8 +155,7 @@ void Foam::vtk::writeListParallel
( (
UPstream::commsTypes::scheduled, UPstream::commsTypes::scheduled,
proci, proci,
recvData.data_bytes(), recvData
recvData.size_bytes()
); );
// With value offset // With value offset
@ -176,8 +175,7 @@ void Foam::vtk::writeListParallel
( (
UPstream::commsTypes::scheduled, UPstream::commsTypes::scheduled,
UPstream::masterNo(), UPstream::masterNo(),
values.cdata_bytes(), values
values.size_bytes()
); );
} }
} }

View File

@ -193,8 +193,7 @@ void Foam::vtk::writeListParallel
( (
UPstream::commsTypes::scheduled, UPstream::commsTypes::scheduled,
proci, proci,
recvData.data_bytes(), recvData
recvData.size_bytes()
); );
vtk::writeList(fmt, recvData); vtk::writeList(fmt, recvData);
} }
@ -208,8 +207,7 @@ void Foam::vtk::writeListParallel
( (
UPstream::commsTypes::scheduled, UPstream::commsTypes::scheduled,
UPstream::masterNo(), UPstream::masterNo(),
values.cdata_bytes(), values
values.size_bytes()
); );
} }
} }
@ -262,8 +260,7 @@ void Foam::vtk::writeListParallel
( (
UPstream::commsTypes::scheduled, UPstream::commsTypes::scheduled,
proci, proci,
recvData.data_bytes(), recvData
recvData.size_bytes()
); );
vtk::writeList(fmt, recvData); vtk::writeList(fmt, recvData);
} }
@ -277,8 +274,7 @@ void Foam::vtk::writeListParallel
( (
UPstream::commsTypes::scheduled, UPstream::commsTypes::scheduled,
UPstream::masterNo(), UPstream::masterNo(),
sendData.cdata_bytes(), sendData
sendData.size_bytes()
); );
} }
} }
@ -332,8 +328,7 @@ void Foam::vtk::writeListParallel
( (
UPstream::commsTypes::scheduled, UPstream::commsTypes::scheduled,
proci, proci,
recvData.data_bytes(), recvData
recvData.size_bytes()
); );
vtk::writeList(fmt, recvData); vtk::writeList(fmt, recvData);
} }
@ -347,8 +342,7 @@ void Foam::vtk::writeListParallel
( (
UPstream::commsTypes::scheduled, UPstream::commsTypes::scheduled,
UPstream::masterNo(), UPstream::masterNo(),
sendData.cdata_bytes(), sendData
sendData.size_bytes()
); );
} }
} }
@ -401,8 +395,7 @@ void Foam::vtk::writeListsParallel
( (
UPstream::commsTypes::scheduled, UPstream::commsTypes::scheduled,
proci, proci,
recvData.data_bytes(), recvData
recvData.size_bytes()
); );
vtk::writeList(fmt, recvData); vtk::writeList(fmt, recvData);
} }
@ -417,8 +410,7 @@ void Foam::vtk::writeListsParallel
( (
UPstream::commsTypes::scheduled, UPstream::commsTypes::scheduled,
proci, proci,
recvData.data_bytes(), recvData
recvData.size_bytes()
); );
vtk::writeList(fmt, recvData); vtk::writeList(fmt, recvData);
} }
@ -432,8 +424,7 @@ void Foam::vtk::writeListsParallel
( (
UPstream::commsTypes::scheduled, UPstream::commsTypes::scheduled,
UPstream::masterNo(), UPstream::masterNo(),
values1.cdata_bytes(), values1
values1.size_bytes()
); );
} }
@ -443,8 +434,7 @@ void Foam::vtk::writeListsParallel
( (
UPstream::commsTypes::scheduled, UPstream::commsTypes::scheduled,
UPstream::masterNo(), UPstream::masterNo(),
values2.cdata_bytes(), values2
values2.size_bytes()
); );
} }
} }
@ -506,8 +496,7 @@ void Foam::vtk::writeListsParallel
( (
UPstream::commsTypes::scheduled, UPstream::commsTypes::scheduled,
proci, proci,
recvData.data_bytes(), recvData
recvData.size_bytes()
); );
vtk::writeList(fmt, recvData); vtk::writeList(fmt, recvData);
} }
@ -522,8 +511,7 @@ void Foam::vtk::writeListsParallel
( (
UPstream::commsTypes::scheduled, UPstream::commsTypes::scheduled,
proci, proci,
recvData.data_bytes(), recvData
recvData.size_bytes()
); );
vtk::writeList(fmt, recvData); vtk::writeList(fmt, recvData);
} }
@ -537,8 +525,7 @@ void Foam::vtk::writeListsParallel
( (
UPstream::commsTypes::scheduled, UPstream::commsTypes::scheduled,
UPstream::masterNo(), UPstream::masterNo(),
values1.cdata_bytes(), values1
values1.size_bytes()
); );
} }
@ -548,8 +535,7 @@ void Foam::vtk::writeListsParallel
( (
UPstream::commsTypes::scheduled, UPstream::commsTypes::scheduled,
UPstream::masterNo(), UPstream::masterNo(),
sendData2.cdata_bytes(), sendData2
sendData2.size_bytes()
); );
} }
} }

View File

@ -227,15 +227,15 @@ void Foam::processorFaPatchField<Type>::initEvaluate
} }
// Receive straight into *this // Receive straight into *this
this->resize_nocopy(sendBuf_.size()); Field<Type>& self = *this;
self.resize_nocopy(sendBuf_.size());
recvRequest_ = UPstream::nRequests(); recvRequest_ = UPstream::nRequests();
UIPstream::read UIPstream::read
( (
UPstream::commsTypes::nonBlocking, UPstream::commsTypes::nonBlocking,
procPatch_.neighbProcNo(), procPatch_.neighbProcNo(),
this->data_bytes(), self,
this->size_bytes(),
procPatch_.tag(), procPatch_.tag(),
procPatch_.comm() procPatch_.comm()
); );
@ -245,8 +245,7 @@ void Foam::processorFaPatchField<Type>::initEvaluate
( (
UPstream::commsTypes::nonBlocking, UPstream::commsTypes::nonBlocking,
procPatch_.neighbProcNo(), procPatch_.neighbProcNo(),
sendBuf_.cdata_bytes(), sendBuf_,
sendBuf_.size_bytes(),
procPatch_.tag(), procPatch_.tag(),
procPatch_.comm() procPatch_.comm()
); );
@ -328,8 +327,7 @@ void Foam::processorFaPatchField<Type>::initInterfaceMatrixUpdate
( (
UPstream::commsTypes::nonBlocking, UPstream::commsTypes::nonBlocking,
procPatch_.neighbProcNo(), procPatch_.neighbProcNo(),
scalarRecvBuf_.data_bytes(), scalarRecvBuf_,
scalarRecvBuf_.size_bytes(),
procPatch_.tag(), procPatch_.tag(),
procPatch_.comm() procPatch_.comm()
); );
@ -339,8 +337,7 @@ void Foam::processorFaPatchField<Type>::initInterfaceMatrixUpdate
( (
UPstream::commsTypes::nonBlocking, UPstream::commsTypes::nonBlocking,
procPatch_.neighbProcNo(), procPatch_.neighbProcNo(),
scalarSendBuf_.cdata_bytes(), scalarSendBuf_,
scalarSendBuf_.size_bytes(),
procPatch_.tag(), procPatch_.tag(),
procPatch_.comm() procPatch_.comm()
); );
@ -434,8 +431,7 @@ void Foam::processorFaPatchField<Type>::initInterfaceMatrixUpdate
( (
UPstream::commsTypes::nonBlocking, UPstream::commsTypes::nonBlocking,
procPatch_.neighbProcNo(), procPatch_.neighbProcNo(),
recvBuf_.data_bytes(), recvBuf_,
recvBuf_.size_bytes(),
procPatch_.tag(), procPatch_.tag(),
procPatch_.comm() procPatch_.comm()
); );
@ -445,8 +441,7 @@ void Foam::processorFaPatchField<Type>::initInterfaceMatrixUpdate
( (
UPstream::commsTypes::nonBlocking, UPstream::commsTypes::nonBlocking,
procPatch_.neighbProcNo(), procPatch_.neighbProcNo(),
sendBuf_.cdata_bytes(), sendBuf_,
sendBuf_.size_bytes(),
procPatch_.tag(), procPatch_.tag(),
procPatch_.comm() procPatch_.comm()
); );

View File

@ -138,15 +138,15 @@ void Foam::calculatedProcessorFvPatchField<Type>::initEvaluate
} }
// Receive straight into *this // Receive straight into *this
this->resize_nocopy(sendBuf_.size()); Field<Type>& self = *this;
self.resize_nocopy(sendBuf_.size());
recvRequest_ = UPstream::nRequests(); recvRequest_ = UPstream::nRequests();
UIPstream::read UIPstream::read
( (
UPstream::commsTypes::nonBlocking, UPstream::commsTypes::nonBlocking,
procInterface_.neighbProcNo(), procInterface_.neighbProcNo(),
this->data_bytes(), self,
this->size_bytes(),
procInterface_.tag(), procInterface_.tag(),
procInterface_.comm() procInterface_.comm()
); );
@ -156,8 +156,7 @@ void Foam::calculatedProcessorFvPatchField<Type>::initEvaluate
( (
UPstream::commsTypes::nonBlocking, UPstream::commsTypes::nonBlocking,
procInterface_.neighbProcNo(), procInterface_.neighbProcNo(),
sendBuf_.cdata_bytes(), sendBuf_,
sendBuf_.size_bytes(),
procInterface_.tag(), procInterface_.tag(),
procInterface_.comm() procInterface_.comm()
); );
@ -218,8 +217,7 @@ void Foam::calculatedProcessorFvPatchField<Type>::initInterfaceMatrixUpdate
( (
UPstream::commsTypes::nonBlocking, UPstream::commsTypes::nonBlocking,
procInterface_.neighbProcNo(), procInterface_.neighbProcNo(),
scalarRecvBuf_.data_bytes(), scalarRecvBuf_,
scalarRecvBuf_.size_bytes(),
procInterface_.tag(), procInterface_.tag(),
procInterface_.comm() procInterface_.comm()
); );
@ -229,8 +227,7 @@ void Foam::calculatedProcessorFvPatchField<Type>::initInterfaceMatrixUpdate
( (
UPstream::commsTypes::nonBlocking, UPstream::commsTypes::nonBlocking,
procInterface_.neighbProcNo(), procInterface_.neighbProcNo(),
scalarSendBuf_.cdata_bytes(), scalarSendBuf_,
scalarSendBuf_.size_bytes(),
procInterface_.tag(), procInterface_.tag(),
procInterface_.comm() procInterface_.comm()
); );

View File

@ -232,15 +232,15 @@ void Foam::processorFvPatchField<Type>::initEvaluate
} }
// Receive straight into *this // Receive straight into *this
this->resize_nocopy(sendBuf_.size()); Field<Type>& self = *this;
self.resize_nocopy(sendBuf_.size());
recvRequest_ = UPstream::nRequests(); recvRequest_ = UPstream::nRequests();
UIPstream::read UIPstream::read
( (
UPstream::commsTypes::nonBlocking, UPstream::commsTypes::nonBlocking,
procPatch_.neighbProcNo(), procPatch_.neighbProcNo(),
this->data_bytes(), self,
this->size_bytes(),
procPatch_.tag(), procPatch_.tag(),
procPatch_.comm() procPatch_.comm()
); );
@ -250,8 +250,7 @@ void Foam::processorFvPatchField<Type>::initEvaluate
( (
UPstream::commsTypes::nonBlocking, UPstream::commsTypes::nonBlocking,
procPatch_.neighbProcNo(), procPatch_.neighbProcNo(),
sendBuf_.cdata_bytes(), sendBuf_,
sendBuf_.size_bytes(),
procPatch_.tag(), procPatch_.tag(),
procPatch_.comm() procPatch_.comm()
); );
@ -353,8 +352,7 @@ void Foam::processorFvPatchField<Type>::initInterfaceMatrixUpdate
( (
UPstream::commsTypes::nonBlocking, UPstream::commsTypes::nonBlocking,
procPatch_.neighbProcNo(), procPatch_.neighbProcNo(),
scalarRecvBuf_.data_bytes(), scalarRecvBuf_,
scalarRecvBuf_.size_bytes(),
procPatch_.tag(), procPatch_.tag(),
procPatch_.comm() procPatch_.comm()
); );
@ -364,8 +362,7 @@ void Foam::processorFvPatchField<Type>::initInterfaceMatrixUpdate
( (
UPstream::commsTypes::nonBlocking, UPstream::commsTypes::nonBlocking,
procPatch_.neighbProcNo(), procPatch_.neighbProcNo(),
scalarSendBuf_.cdata_bytes(), scalarSendBuf_,
scalarSendBuf_.size_bytes(),
procPatch_.tag(), procPatch_.tag(),
procPatch_.comm() procPatch_.comm()
); );
@ -474,8 +471,7 @@ void Foam::processorFvPatchField<Type>::initInterfaceMatrixUpdate
( (
UPstream::commsTypes::nonBlocking, UPstream::commsTypes::nonBlocking,
procPatch_.neighbProcNo(), procPatch_.neighbProcNo(),
recvBuf_.data_bytes(), recvBuf_,
recvBuf_.size_bytes(),
procPatch_.tag(), procPatch_.tag(),
procPatch_.comm() procPatch_.comm()
); );
@ -485,8 +481,7 @@ void Foam::processorFvPatchField<Type>::initInterfaceMatrixUpdate
( (
UPstream::commsTypes::nonBlocking, UPstream::commsTypes::nonBlocking,
procPatch_.neighbProcNo(), procPatch_.neighbProcNo(),
sendBuf_.cdata_bytes(), sendBuf_,
sendBuf_.size_bytes(),
procPatch_.tag(), procPatch_.tag(),
procPatch_.comm() procPatch_.comm()
); );

View File

@ -143,8 +143,7 @@ bool Foam::ensightOutput::writeCloudPositions
( (
UPstream::commsTypes::scheduled, UPstream::commsTypes::scheduled,
proci, proci,
positions.data_bytes(), positions
positions.size_bytes()
); );
if (isBinaryOutput) if (isBinaryOutput)
@ -166,8 +165,7 @@ bool Foam::ensightOutput::writeCloudPositions
( (
UPstream::commsTypes::scheduled, UPstream::commsTypes::scheduled,
UPstream::masterNo(), UPstream::masterNo(),
positions.cdata_bytes(), positions
positions.size_bytes()
); );
} }
} }

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2016-2024 OpenCFD Ltd. Copyright (C) 2016-2025 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -110,8 +110,7 @@ bool Foam::ensightOutput::writeCloudField
( (
UPstream::commsTypes::scheduled, UPstream::commsTypes::scheduled,
proci, proci,
recvData.data_bytes(), recvData
recvData.size_bytes()
); );
count = ensightOutput::Detail::writeCloudFieldContent count = ensightOutput::Detail::writeCloudFieldContent
@ -137,8 +136,7 @@ bool Foam::ensightOutput::writeCloudField
( (
UPstream::commsTypes::scheduled, UPstream::commsTypes::scheduled,
UPstream::masterNo(), UPstream::masterNo(),
field.cdata_bytes(), field
field.size_bytes()
); );
} }
} }

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2023 OpenCFD Ltd. Copyright (C) 2023-2025 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -194,13 +194,11 @@ void Foam::distributedDILUPreconditioner::receive
auto& recvBuf = recvBufs_[inti]; auto& recvBuf = recvBufs_[inti];
recvBuf.resize_nocopy(interfaceBouCoeffs[inti].size()); recvBuf.resize_nocopy(interfaceBouCoeffs[inti].size());
requests.push_back(UPstream::Request());
UIPstream::read UIPstream::read
( (
requests.back(), requests.emplace_back(),
ppp->neighbProcNo(), ppp->neighbProcNo(),
recvBuf.data_bytes(), recvBuf,
recvBuf.size_bytes(),
ppp->tag()+70, // random offset ppp->tag()+70, // random offset
ppp->comm() ppp->comm()
); );
@ -232,13 +230,11 @@ void Foam::distributedDILUPreconditioner::send
sendBuf[face] = psiInternal[faceCells[face]]; sendBuf[face] = psiInternal[faceCells[face]];
} }
requests.push_back(UPstream::Request());
UOPstream::write UOPstream::write
( (
requests.back(), requests.emplace_back(),
ppp->neighbProcNo(), ppp->neighbProcNo(),
sendBuf.cdata_bytes(), sendBuf,
sendBuf.size_bytes(),
ppp->tag()+70, // random offset ppp->tag()+70, // random offset
ppp->comm() ppp->comm()
); );

View File

@ -139,8 +139,7 @@ void Foam::calculatedProcessorGAMGInterfaceField::initInterfaceMatrixUpdate
( (
UPstream::commsTypes::nonBlocking, UPstream::commsTypes::nonBlocking,
procInterface_.neighbProcNo(), procInterface_.neighbProcNo(),
scalarRecvBuf_.data_bytes(), scalarRecvBuf_,
scalarRecvBuf_.size_bytes(),
procInterface_.tag(), procInterface_.tag(),
comm() comm()
); );
@ -150,8 +149,7 @@ void Foam::calculatedProcessorGAMGInterfaceField::initInterfaceMatrixUpdate
( (
UPstream::commsTypes::nonBlocking, UPstream::commsTypes::nonBlocking,
procInterface_.neighbProcNo(), procInterface_.neighbProcNo(),
scalarSendBuf_.cdata_bytes(), scalarSendBuf_,
scalarSendBuf_.size_bytes(),
procInterface_.tag(), procInterface_.tag(),
comm() comm()
); );

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2017-2024 OpenCFD Ltd. Copyright (C) 2017-2025 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -100,8 +100,7 @@ Foam::label Foam::metisLikeDecomp::decomposeGeneral
( (
commsType, commsType,
proci, proci,
procSlot.data_bytes(), procSlot,
procSlot.size_bytes(),
UPstream::msgType(), UPstream::msgType(),
UPstream::worldComm UPstream::worldComm
); );
@ -124,8 +123,7 @@ Foam::label Foam::metisLikeDecomp::decomposeGeneral
( (
commsType, commsType,
UPstream::masterNo(), UPstream::masterNo(),
procSlot.cdata_bytes(), procSlot,
procSlot.size_bytes(),
UPstream::msgType(), UPstream::msgType(),
UPstream::worldComm UPstream::worldComm
); );