ENH: GAMGInterface: added communicator to arguments.

Extended UIPstream,UOPstream for user defined communicators
This commit is contained in:
mattijs
2013-02-06 16:44:22 +00:00
parent 2b9a6ae968
commit bd1230eb87
28 changed files with 248 additions and 68 deletions

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -33,6 +33,7 @@ License
Foam::LUscalarMatrix::LUscalarMatrix(const scalarSquareMatrix& matrix) Foam::LUscalarMatrix::LUscalarMatrix(const scalarSquareMatrix& matrix)
: :
comm_(Pstream::worldComm),
scalarSquareMatrix(matrix), scalarSquareMatrix(matrix),
pivotIndices_(n()) pivotIndices_(n())
{ {
@ -46,10 +47,12 @@ Foam::LUscalarMatrix::LUscalarMatrix
const FieldField<Field, scalar>& interfaceCoeffs, const FieldField<Field, scalar>& interfaceCoeffs,
const lduInterfaceFieldPtrsList& interfaces const lduInterfaceFieldPtrsList& interfaces
) )
:
comm_(ldum.mesh().comm())
{ {
if (Pstream::parRun()) if (Pstream::parRun())
{ {
PtrList<procLduMatrix> lduMatrices(Pstream::nProcs()); PtrList<procLduMatrix> lduMatrices(Pstream::nProcs(comm_));
label lduMatrixi = 0; label lduMatrixi = 0;
@ -64,25 +67,49 @@ Foam::LUscalarMatrix::LUscalarMatrix
) )
); );
if (Pstream::master())
Pout<< "LUscalarMatrix :"
<< " comm:" << comm_
<< " master:" << Pstream::master(comm_) << endl;
if (Pstream::master(comm_))
{ {
for for
( (
int slave=Pstream::firstSlave(); int slave=Pstream::firstSlave();
slave<=Pstream::lastSlave(); slave<=Pstream::lastSlave(comm_);
slave++ slave++
) )
{ {
Pout<< "Receiving from " << slave
<< " using comm:" << comm_ << endl;
lduMatrices.set lduMatrices.set
( (
lduMatrixi++, lduMatrixi++,
new procLduMatrix(IPstream(Pstream::scheduled, slave)()) new procLduMatrix
(
IPstream
(
Pstream::scheduled,
slave,
0, // bufSize
Pstream::msgType(),
comm_
)()
)
); );
} }
} }
else else
{ {
OPstream toMaster(Pstream::scheduled, Pstream::masterNo()); OPstream toMaster
(
Pstream::scheduled,
Pstream::masterNo(),
0, // bufSize
Pstream::msgType(),
comm_
);
procLduMatrix cldum procLduMatrix cldum
( (
ldum, ldum,
@ -93,7 +120,7 @@ Foam::LUscalarMatrix::LUscalarMatrix
} }
if (Pstream::master()) if (Pstream::master(comm_))
{ {
label nCells = 0; label nCells = 0;
forAll(lduMatrices, i) forAll(lduMatrices, i)
@ -114,7 +141,7 @@ Foam::LUscalarMatrix::LUscalarMatrix
convert(ldum, interfaceCoeffs, interfaces); convert(ldum, interfaceCoeffs, interfaces);
} }
if (Pstream::master()) if (Pstream::master(comm_))
{ {
pivotIndices_.setSize(n()); pivotIndices_.setSize(n());
LUDecompose(*this, pivotIndices_); LUDecompose(*this, pivotIndices_);

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -58,6 +58,9 @@ class LUscalarMatrix
{ {
// Private data // Private data
//- Communicator to use
const label comm_;
//- Processor matrix offsets //- Processor matrix offsets
labelList procOffsets_; labelList procOffsets_;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -34,7 +34,7 @@ void Foam::LUscalarMatrix::solve(Field<Type>& sourceSol) const
{ {
Field<Type> completeSourceSol(n()); Field<Type> completeSourceSol(n());
if (Pstream::master()) if (Pstream::master(comm_))
{ {
typename Field<Type>::subField typename Field<Type>::subField
( (
@ -45,7 +45,7 @@ void Foam::LUscalarMatrix::solve(Field<Type>& sourceSol) const
for for
( (
int slave=Pstream::firstSlave(); int slave=Pstream::firstSlave();
slave<=Pstream::lastSlave(); slave<=Pstream::lastSlave(comm_);
slave++ slave++
) )
{ {
@ -57,7 +57,9 @@ void Foam::LUscalarMatrix::solve(Field<Type>& sourceSol) const
( (
&(completeSourceSol[procOffsets_[slave]]) &(completeSourceSol[procOffsets_[slave]])
), ),
(procOffsets_[slave + 1] - procOffsets_[slave])*sizeof(Type) (procOffsets_[slave+1]-procOffsets_[slave])*sizeof(Type),
Pstream::msgType(),
comm_
); );
} }
} }
@ -68,11 +70,13 @@ void Foam::LUscalarMatrix::solve(Field<Type>& sourceSol) const
Pstream::scheduled, Pstream::scheduled,
Pstream::masterNo(), Pstream::masterNo(),
reinterpret_cast<const char*>(sourceSol.begin()), reinterpret_cast<const char*>(sourceSol.begin()),
sourceSol.byteSize() sourceSol.byteSize(),
Pstream::msgType(),
comm_
); );
} }
if (Pstream::master()) if (Pstream::master(comm_))
{ {
LUBacksubstitute(*this, pivotIndices_, completeSourceSol); LUBacksubstitute(*this, pivotIndices_, completeSourceSol);
@ -85,7 +89,7 @@ void Foam::LUscalarMatrix::solve(Field<Type>& sourceSol) const
for for
( (
int slave=Pstream::firstSlave(); int slave=Pstream::firstSlave();
slave<=Pstream::lastSlave(); slave<=Pstream::lastSlave(comm_);
slave++ slave++
) )
{ {
@ -97,7 +101,9 @@ void Foam::LUscalarMatrix::solve(Field<Type>& sourceSol) const
( (
&(completeSourceSol[procOffsets_[slave]]) &(completeSourceSol[procOffsets_[slave]])
), ),
(procOffsets_[slave + 1] - procOffsets_[slave])*sizeof(Type) (procOffsets_[slave + 1]-procOffsets_[slave])*sizeof(Type),
Pstream::msgType(),
comm_
); );
} }
} }
@ -108,7 +114,9 @@ void Foam::LUscalarMatrix::solve(Field<Type>& sourceSol) const
Pstream::scheduled, Pstream::scheduled,
Pstream::masterNo(), Pstream::masterNo(),
reinterpret_cast<char*>(sourceSol.begin()), reinterpret_cast<char*>(sourceSol.begin()),
sourceSol.byteSize() sourceSol.byteSize(),
Pstream::msgType(),
comm_
); );
} }
} }

