Commit fd574ac4 authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

Fixed bug in parallelization when senddofs and recvdofs are empty for some ranks.

parent 2e22f957
...@@ -352,11 +352,11 @@ namespace AMDiS { ...@@ -352,11 +352,11 @@ namespace AMDiS {
if (feSpace != NULL) { if (feSpace != NULL) {
vector<FiniteElemSpace*> feSpaces = probStat->getFeSpaces(); vector<FiniteElemSpace*> feSpaces = probStat->getFeSpaces();
for (unsigned int i = 0; i < feSpaces.size(); i++) { for (unsigned int i = 0; i < feSpaces.size(); i++) {
MSG("MESH %p <-> %p BF %p <-> %p\n", // MSG("MESH %p <-> %p BF %p <-> %p\n",
feSpace->getMesh(), // feSpace->getMesh(),
feSpaces[i]->getMesh(), // feSpaces[i]->getMesh(),
feSpace->getBasisFcts(), // feSpace->getBasisFcts(),
feSpaces[i]->getBasisFcts()); // feSpaces[i]->getBasisFcts());
TEST_EXIT(feSpace == feSpaces[i]) TEST_EXIT(feSpace == feSpaces[i])
("Parallelizaton is not supported for multiple FE spaces!\n"); ("Parallelizaton is not supported for multiple FE spaces!\n");
} }
...@@ -906,6 +906,7 @@ namespace AMDiS { ...@@ -906,6 +906,7 @@ namespace AMDiS {
stdMpi.send(sendCodes); stdMpi.send(sendCodes);
for (RankToBoundMap::iterator it = allBound.begin(); it != allBound.end(); ++it) for (RankToBoundMap::iterator it = allBound.begin(); it != allBound.end(); ++it)
stdMpi.recv(it->first); stdMpi.recv(it->first);
stdMpi.startCommunication(); stdMpi.startCommunication();
// === Compare received mesh structure codes. === // === Compare received mesh structure codes. ===
...@@ -1779,6 +1780,29 @@ namespace AMDiS { ...@@ -1779,6 +1780,29 @@ namespace AMDiS {
it->rankObj.el->getAllDofs(feSpace, it->rankObj, it->rankObj.el->getAllDofs(feSpace, it->rankObj,
recvDofs[it.getRank()]); recvDofs[it.getRank()]);
} }
// === Delete all empty DOF send and recv positions ===
{
RankToDofContainer::iterator it = sendDofs.begin();
while (it != sendDofs.end()) {
if (it->second.size() == 0)
sendDofs.erase(it++);
else
++it;
}
}
{
RankToDofContainer::iterator it = recvDofs.begin();
while (it != recvDofs.end()) {
if (it->second.size() == 0)
recvDofs.erase(it++);
else
++it;
}
}
} }
...@@ -1855,12 +1879,14 @@ namespace AMDiS { ...@@ -1855,12 +1879,14 @@ namespace AMDiS {
StdMpi<vector<DegreeOfFreedom> > stdMpi(mpiComm, false); StdMpi<vector<DegreeOfFreedom> > stdMpi(mpiComm, false);
for (RankToDofContainer::iterator sendIt = sendDofs.begin(); for (RankToDofContainer::iterator sendIt = sendDofs.begin();
sendIt != sendDofs.end(); ++sendIt) { sendIt != sendDofs.end(); ++sendIt) {
stdMpi.getSendData(sendIt->first).resize(0); stdMpi.getSendData(sendIt->first).resize(0);
stdMpi.getSendData(sendIt->first).reserve(sendIt->second.size()); stdMpi.getSendData(sendIt->first).reserve(sendIt->second.size());
for (DofContainer::iterator dofIt = sendIt->second.begin(); for (DofContainer::iterator dofIt = sendIt->second.begin();
dofIt != sendIt->second.end(); ++dofIt) dofIt != sendIt->second.end(); ++dofIt)
stdMpi.getSendData(sendIt->first).push_back(rankDofsNewGlobalIndex[*dofIt]); stdMpi.getSendData(sendIt->first).push_back(rankDofsNewGlobalIndex[*dofIt]);
} }
stdMpi.updateSendDataSize(); stdMpi.updateSendDataSize();
stdMpi.recv(recvDofs); stdMpi.recv(recvDofs);
stdMpi.startCommunication(); stdMpi.startCommunication();
......
...@@ -728,7 +728,7 @@ namespace AMDiS { ...@@ -728,7 +728,7 @@ namespace AMDiS {
int tmp = 0; int tmp = 0;
Parameters::get("parallel->debug->print boundary info", tmp); Parameters::get("parallel->debug->print boundary info", tmp);
if (tmp <= 1) if (tmp <= 0)
return; return;
for (InteriorBoundary::iterator it(pdb.myIntBoundary); !it.end(); ++it) { for (InteriorBoundary::iterator it(pdb.myIntBoundary); !it.end(); ++it) {
......
...@@ -318,7 +318,7 @@ namespace AMDiS { ...@@ -318,7 +318,7 @@ namespace AMDiS {
{ {
for (typename map<int, SendT>::iterator it = sendData.begin(); for (typename map<int, SendT>::iterator it = sendData.begin();
it != sendData.end(); ++it) it != sendData.end(); ++it)
sendDataSize[it->first] = StdMpiHelper<SendT>::getBufferSize(it->second); sendDataSize[it->first] = StdMpiHelper<SendT>::getBufferSize(it->second);
} }
......
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