Skip to content

Commit

Permalink
Merge pull request trilinos#6326 from lucbv/MueLu_aggregation_kokkos_…
Browse files Browse the repository at this point in the history
…fixes

MueLu: fixing the count of aggregated nodes in refactored Phase2a of aggregation, see trilinos#6325
  • Loading branch information
lucbv authored Nov 22, 2019
2 parents 800c07e + e1190ac commit e55a0e5
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 e55a0e5

Please sign in to comment.