View File

@ -240,6 +240,15 @@ void Foam::GAMGAgglomeration::agglomerateLduAddressing
Pstream::waitRequests(); Pstream::waitRequests();
} }
// Allocate a communicator for the coarse level
label coarseComm = UPstream::allocateCommunicator
(
fineMesh.comm(),
identity(UPstream::nProcs(fineMesh.comm())) //TBD
);
// Add the coarse level // Add the coarse level
forAll(fineInterfaces, inti) forAll(fineInterfaces, inti)
{ {
@ -259,7 +268,8 @@ void Foam::GAMGAgglomeration::agglomerateLduAddressing
Pstream::nonBlocking, Pstream::nonBlocking,
restrictMap restrictMap
), ),
fineLevelIndex fineLevelIndex,
coarseComm
).ptr() ).ptr()
); );
@ -280,7 +290,7 @@ void Foam::GAMGAgglomeration::agglomerateLduAddressing
coarseInterfaceAddr, coarseInterfaceAddr,
coarseInterfaces, coarseInterfaces,
fineMeshAddr.patchSchedule(), fineMeshAddr.patchSchedule(),
fineMesh.comm(), coarseComm,
true true
) )
); );

View File

@ -196,6 +196,16 @@ const Foam::GAMGAgglomeration& Foam::GAMGAgglomeration::New
Foam::GAMGAgglomeration::~GAMGAgglomeration() Foam::GAMGAgglomeration::~GAMGAgglomeration()
{ {
// Temporary store the user-defined communicators so we can delete them
labelList communicators(meshLevels_.size());
forAll(meshLevels_, leveli)
{
communicators[leveli] = meshLevels_[leveli].comm();
}
Pout<< "~GAMGAgglomeration() : current communicators:" << communicators
<< endl;
// Clear the interface storage by hand. // Clear the interface storage by hand.
// It is a list of ptrs not a PtrList for consistency of the interface // It is a list of ptrs not a PtrList for consistency of the interface
for (label leveli=1; leveli<interfaceLevels_.size(); leveli++) for (label leveli=1; leveli<interfaceLevels_.size(); leveli++)
@ -210,6 +220,11 @@ Foam::GAMGAgglomeration::~GAMGAgglomeration()
} }
} }
} }
forAll(communicators, i)
{
UPstream::freeCommunicator(communicators[i]);
}
} }

View File

@ -94,6 +94,10 @@ Foam::GAMGSolver::GAMGSolver
if (directSolveCoarsest_) if (directSolveCoarsest_)
{ {
label coarseComm = matrixLevels_[coarsestLevel].mesh().comm();
label oldWarn = UPstream::warnComm;
UPstream::warnComm = coarseComm;
coarsestLUMatrixPtr_.set coarsestLUMatrixPtr_.set
( (
new LUscalarMatrix new LUscalarMatrix
@ -103,6 +107,8 @@ Foam::GAMGSolver::GAMGSolver
interfaceLevels_[coarsestLevel] interfaceLevels_[coarsestLevel]
) )
); );
UPstream::warnComm = oldWarn;
} }
} }
else else

View File

@ -441,6 +441,11 @@ void Foam::GAMGSolver::solveCoarsestLevel
const scalarField& coarsestSource const scalarField& coarsestSource
) const ) const
{ {
const label coarsestLevel = matrixLevels_.size() - 1;
label coarseComm = matrixLevels_[coarsestLevel].mesh().comm();
label oldWarn = UPstream::warnComm;
UPstream::warnComm = coarseComm;
if (directSolveCoarsest_) if (directSolveCoarsest_)
{ {
coarsestCorrField = coarsestSource; coarsestCorrField = coarsestSource;
@ -489,9 +494,11 @@ void Foam::GAMGSolver::solveCoarsestLevel
if (debug >= 2) if (debug >= 2)
{ {
coarseSolverPerf.print(Info(matrix().mesh().comm())); coarseSolverPerf.print(Info(coarseComm));
} }
} }
UPstream::warnComm = oldWarn;
} }

View File

