diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/PstreamBuffers.C b/src/OpenFOAM/db/IOstreams/Pstreams/PstreamBuffers.C index 37459b1abd..391c094bea 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/PstreamBuffers.C +++ b/src/OpenFOAM/db/IOstreams/Pstreams/PstreamBuffers.C @@ -45,6 +45,11 @@ registerOptSwitch Foam::PstreamBuffers::algorithm ); +namespace Foam +{ + defineTypeNameAndDebug(PstreamBuffers, 0); +} + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -231,6 +236,12 @@ void Foam::PstreamBuffers::finalExchange labelList& recvSizes ) { + DebugPoutInFunction + << "tag:" << tag_ + << " comm:" << comm_ + << " nProcs:" << nProcs_ + << endl; + initFinalExchange(); if (commsType_ == UPstream::commsTypes::nonBlocking) @@ -303,13 +314,25 @@ Foam::PstreamBuffers::PstreamBuffers sendBuffers_(nProcs_), recvBuffers_(nProcs_), recvPositions_(nProcs_, Zero) -{} +{ + DebugPoutInFunction + << "tag:" << tag_ + << " comm:" << comm_ + << " nProcs:" << nProcs_ + << endl; +} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // Foam::PstreamBuffers::~PstreamBuffers() { + DebugPoutInFunction + << "tag:" << tag_ + << " comm:" << comm_ + << " nProcs:" << nProcs_ + << endl; + // Check that all data has been consumed. forAll(recvBuffers_, proci) { @@ -321,6 +344,7 @@ Foam::PstreamBuffers::~PstreamBuffers() FatalErrorInFunction << "Message from processor " << proci << " Only consumed " << pos << " of " << len << " bytes" << nl + << " comm " << comm_ << " tag " << tag_ << nl << Foam::abort(FatalError); } } @@ -623,6 +647,12 @@ Foam::PstreamBuffers::peekRecvData(const label proci) const void Foam::PstreamBuffers::finishedSends(const bool wait) { + DebugPoutInFunction + << "tag:" << tag_ + << " comm:" << comm_ + << " nProcs:" << nProcs_ + << endl; + labelList recvSizes; finalExchange(modeOption::DEFAULT, wait, recvSizes); } @@ -630,6 +660,12 @@ void Foam::PstreamBuffers::finishedSends(const bool wait) void Foam::PstreamBuffers::finishedSendsNBX(const bool wait) { + DebugPoutInFunction + << "tag:" << tag_ + << " comm:" << comm_ + << " nProcs:" << nProcs_ + << endl; + labelList recvSizes; finalExchange(modeOption::NBX_PEX, wait, recvSizes); } @@ -641,6 +677,12 @@ void Foam::PstreamBuffers::finishedSends const bool wait ) { + DebugPoutInFunction + << "tag:" << tag_ + << " comm:" << comm_ + << " nProcs:" << nProcs_ + << endl; + // Resize for copying back recvSizes.resize_nocopy(sendBuffers_.size()); diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/PstreamBuffers.H b/src/OpenFOAM/db/IOstreams/Pstreams/PstreamBuffers.H index ed40029c93..97cb68fe9a 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/PstreamBuffers.H +++ b/src/OpenFOAM/db/IOstreams/Pstreams/PstreamBuffers.H @@ -248,6 +248,10 @@ class PstreamBuffers public: + // Declare name of the class and its debug switch + ClassName("PstreamBuffers"); + + // Static Data //- Preferred exchange algorithm (may change or be removed in future) diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C index c46241eceb..55ac9b98fc 100644 --- a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C +++ b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C @@ -88,6 +88,9 @@ void Foam::globalMeshData::initProcAddr() if (UPstream::parRun()) { + // Allocate unique tag for all comms + const int oldTag = UPstream::incrMsgType(); + PstreamBuffers pBufs(mesh_.comm()); // Send indices of my processor patches to my neighbours @@ -120,6 +123,9 @@ void Foam::globalMeshData::initProcAddr() fromNeighbour >> processorPatchNeighbours_[patchi]; } + + // Reset tag + UPstream::msgType(oldTag); } } @@ -137,6 +143,9 @@ void Foam::globalMeshData::calcSharedPoints() const << "Shared point addressing already done" << abort(FatalError); } + // Allocate unique tag for all comms + const int oldTag = UPstream::incrMsgType(); + // Calculate all shared points (exclude points that are only // on two coupled patches). This does all the hard work. const globalPoints parallelPoints(mesh_, false, true); @@ -229,6 +238,9 @@ void Foam::globalMeshData::calcSharedPoints() const } } + // Reset tag + UPstream::msgType(oldTag); + if (debug) { Pout<< "globalMeshData : nGlobalPoints_:" << nGlobalPoints_ << nl @@ -356,6 +368,9 @@ void Foam::globalMeshData::calcSharedEdges() const EdgeMap