Skip to content
Snippets Groups Projects

Matrix loadbalance to more

Merged Markus Blatt requested to merge markus.blatt/dune-istl:matrix-loadbalance-to-more into master
+ 21
16
Compare changes
  • Side-by-side
  • Inline
+ 21
16
@@ -404,26 +404,17 @@ namespace Dune
int i=0;
int j=0;
std::vector<int> domain(nparts);
std::vector<int> assigned(npes);
// init
for (i=0; i<nparts; i++) {
domainMapping[i] = -1;
domain[i] = 0;
}
for (i=0; i<npes; i++) {
assigned[i] = -0;
}
std::vector<int> domain(nparts, 0);
std::vector<int> assigned(npes, 0);
// init domain Mapping
domainMapping.assign(domainMapping.size(), -1);
// count the occurance of domains
for (i=0; i<numOfOwnVtx; i++) {
domain[part[i]]++;
}
int *domainMatrix = new int[npes * nparts];
// init
for(i=0; i<npes*nparts; i++) {
domainMatrix[i]=-1;
}
std::vector<int> domainMatrix(npes * nparts, -1);
// init buffer with the own domain
int *buf = new int[nparts];
@@ -451,6 +442,8 @@ namespace Dune
// particular domain is selected to choose it's favorate domain
int maxOccurance = 0;
pe = -1;
std::set<std::size_t> unassigned;
for(i=0; i<nparts; i++) {
for(j=0; j<npes; j++) {
// process has no domain assigned
@@ -472,11 +465,23 @@ namespace Dune
}
pe = -1;
}
else
{
unassigned.insert(i);
}
maxOccurance = 0;
}
delete[] domainMatrix;
typename std::vector<int>::iterator next_free = assigned.begin();
for(typename std::set<std::size_t>::iterator domain = unassigned.begin(),
end = unassigned.end(); domain != end; ++domain)
{
next_free = std::find_if(next_free, assigned.end(), std::bind2nd(std::less<int>(), 1));
assert(next_free != assigned.end());
domainMapping[*domain] = next_free-assigned.begin();
*next_free = 1;
}
}
struct SortFirst
Loading