@ -79,6 +79,9 @@ void Foam::processorGAMGInterfaceField::initInterfaceMatrixUpdate
const Pstream::commsTypes commsType const Pstream::commsTypes commsType
) const ) const
{ {
label oldWarn = UPstream::warnComm;
UPstream::warnComm = comm();
procInterface_.interfaceInternalField(psiInternal, scalarSendBuf_); procInterface_.interfaceInternalField(psiInternal, scalarSendBuf_);
if (commsType == Pstream::nonBlocking && !Pstream::floatTransfer) if (commsType == Pstream::nonBlocking && !Pstream::floatTransfer)
@ -93,7 +96,7 @@ void Foam::processorGAMGInterfaceField::initInterfaceMatrixUpdate
reinterpret_cast<char*>(scalarReceiveBuf_.begin()), reinterpret_cast<char*>(scalarReceiveBuf_.begin()),
scalarReceiveBuf_.byteSize(), scalarReceiveBuf_.byteSize(),
procInterface_.tag(), procInterface_.tag(),
procInterface_.comm() comm()
); );
outstandingSendRequest_ = UPstream::nRequests(); outstandingSendRequest_ = UPstream::nRequests();
@ -104,7 +107,7 @@ void Foam::processorGAMGInterfaceField::initInterfaceMatrixUpdate
reinterpret_cast<const char*>(scalarSendBuf_.begin()), reinterpret_cast<const char*>(scalarSendBuf_.begin()),
scalarSendBuf_.byteSize(), scalarSendBuf_.byteSize(),
procInterface_.tag(), procInterface_.tag(),
procInterface_.comm() comm()
); );
} }
else else
@ -113,6 +116,8 @@ void Foam::processorGAMGInterfaceField::initInterfaceMatrixUpdate
} }
const_cast<processorGAMGInterfaceField&>(*this).updatedMatrix() = false; const_cast<processorGAMGInterfaceField&>(*this).updatedMatrix() = false;
UPstream::warnComm = oldWarn;
} }
@ -130,6 +135,9 @@ void Foam::processorGAMGInterfaceField::updateInterfaceMatrix
return; return;
} }
label oldWarn = UPstream::warnComm;
UPstream::warnComm = comm();
const labelUList& faceCells = procInterface_.faceCells(); const labelUList& faceCells = procInterface_.faceCells();
if (commsType == Pstream::nonBlocking && !Pstream::floatTransfer) if (commsType == Pstream::nonBlocking && !Pstream::floatTransfer)
@ -173,6 +181,8 @@ void Foam::processorGAMGInterfaceField::updateInterfaceMatrix
} }
const_cast<processorGAMGInterfaceField&>(*this).updatedMatrix() = true; const_cast<processorGAMGInterfaceField&>(*this).updatedMatrix() = true;
UPstream::warnComm = oldWarn;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -101,7 +101,8 @@ public:
const lduInterface& fineInterface, const lduInterface& fineInterface,
const labelField& localRestrictAddressing, const labelField& localRestrictAddressing,
const labelField& neighbourRestrictAddressing, const labelField& neighbourRestrictAddressing,
const label fineLevelIndex const label fineLevelIndex,
const label coarseComm
), ),
( (
index, index,
@ -109,7 +110,8 @@ public:
fineInterface, fineInterface,
localRestrictAddressing, localRestrictAddressing,
neighbourRestrictAddressing, neighbourRestrictAddressing,
fineLevelIndex fineLevelIndex,
coarseComm
) )
); );
@ -125,7 +127,8 @@ public:
const lduInterface& fineInterface, const lduInterface& fineInterface,
const labelField& localRestrictAddressing, const labelField& localRestrictAddressing,
const labelField& neighbourRestrictAddressing, const labelField& neighbourRestrictAddressing,
const label fineLevelIndex const label fineLevelIndex,
const label coarseComm
); );
@ -140,7 +143,8 @@ public:
const lduInterface&, const lduInterface&,
const labelField&, const labelField&,
const labelField&, const labelField&,
const label fineLevelIndex = -1 const label fineLevelIndex = -1,
const label coarseComm = UPstream::worldComm
) )
: :
index_(index), index_(index),

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -37,7 +37,8 @@ Foam::autoPtr<Foam::GAMGInterface> Foam::GAMGInterface::New
const lduInterface& fineInterface, const lduInterface& fineInterface,
const labelField& localRestrictAddressing, const labelField& localRestrictAddressing,
const labelField& neighbourRestrictAddressing, const labelField& neighbourRestrictAddressing,
const label fineLevelIndex const label fineLevelIndex,
const label coarseComm
) )
{ {
const word coupleType(fineInterface.type()); const word coupleType(fineInterface.type());
@ -68,7 +69,8 @@ Foam::autoPtr<Foam::GAMGInterface> Foam::GAMGInterface::New
fineInterface, fineInterface,
localRestrictAddressing, localRestrictAddressing,
neighbourRestrictAddressing, neighbourRestrictAddressing,
fineLevelIndex fineLevelIndex,
coarseComm
) )
); );
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -51,7 +51,8 @@ Foam::cyclicGAMGInterface::cyclicGAMGInterface
const lduInterface& fineInterface, const lduInterface& fineInterface,
const labelField& localRestrictAddressing, const labelField& localRestrictAddressing,
const labelField& neighbourRestrictAddressing, const labelField& neighbourRestrictAddressing,
const label fineLevelIndex const label fineLevelIndex,
const label coarseComm
) )
: :
GAMGInterface GAMGInterface

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -85,7 +85,8 @@ public:
const lduInterface& fineInterface, const lduInterface& fineInterface,
const labelField& restrictAddressing, const labelField& restrictAddressing,
const labelField& neighbourRestrictAddressing, const labelField& neighbourRestrictAddressing,
const label fineLevelIndex const label fineLevelIndex,
const label coarseComm
); );

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -50,7 +50,8 @@ Foam::processorCyclicGAMGInterface::processorCyclicGAMGInterface
const lduInterface& fineInterface, const lduInterface& fineInterface,
const labelField& localRestrictAddressing, const labelField& localRestrictAddressing,
const labelField& neighbourRestrictAddressing, const labelField& neighbourRestrictAddressing,
const label fineLevelIndex const label fineLevelIndex,
const label coarseComm
) )
: :
processorGAMGInterface processorGAMGInterface
@ -60,7 +61,8 @@ Foam::processorCyclicGAMGInterface::processorCyclicGAMGInterface
fineInterface, fineInterface,
localRestrictAddressing, localRestrictAddressing,
neighbourRestrictAddressing, neighbourRestrictAddressing,
fineLevelIndex fineLevelIndex,
coarseComm
) )
{} {}

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -76,7 +76,8 @@ public:
const lduInterface& fineInterface, const lduInterface& fineInterface,
const labelField& restrictAddressing, const labelField& restrictAddressing,
const labelField& neighbourRestrictAddressing, const labelField& neighbourRestrictAddressing,
const label fineLevelIndex const label fineLevelIndex,
const label coarseComm
); );

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -51,7 +51,8 @@ Foam::processorGAMGInterface::processorGAMGInterface
const lduInterface& fineInterface, const lduInterface& fineInterface,
const labelField& localRestrictAddressing, const labelField& localRestrictAddressing,
const labelField& neighbourRestrictAddressing, const labelField& neighbourRestrictAddressing,
const label fineLevelIndex const label fineLevelIndex,
const label coarseComm
) )
: :
GAMGInterface GAMGInterface
@ -62,7 +63,8 @@ Foam::processorGAMGInterface::processorGAMGInterface
localRestrictAddressing, localRestrictAddressing,
neighbourRestrictAddressing neighbourRestrictAddressing
), ),
fineProcInterface_(refCast<const processorLduInterface>(fineInterface)) fineProcInterface_(refCast<const processorLduInterface>(fineInterface)),
comm_(coarseComm)
{ {
// From coarse face to coarse cell // From coarse face to coarse cell
DynamicList<label> dynFaceCells(localRestrictAddressing.size()); DynamicList<label> dynFaceCells(localRestrictAddressing.size());
@ -140,7 +142,12 @@ void Foam::processorGAMGInterface::initInternalFieldTransfer
const labelUList& iF const labelUList& iF
) const ) const
{ {
label oldWarn = UPstream::warnComm;
UPstream::warnComm = comm();
send(commsType, interfaceInternalField(iF)()); send(commsType, interfaceInternalField(iF)());
UPstream::warnComm = oldWarn;
} }
@ -150,7 +157,13 @@ Foam::tmp<Foam::labelField> Foam::processorGAMGInterface::internalFieldTransfer
const labelUList& iF const labelUList& iF
) const ) const
{ {
return receive<label>(commsType, this->size()); label oldWarn = UPstream::warnComm;
UPstream::warnComm = comm();
tmp<Field<label> > tfld(receive<label>(commsType, this->size()));
UPstream::warnComm = oldWarn;
return tfld;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -59,6 +59,9 @@ class processorGAMGInterface
// agglomerated // agglomerated
const processorLduInterface& fineProcInterface_; const processorLduInterface& fineProcInterface_;
//- Communicator to use for parallel communication
const label comm_;
// Private Member Functions // Private Member Functions
@ -85,7 +88,8 @@ public:
const lduInterface& fineInterface, const lduInterface& fineInterface,
const labelField& restrictAddressing, const labelField& restrictAddressing,
const labelField& neighbourRestrictAddressing, const labelField& neighbourRestrictAddressing,
const label fineLevelIndex const label fineLevelIndex,
const label coarseComm
); );
@ -141,7 +145,7 @@ public:
//- Return communicator used for sending //- Return communicator used for sending
virtual int comm() const virtual int comm() const
{ {
return fineProcInterface_.comm(); return comm_;
} }
}; };

View File

@ -34,6 +34,7 @@ Description
#include "lduMesh.H" #include "lduMesh.H"
#include "labelList.H" #include "labelList.H"
#include "processorLduInterface.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -112,6 +113,24 @@ public:
<< " interfaces:" << interfaces_.size() << " interfaces:" << interfaces_.size()
<< " comm:" << comm_ << " comm:" << comm_
<< endl; << endl;
forAll(interfaces_, i)
{
if (interfaces_.set(i))
{
if (isA<processorLduInterface>(interfaces_[i]))
{
const processorLduInterface& pi = refCast
<
const processorLduInterface
>(interfaces_[i]);
Pout<< " comm:" << pi.comm()
<< " myProcNo:" << pi.myProcNo()
<< " neighbProcNo:" << pi.neighbProcNo()
<< endl;
}
}
}
} }
@ -144,6 +163,24 @@ public:
<< " interfaces:" << interfaces_.size() << " interfaces:" << interfaces_.size()
<< " comm:" << comm_ << " comm:" << comm_
<< endl; << endl;
forAll(interfaces_, i)
{
if (interfaces_.set(i))
{
if (isA<processorLduInterface>(interfaces_[i]))
{
const processorLduInterface& pi = refCast
<
const processorLduInterface
>(interfaces_[i]);
Pout<< " comm:" << pi.comm()
<< " myProcNo:" << pi.myProcNo()
<< " neighbProcNo:" << pi.neighbProcNo()
<< endl;
}
}
}
} }

