Commit 03d777f5 authored by mattijs's avatar mattijs
Browse files

message size not set; debug printing

parent 8349d891
......@@ -66,6 +66,14 @@ Foam::UIPstream::UIPstream
label wantedSize = externalBuf_.capacity();
if (debug)
{
Pout<< "UIPstream::UIPstream : read from:" << fromProcNo
<< " tag:" << tag << " wanted size:" << wantedSize
<< Foam::endl;
}
// If the buffer size is not specified, probe the incomming message
// and set it
if (!wantedSize)
......@@ -75,6 +83,12 @@ Foam::UIPstream::UIPstream
externalBuf_.setCapacity(messageSize_);
wantedSize = messageSize_;
if (debug)
{
Pout<< "UIPstream::UIPstream : probed size:" << wantedSize
<< Foam::endl;
}
}
messageSize_ = UIPstream::read
......@@ -127,6 +141,7 @@ Foam::UIPstream::UIPstream(const int fromProcNo, PstreamBuffers& buffers)
if (commsType() == UPstream::nonBlocking)
{
// Message is already received into externalBuf
messageSize_ = buffers.recvBuf_[fromProcNo].size();
}
else
{
......@@ -134,6 +149,14 @@ Foam::UIPstream::UIPstream(const int fromProcNo, PstreamBuffers& buffers)
label wantedSize = externalBuf_.capacity();
if (debug)
{
Pout<< "UIPstream::UIPstream PstreamBuffers :"
<< " read from:" << fromProcNo
<< " tag:" << tag_ << " wanted size:" << wantedSize
<< Foam::endl;
}
// If the buffer size is not specified, probe the incomming message
// and set it
if (!wantedSize)
......@@ -143,6 +166,12 @@ Foam::UIPstream::UIPstream(const int fromProcNo, PstreamBuffers& buffers)
externalBuf_.setCapacity(messageSize_);
wantedSize = messageSize_;
if (debug)
{
Pout<< "UIPstream::UIPstream PstreamBuffers : probed size:"
<< wantedSize << Foam::endl;
}
}
messageSize_ = UIPstream::read
......@@ -180,6 +209,14 @@ Foam::label Foam::UIPstream::read
const int tag
)
{
if (debug)
{
Pout<< "UIPstream::read : starting read from:" << fromProcNo
<< " tag:" << tag << " wanted size:" << label(bufSize)
<< " commsType:" << UPstream::commsTypeNames[commsType]
<< Foam::endl;
}
if (commsType == blocking || commsType == scheduled)
{
MPI_Status status;
......@@ -214,6 +251,14 @@ Foam::label Foam::UIPstream::read
label messageSize;
MPI_Get_count(&status, MPI_BYTE, &messageSize);
if (debug)
{
Pout<< "UIPstream::read : finished read from:" << fromProcNo
<< " tag:" << tag << " read size:" << label(bufSize)
<< " commsType:" << UPstream::commsTypeNames[commsType]
<< Foam::endl;
}
if (messageSize > bufSize)
{
FatalErrorIn
......@@ -256,6 +301,15 @@ Foam::label Foam::UIPstream::read
return 0;
}
if (debug)
{
Pout<< "UIPstream::read : started read from:" << fromProcNo
<< " tag:" << tag << " read size:" << label(bufSize)
<< " commsType:" << UPstream::commsTypeNames[commsType]
<< " request:" << PstreamGlobals::outstandingRequests_.size()
<< Foam::endl;
}
PstreamGlobals::outstandingRequests_.append(request);
// Assume the message is completely received.
......@@ -267,7 +321,8 @@ Foam::label Foam::UIPstream::read
(
"UIPstream::read"
"(const int fromProcNo, char* buf, std::streamsize bufSize)"
) << "Unsupported communications type " << commsType
) << "Unsupported communications type "
<< commsType
<< Foam::abort(FatalError);
return 0;
......
......@@ -43,6 +43,14 @@ bool Foam::UOPstream::write
const int tag
)
{
if (debug)
{
Pout<< "UIPstream::write : starting write to:" << toProcNo
<< " tag:" << tag << " size:" << label(bufSize)
<< " commsType:" << UPstream::commsTypeNames[commsType]
<< Foam::endl;
}
bool transferFailed = true;
if (commsType == blocking)
......@@ -56,6 +64,14 @@ bool Foam::UOPstream::write
tag,
MPI_COMM_WORLD
);
if (debug)
{
Pout<< "UIPstream::write : finished write to:" << toProcNo
<< " tag:" << tag << " size:" << label(bufSize)
<< " commsType:" << UPstream::commsTypeNames[commsType]
<< Foam::endl;
}
}
else if (commsType == scheduled)
{
......@@ -68,6 +84,14 @@ bool Foam::UOPstream::write
tag,
MPI_COMM_WORLD
);
if (debug)
{
Pout<< "UIPstream::write : finished write to:" << toProcNo
<< " tag:" << tag << " size:" << label(bufSize)
<< " commsType:" << UPstream::commsTypeNames[commsType]
<< Foam::endl;
}
}
else if (commsType == nonBlocking)
{
......@@ -84,6 +108,15 @@ bool Foam::UOPstream::write
&request
);
if (debug)
{
Pout<< "UIPstream::write : started write to:" << toProcNo
<< " tag:" << tag << " size:" << label(bufSize)
<< " commsType:" << UPstream::commsTypeNames[commsType]
<< " request:" << PstreamGlobals::outstandingRequests_.size()
<< Foam::endl;
}
PstreamGlobals::outstandingRequests_.append(request);
}
else
......@@ -93,7 +126,8 @@ bool Foam::UOPstream::write
"UOPstream::write"
"(const int fromProcNo, char* buf, std::streamsize bufSize"
", const int)"
) << "Unsupported communications type " << commsType
) << "Unsupported communications type "
<< UPstream::commsTypeNames[commsType]
<< Foam::abort(FatalError);
}
......
......@@ -70,6 +70,12 @@ bool Foam::UPstream::init(int& argc, char**& argv)
MPI_Comm_size(MPI_COMM_WORLD, &numprocs);
MPI_Comm_rank(MPI_COMM_WORLD, &myProcNo_);
if (debug)
{
Pout<< "UPstream::init : initialised with numProcs:" << numprocs
<< " myProcNo:" << myProcNo_ << endl;
}
if (numprocs <= 1)
{
FatalErrorIn("UPstream::init(int& argc, char**& argv)")
......@@ -124,6 +130,11 @@ bool Foam::UPstream::init(int& argc, char**& argv)
void Foam::UPstream::exit(int errnum)
{
if (debug)
{
Pout<< "UPstream::exit." << endl;
}
# ifndef SGIMPI
int size;
char* buff;
......@@ -164,6 +175,11 @@ void Foam::UPstream::abort()
void Foam::reduce(scalar& Value, const sumOp<scalar>& bop)
{
if (Pstream::debug)
{
Pout<< "UPstream::reduce : value:" << Value << endl;
}
if (!UPstream::parRun())
{
return;
......@@ -433,11 +449,23 @@ void Foam::reduce(scalar& Value, const sumOp<scalar>& bop)
}
*/
}
if (Pstream::debug)
{
Pout<< "UPstream::reduce : reduced value:" << Value << endl;
}
}
void Foam::UPstream::waitRequests()
{
if (debug)
{
Pout<< "UPstream::waitRequests : starting wait for "
<< PstreamGlobals::outstandingRequests_.size()
<< " outstanding requests." << endl;
}
if (PstreamGlobals::outstandingRequests_.size())
{
if
......@@ -458,11 +486,22 @@ void Foam::UPstream::waitRequests()
PstreamGlobals::outstandingRequests_.clear();
}
if (debug)
{
Pout<< "UPstream::waitRequests : finished wait." << endl;
}
}
bool Foam::UPstream::finishedRequest(const label i)
{
if (debug)
{
Pout<< "UPstream::waitRequests : starting wait for request:" << i
<< endl;
}
if (i >= PstreamGlobals::outstandingRequests_.size())
{
FatalErrorIn
......@@ -483,6 +522,12 @@ bool Foam::UPstream::finishedRequest(const label i)
MPI_STATUS_IGNORE
);
if (debug)
{
Pout<< "UPstream::waitRequests : finished wait for request:" << i
<< endl;
}
return flag != 0;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment