38 #undef Pstream_use_MPI_Get_count 47 const std::streamsize bufSize,
50 const Foam::label communicator,
61 if (bufSize > std::streamsize(INT_MAX))
63 Perr<<
"UIPstream::read() : from rank " << fromProcNo
71 Perr<<
"UIPstream::read : starting read from:" << fromProcNo
72 <<
" size:" << label(bufSize)
73 <<
" tag:" << tag <<
" comm:" << communicator
81 Perr<<
"UIPstream::read : starting read from:" << fromProcNo
82 <<
" size:" << label(bufSize)
83 <<
" tag:" << tag <<
" comm:" << communicator
88 int returnCode = MPI_ERR_UNKNOWN;
103 returnCode = MPI_Recv
117 if (returnCode != MPI_SUCCESS)
120 <<
"MPI_Recv cannot receive incoming message" 126 Perr<<
"UIPstream::read : finished recv from:" 128 <<
" size:" << label(bufSize) <<
" tag:" << tag
133 #ifdef Pstream_use_MPI_Get_count 135 MPI_Get_count(&status, MPI_BYTE, &
count);
138 MPI_Get_elements_x(&status, MPI_BYTE, &
count);
142 if (
count == MPI_UNDEFINED || int64_t(
count) < 0)
145 <<
"MPI_Get_count() or MPI_Get_elements_x() : " 146 "returned undefined or negative value" 152 <<
"MPI_Get_count() or MPI_Get_elements_x() : " 153 "count is larger than UList<char>::max_size() bytes" 158 if (bufSize < std::streamsize(
count))
161 <<
"buffer (" << label(bufSize)
162 <<
") not large enough for incoming message (" 163 << label(
count) <<
')' 167 return std::streamsize(
count);
174 returnCode = MPI_Irecv
186 if (returnCode != MPI_SUCCESS)
189 <<
"MPI_Irecv cannot start non-blocking receive" 201 Perr<<
"UIPstream::read : started non-blocking recv from:" 203 <<
" size:" << label(bufSize) <<
" tag:" << tag
214 <<
"Unsupported communications type " << int(commsType)
223 void Foam::UIPstream::bufferIPCrecv()
228 Perr<<
"UIPstream IPC read buffer :" 268 #ifdef Pstream_use_MPI_Get_count 270 MPI_Get_count(&status, MPI_BYTE, &
count);
273 MPI_Get_elements_x(&status, MPI_BYTE, &
count);
277 if (
count == MPI_UNDEFINED || int64_t(
count) < 0)
280 <<
"MPI_Get_count() or MPI_Get_elements_x() : " 281 "returned undefined or negative value" 287 <<
"MPI_Get_count() or MPI_Get_elements_x() : " 288 "count is larger than UList<char>::max_size() bytes" 294 Perr<<
"UIPstream::UIPstream : probed size:" 316 <<
"MPI_recv() with negative size??" 322 <<
"MPI_recv() larger than " 323 "UList<char>::max_size() bytes" 343 const int fromProcNo,
345 const std::streamsize bufSize,
347 const label communicator,
static void addProbeTime()
Add time increment to probe time.
prefixOSstream Perr
OSstream wrapped stderr (std::cerr) with parallel prefix.
void size(const label n)
Older name for setAddressableSize.
DynamicList< MPI_Request > outstandingRequests_
Outstanding non-blocking operations.
static const Enum< commsTypes > commsTypeNames
Enumerated names for the communication types.
commsTypes
Communications types.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
bool empty() const noexcept
True if List is empty (ie, size() is zero)
T * data() noexcept
Return pointer to the underlying array serving as data storage.
void resize(const label len)
Alter addressable list size, allocating new space if required while recovering old content...
DynamicList< MPI_Comm > MPICommunicators_
Ostream & endl(Ostream &os)
Add newline and flush stream.
const int fromProcNo_
Source rank for the data.
void reset_request(UPstream::Request *requestPtr, label *requestIdx=nullptr)
Reset UPstream::Request to null and/or the index of the outstanding request to -1.
label capacity() const noexcept
Size of the underlying storage.
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
label messageSize_
The message size, read on bufferIPCrecv or set directly.
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of 'true' entries.
"scheduled" (MPI standard) : (MPI_Send, MPI_Recv)
static std::streamsize UPstream_mpi_receive(const Foam::UPstream::commsTypes commsType, char *buf, const std::streamsize bufSize, const int fromProcNo, const int tag, const Foam::label communicator, Foam::UPstream::Request *req)
An opaque wrapper for MPI_Request with a vendor-independent representation without any <mpi...
static label warnComm
Debugging: warn for use of any communicator differing from warnComm.
errorManip< error > abort(error &err)
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
commsTypes commsType() const noexcept
Get the communications type of the stream.
static void beginTiming()
Update timer prior to measurement.
int debug
Static debugging option.
static void addRequestTime()
Add time increment to request time.
void push_request(MPI_Request request, UPstream::Request *requestPtr=nullptr, label *requestIdx=nullptr)
Transcribe MPI_Request to UPstream::Request (does not affect the stack of outstanding requests) or el...
DynamicList< char > & recvBuf_
Reference to the receive buffer data.
const int tag_
Message tag for communication.
static void addGatherTime()
Add time increment to gather time.
"nonBlocking" (immediate) : (MPI_Isend, MPI_Irecv)
static void printStack(Ostream &os, int size=-1)
Helper function to print a stack, with optional upper limit.
void setEof() noexcept
Set stream state as reached 'eof'.
"buffered" : (MPI_Bsend, MPI_Recv)
const int comm_
The communicator index.
static std::streamsize read(const UPstream::commsTypes commsType, const int fromProcNo, char *buf, const std::streamsize bufSize, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm, UPstream::Request *req=nullptr)
Read buffer contents from given processor.