View File

@ -82,7 +82,13 @@ Foam::UIPstream::UIPstream
// and set it // and set it
if (!wantedSize) if (!wantedSize)
{ {
MPI_Probe(fromProcNo_, tag_, MPI_COMM_WORLD, &status); MPI_Probe
(
fromProcNo_,
tag_,
PstreamGlobals::MPICommunicators_[comm_],
&status
);
MPI_Get_count(&status, MPI_BYTE, &messageSize_); MPI_Get_count(&status, MPI_BYTE, &messageSize_);
externalBuf_.setCapacity(messageSize_); externalBuf_.setCapacity(messageSize_);
@ -171,7 +177,13 @@ Foam::UIPstream::UIPstream(const int fromProcNo, PstreamBuffers& buffers)
// and set it // and set it
if (!wantedSize) if (!wantedSize)
{ {
MPI_Probe(fromProcNo_, tag_, MPI_COMM_WORLD, &status); MPI_Probe
(
fromProcNo_,
tag_,
PstreamGlobals::MPICommunicators_[comm_],
&status
);
MPI_Get_count(&status, MPI_BYTE, &messageSize_); MPI_Get_count(&status, MPI_BYTE, &messageSize_);
externalBuf_.setCapacity(messageSize_); externalBuf_.setCapacity(messageSize_);
@ -231,6 +243,7 @@ Foam::label Foam::UIPstream::read
<< " tag:" << tag << " comm:" << communicator << " tag:" << tag << " comm:" << communicator
<< " wanted size:" << label(bufSize) << " wanted size:" << label(bufSize)
<< " commsType:" << UPstream::commsTypeNames[commsType] << " commsType:" << UPstream::commsTypeNames[commsType]
<< " warnComm:" << UPstream::warnComm
<< Foam::endl; << Foam::endl;
error::printStack(Pout); error::printStack(Pout);
} }

View File

@ -57,6 +57,7 @@ bool Foam::UOPstream::write
<< " tag:" << tag << " tag:" << tag
<< " comm:" << communicator << " size:" << label(bufSize) << " comm:" << communicator << " size:" << label(bufSize)
<< " commsType:" << UPstream::commsTypeNames[commsType] << " commsType:" << UPstream::commsTypeNames[commsType]
<< " warnComm:" << UPstream::warnComm
<< Foam::endl; << Foam::endl;
error::printStack(Pout); error::printStack(Pout);
} }

