CONTRIBUTION: Parallel: optimisation of exchange. See #1268.
- Enhancements provided by Y. Inoue at RIST (http://www.hpci-office.jp) - Use allToAll to only swap local data (excludes master processor; saves memory) - Memory saving is noticeable >= 4000 cores
This commit is contained in:
parent
606ef0dbde
commit
887236a155
@ -1913,11 +1913,9 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
|
|||||||
// Find out schedule
|
// Find out schedule
|
||||||
// ~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
labelListList nSendCells(Pstream::nProcs());
|
labelList nSendCells(countCells(distribution));
|
||||||
nSendCells[Pstream::myProcNo()] = countCells(distribution);
|
labelList nRevcCells(Pstream::nProcs());
|
||||||
Pstream::gatherList(nSendCells);
|
Pstream::allToAll(nSendCells, nRevcCells);
|
||||||
Pstream::scatterList(nSendCells);
|
|
||||||
|
|
||||||
|
|
||||||
// Allocate buffers
|
// Allocate buffers
|
||||||
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
|
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
|
||||||
@ -1929,13 +1927,9 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
|
|||||||
bool oldParRun = UPstream::parRun();
|
bool oldParRun = UPstream::parRun();
|
||||||
UPstream::parRun() = false;
|
UPstream::parRun() = false;
|
||||||
|
|
||||||
forAll(nSendCells[Pstream::myProcNo()], recvProc)
|
forAll(nSendCells, recvProc)
|
||||||
{
|
{
|
||||||
if
|
if (recvProc != Pstream::myProcNo() && nSendCells[recvProc] > 0)
|
||||||
(
|
|
||||||
recvProc != Pstream::myProcNo()
|
|
||||||
&& nSendCells[Pstream::myProcNo()][recvProc] > 0
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
// Send to recvProc
|
// Send to recvProc
|
||||||
|
|
||||||
@ -1944,7 +1938,7 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
|
|||||||
Pout<< nl
|
Pout<< nl
|
||||||
<< "SUBSETTING FOR DOMAIN " << recvProc
|
<< "SUBSETTING FOR DOMAIN " << recvProc
|
||||||
<< " cells to send:"
|
<< " cells to send:"
|
||||||
<< nSendCells[Pstream::myProcNo()][recvProc]
|
<< nSendCells[recvProc]
|
||||||
<< nl << endl;
|
<< nl << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2261,21 +2255,17 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
|
|||||||
oldParRun = UPstream::parRun();
|
oldParRun = UPstream::parRun();
|
||||||
UPstream::parRun() = false;
|
UPstream::parRun() = false;
|
||||||
|
|
||||||
forAll(nSendCells, sendProc)
|
forAll(nRevcCells, sendProc)
|
||||||
{
|
{
|
||||||
// Did processor sendProc send anything to me?
|
// Did processor sendProc send anything to me?
|
||||||
if
|
if (sendProc != Pstream::myProcNo() && nRevcCells[sendProc] > 0)
|
||||||
(
|
|
||||||
sendProc != Pstream::myProcNo()
|
|
||||||
&& nSendCells[sendProc][Pstream::myProcNo()] > 0
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Pout<< nl
|
Pout<< nl
|
||||||
<< "RECEIVING FROM DOMAIN " << sendProc
|
<< "RECEIVING FROM DOMAIN " << sendProc
|
||||||
<< " cells to receive:"
|
<< " cells to receive:"
|
||||||
<< nSendCells[sendProc][Pstream::myProcNo()]
|
<< nRevcCells[sendProc]
|
||||||
<< nl << endl;
|
<< nl << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user