Commit 7cd9f823 authored by mattijs's avatar mattijs
Browse files

ENH: non-blocking for all transfers to master.

parent 827d7d7a
......@@ -110,30 +110,40 @@ void writeAllData
{
if (nPrims)
{
PstreamBuffers pBufs(Pstream::nonBlocking);
if (!Pstream::master())
{
UOPstream toMaster(Pstream::masterNo(), pBufs);
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
toMaster<< map(vf, prims, cmpt);
}
}
pBufs.finishedSends();
if (Pstream::master())
{
ensightFile << key << nl;
PtrList<UIPstream> fromSlaves(Pstream::nProcs());
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
fromSlaves.set(slave, new UIPstream(slave, pBufs));
}
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
writeData(map(vf, prims, cmpt), ensightFile);
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
IPstream fromSlave(Pstream::scheduled, slave);
scalarField data(fromSlave);
scalarField data(fromSlaves[slave]);
writeData(data, ensightFile);
}
}
}
else
{
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster<< map(vf, prims, cmpt);
}
}
}
}
......@@ -150,30 +160,40 @@ void writeAllDataBinary
{
if (nPrims)
{
PstreamBuffers pBufs(Pstream::nonBlocking);
if (!Pstream::master())
{
UOPstream toMaster(Pstream::masterNo(), pBufs);
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
toMaster<< map(vf, prims, cmpt);
}
}
pBufs.finishedSends();
if (Pstream::master())
{
writeEnsDataBinary(key,ensightFile);
PtrList<UIPstream> fromSlaves(Pstream::nProcs());
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
fromSlaves.set(slave, new UIPstream(slave, pBufs));
}
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
writeEnsDataBinary(map(vf, prims, cmpt), ensightFile);
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
IPstream fromSlave(Pstream::scheduled, slave);
scalarField data(fromSlave);
scalarField data(fromSlaves[slave]);
writeEnsDataBinary(data, ensightFile);
}
}
}
else
{
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster<< map(vf, prims, cmpt);
}
}
}
}
......@@ -190,31 +210,40 @@ void writeAllFaceData
{
if (nPrims)
{
PstreamBuffers pBufs(Pstream::nonBlocking);
if (!Pstream::master())
{
UOPstream toMaster(Pstream::masterNo(), pBufs);
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
toMaster<< map(pf, prims, cmpt);
}
}
pBufs.finishedSends();
if (Pstream::master())
{
ensightFile << key << nl;
PtrList<UIPstream> fromSlaves(Pstream::nProcs());
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
fromSlaves.set(slave, new UIPstream(slave, pBufs));
}
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
writeData(map(pf, prims, cmpt), ensightFile);
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
IPstream fromSlave(Pstream::scheduled, slave);
scalarField pf(fromSlave);
scalarField pf(fromSlaves[slave]);
writeData(pf, ensightFile);
}
}
}
else
{
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster<< map(pf, prims, cmpt);
}
}
}
}
......@@ -231,31 +260,40 @@ void writeAllFaceDataBinary
{
if (nPrims)
{
PstreamBuffers pBufs(Pstream::nonBlocking);
if (!Pstream::master())
{
UOPstream toMaster(Pstream::masterNo(), pBufs);
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
toMaster<< map(pf, prims, cmpt);
}
}
pBufs.finishedSends();
if (Pstream::master())
{
writeEnsDataBinary(key,ensightFile);
PtrList<UIPstream> fromSlaves(Pstream::nProcs());
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
fromSlaves.set(slave, new UIPstream(slave, pBufs));
}
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
writeEnsDataBinary(map(pf, prims, cmpt), ensightFile);
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
IPstream fromSlave(Pstream::scheduled, slave);
scalarField pf(fromSlave);
scalarField pf(fromSlaves[slave]);
writeEnsDataBinary(pf, ensightFile);
}
}
}
else
{
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster<< map(pf, prims, cmpt);
}
}
}
}
......@@ -554,10 +592,29 @@ void ensightFieldAscii
if (meshCellSets.nHexesWedges)
{
PstreamBuffers pBufs(Pstream::nonBlocking);
if (!Pstream::master())
{
UOPstream toMaster(Pstream::masterNo(), pBufs);
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
toMaster<< map(vf, hexes, wedges, cmpt);
}
}
pBufs.finishedSends();
if (Pstream::master())
{
ensightFile << "hexa8" << nl;
PtrList<UIPstream> fromSlaves(Pstream::nProcs());
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
fromSlaves.set(slave, new UIPstream(slave, pBufs));
}
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
writeData
......@@ -568,20 +625,11 @@ void ensightFieldAscii
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
IPstream fromSlave(Pstream::scheduled, slave);
scalarField data(fromSlave);
scalarField data(fromSlaves[slave]);
writeData(data, ensightFile);
}
}
}
else
{
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster<< map(vf, hexes, wedges, cmpt);
}
}
}
writeAllData("penta6", vf, prisms, meshCellSets.nPrisms, ensightFile);
......@@ -695,10 +743,29 @@ void ensightFieldBinary
if (meshCellSets.nHexesWedges)
{
PstreamBuffers pBufs(Pstream::nonBlocking);
if (!Pstream::master())
{
UOPstream toMaster(Pstream::masterNo(), pBufs);
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
toMaster<< map(vf, hexes, wedges, cmpt);
}
}
pBufs.finishedSends();
if (Pstream::master())
{
writeEnsDataBinary("hexa8",ensightFile);
PtrList<UIPstream> fromSlaves(Pstream::nProcs());
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
fromSlaves.set(slave, new UIPstream(slave, pBufs));
}
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
writeEnsDataBinary
......@@ -709,20 +776,11 @@ void ensightFieldBinary
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
IPstream fromSlave(Pstream::scheduled, slave);
scalarField data(fromSlave);
scalarField data(fromSlaves[slave]);
writeEnsDataBinary(data, ensightFile);
}
}
}
else
{
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster<< map(vf, hexes, wedges, cmpt);
}
}
}
writeAllDataBinary
......
Supports Markdown
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