View File

@ -183,6 +183,7 @@ void Foam::reduce
if (UPstream::warnComm != -1 && communicator != UPstream::warnComm) if (UPstream::warnComm != -1 && communicator != UPstream::warnComm)
{ {
Pout<< "** reducing:" << Value << " with comm:" << communicator Pout<< "** reducing:" << Value << " with comm:" << communicator
<< " warnComm:" << UPstream::warnComm
<< endl; << endl;
error::printStack(Pout); error::printStack(Pout);
} }
@ -201,6 +202,7 @@ void Foam::reduce
if (UPstream::warnComm != -1 && communicator != UPstream::warnComm) if (UPstream::warnComm != -1 && communicator != UPstream::warnComm)
{ {
Pout<< "** reducing:" << Value << " with comm:" << communicator Pout<< "** reducing:" << Value << " with comm:" << communicator
<< " warnComm:" << UPstream::warnComm
<< endl; << endl;
error::printStack(Pout); error::printStack(Pout);
} }
@ -219,6 +221,7 @@ void Foam::reduce
if (UPstream::warnComm != -1 && communicator != UPstream::warnComm) if (UPstream::warnComm != -1 && communicator != UPstream::warnComm)
{ {
Pout<< "** reducing:" << Value << " with comm:" << communicator Pout<< "** reducing:" << Value << " with comm:" << communicator
<< " warnComm:" << UPstream::warnComm
<< endl; << endl;
error::printStack(Pout); error::printStack(Pout);
} }
@ -237,6 +240,7 @@ void Foam::sumReduce
if (UPstream::warnComm != -1 && communicator != UPstream::warnComm) if (UPstream::warnComm != -1 && communicator != UPstream::warnComm)
{ {
Pout<< "** reducing:" << Value << " with comm:" << communicator Pout<< "** reducing:" << Value << " with comm:" << communicator
<< " warnComm:" << UPstream::warnComm
<< endl; << endl;
error::printStack(Pout); error::printStack(Pout);
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -51,7 +51,8 @@ Foam::cyclicAMIGAMGInterface::cyclicAMIGAMGInterface
const lduInterface& fineInterface, const lduInterface& fineInterface,
const labelField& localRestrictAddressing, const labelField& localRestrictAddressing,
const labelField& neighbourRestrictAddressing, const labelField& neighbourRestrictAddressing,
const label fineLevelIndex const label fineLevelIndex,
const label coarseComm
) )
: :
GAMGInterface GAMGInterface

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -88,7 +88,8 @@ public:
const lduInterface& fineInterface, const lduInterface& fineInterface,
const labelField& restrictAddressing, const labelField& restrictAddressing,
const labelField& neighbourRestrictAddressing, const labelField& neighbourRestrictAddressing,
const label fineLevelIndex const label fineLevelIndex,
const label coarseComm
); );

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -38,7 +38,8 @@ Foam::regionCoupledBaseGAMGInterface::regionCoupledBaseGAMGInterface
const lduInterface& fineInterface, const lduInterface& fineInterface,
const labelField& localRestrictAddressing, const labelField& localRestrictAddressing,
const labelField& neighbourRestrictAddressing, const labelField& neighbourRestrictAddressing,
const label fineLevelIndex const label fineLevelIndex,
const label coarseComm
) )
: :
GAMGInterface GAMGInterface
@ -48,7 +49,8 @@ Foam::regionCoupledBaseGAMGInterface::regionCoupledBaseGAMGInterface
fineInterface, fineInterface,
localRestrictAddressing, localRestrictAddressing,
neighbourRestrictAddressing, neighbourRestrictAddressing,
fineLevelIndex fineLevelIndex,
coarseComm
), ),
fineRegionCoupledLduInterface_ fineRegionCoupledLduInterface_
( (

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -86,7 +86,8 @@ public:
const lduInterface& fineInterface, const lduInterface& fineInterface,
const labelField& restrictAddressing, const labelField& restrictAddressing,
const labelField& neighbourRestrictAddressing, const labelField& neighbourRestrictAddressing,
const label fineLevelIndex const label fineLevelIndex,
const label coarseComm
); );

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -49,7 +49,8 @@ Foam::regionCoupledGAMGInterface::regionCoupledGAMGInterface
const lduInterface& fineInterface, const lduInterface& fineInterface,
const labelField& localRestrictAddressing, const labelField& localRestrictAddressing,
const labelField& neighbourRestrictAddressing, const labelField& neighbourRestrictAddressing,
const label fineLevelIndex const label fineLevelIndex,
const label coarseComm
) )
: :
regionCoupledBaseGAMGInterface regionCoupledBaseGAMGInterface
@ -59,7 +60,8 @@ Foam::regionCoupledGAMGInterface::regionCoupledGAMGInterface
fineInterface, fineInterface,
localRestrictAddressing, localRestrictAddressing,
neighbourRestrictAddressing, neighbourRestrictAddressing,
fineLevelIndex fineLevelIndex,
coarseComm
) )
{} {}

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -76,7 +76,8 @@ public:
const lduInterface& fineInterface, const lduInterface& fineInterface,
const labelField& restrictAddressing, const labelField& restrictAddressing,
const labelField& neighbourRestrictAddressing, const labelField& neighbourRestrictAddressing,
const label fineLevelIndex const label fineLevelIndex,
const label coarseComm
); );

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -49,7 +49,8 @@ Foam::regionCoupledWallGAMGInterface::regionCoupledWallGAMGInterface
const lduInterface& fineInterface, const lduInterface& fineInterface,
const labelField& localRestrictAddressing, const labelField& localRestrictAddressing,
const labelField& neighbourRestrictAddressing, const labelField& neighbourRestrictAddressing,
const label fineLevelIndex const label fineLevelIndex,
const label coarseComm
) )
: :
regionCoupledBaseGAMGInterface regionCoupledBaseGAMGInterface
@ -59,7 +60,8 @@ Foam::regionCoupledWallGAMGInterface::regionCoupledWallGAMGInterface
fineInterface, fineInterface,
localRestrictAddressing, localRestrictAddressing,
neighbourRestrictAddressing, neighbourRestrictAddressing,
fineLevelIndex fineLevelIndex,
coarseComm
) )
{} {}

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -78,7 +78,8 @@ public:
const lduInterface& fineInterface, const lduInterface& fineInterface,
const labelField& restrictAddressing, const labelField& restrictAddressing,
const labelField& neighbourRestrictAddressing, const labelField& neighbourRestrictAddressing,
const label fineLevelIndex const label fineLevelIndex,
const label coarseComm
); );