Skip to content

Commit

Permalink
MueLu: fixing the count of aggregated nodes in refactored Phase2a of …
Browse files Browse the repository at this point in the history
…aggregation, see #6325

1) A piece of logic is wrong in the algorithms that counts
how many nodes have been aggregated in Phase2a of aggregation.
This commit fixes that by individually counting every node
that is being aggregated instead of counting all the nodes in
a newly formed aggregate, at once.

2) Currently if a tentative aggregate becomes larger than maxNodesPerAggregate
it is completely ignored. Now a partial aggregate will be formed instead.
  • Loading branch information
lucbv committed Nov 22, 2019
1 parent c5c6883 commit e1190ac
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,20 @@ namespace MueLu {

// Loop over neighbors to count how many nodes could join
// the new aggregate
// Note on 2019-11-22, LBV:
// The rootCandidate is not taken into account and in fact
// not aggregatesd later on. To change that we want to
// modify:
// if(aggSize < maxNodesPerAggregate)
// to:
// if(aggSize < maxNodesPerAggregate - 1)
LO numNeighbors = 0;
for(int j = 0; j < neighbors.length; ++j) {
LO neigh = neighbors(j);
if(neigh != rootCandidate) {
if(graph.isLocalNeighborVertex(neigh) &&
aggStat(neigh) == READY &&
aggSize < maxNodesPerAggregate) {
// aggList(aggSize) = neigh;
(aggStat(neigh) == READY) &&
(aggSize < maxNodesPerAggregate)) {
++aggSize;
}
++numNeighbors;
Expand All @@ -152,26 +158,31 @@ namespace MueLu {

// If a sufficient number of nodes can join the new aggregate
// then we actually create the aggregate.
// Note on 2019-11-22, LBV:
// Same changes as described in the note above could be applied
if(aggSize > minNodesPerAggregate &&
aggSize > factor*numNeighbors) {

// aggregates.SetIsRoot(rootCandidate);
LO aggIndex = Kokkos::
atomic_fetch_add(&numLocalAggregates(), 1);

for(int j = 0; j < neighbors.length; ++j) {
LO neigh = neighbors(j);
LO numAggregated = 0;
for(int neighIdx = 0; neighIdx < neighbors.length; ++neighIdx) {
LO neigh = neighbors(neighIdx);
if(neigh != rootCandidate) {
if(graph.isLocalNeighborVertex(neigh) &&
aggStat(neigh) == READY &&
aggSize < maxNodesPerAggregate) {
aggStat(neigh) = AGGREGATED;
(aggStat(neigh) == READY) &&
(numAggregated < aggSize)) {
aggStat(neigh) = AGGREGATED;
vertex2AggId(neigh, 0) = aggIndex;
procWinner(neigh, 0) = myRank;

++numAggregated;
--lNumNonAggregatedNodes;
}
}
}
lNumNonAggregatedNodes -= aggSize;
}
}
}, tmpNumNonAggregatedNodes);
Expand Down
10 changes: 10 additions & 0 deletions packages/muelu/test/interface/ParameterListInterpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,16 @@ int main_(Teuchos::CommandLineProcessor &clp, Xpetra::UnderlyingLib& lib, int ar
stringToReplace = "Smoother complexity = " + floatRegex;
replacementString = "Smoother complexity = <ignored>";
run_sed("'s/" + stringToReplace + "/" + replacementString + "/'", baseFile);

// Finally ignore the Chebyshev eigen value ratio which varies with aggregation
stringToReplace = "chebyshev: ratio eigenvalue = " + floatRegex;
replacementString = "chebyshev: ratio eigenvalue = <ignored>";
run_sed("'s/" + stringToReplace + "/" + replacementString + "/'", baseFile);

// as well as the alpha paramter it sets
stringToReplace = "lambdaMax = <ignored>, alpha: " + floatRegex + ", lambdaMin = <ignored>,";
replacementString = "lambdaMax = <ignored>, alpha: <ignored>, lambdaMin = <ignored>,";
run_sed("'s/" + stringToReplace + "/" + replacementString + "/'", baseFile);
}

// Run comparison (ignoring whitespaces)
Expand Down

0 comments on commit e1190ac

Please sign in to comment.