Skip to content

Commit

Permalink
MueLu Phase2a: Include root node in aggregate
Browse files Browse the repository at this point in the history
  • Loading branch information
cgcgcg committed Apr 24, 2020
1 parent f3005a4 commit e9cb5cc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ namespace MueLu {
// to count all aggregated neighbour nodes for the aggregation criteria
// NOTE: We check here for the maximum aggregation size. If we would do it below
// with all the other check too big aggregates would not be accepted at all.
if (aggSize < as<size_t>(maxNodesPerAggregate))
if (aggSize < as<size_t>(maxNodesPerAggregate-1))
aggList[aggSize++] = neigh;
}

Expand All @@ -122,13 +122,17 @@ namespace MueLu {
aggregates.SetIsRoot(rootCandidate);
aggIndex = numLocalAggregates++;

// Add the root.
aggStat [rootCandidate] = AGGREGATED;
vertex2AggId[rootCandidate] = aggIndex;
procWinner [rootCandidate] = myRank;
for (size_t k = 0; k < aggSize; k++) {
aggStat [aggList[k]] = AGGREGATED;
vertex2AggId[aggList[k]] = aggIndex;
procWinner [aggList[k]] = myRank;
}

numNonAggregatedNodes -= aggSize;
numNonAggregatedNodes -= aggSize+1;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,20 +133,13 @@ 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)) {
(aggSize < maxNodesPerAggregate-1)) {
++aggSize;
}
++numNeighbors;
Expand All @@ -155,8 +148,6 @@ 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) {

Expand All @@ -165,6 +156,14 @@ namespace MueLu {
atomic_fetch_add(&numLocalAggregates(), 1);

LO numAggregated = 0;

// Add the root.
aggStat(rootCandidate) = AGGREGATED;
vertex2AggId(rootCandidate, 0) = aggIndex;
procWinner(rootCandidate, 0) = myRank;
++numAggregated;
--lNumNonAggregatedNodes;

for(int neighIdx = 0; neighIdx < neighbors.length; ++neighIdx) {
LO neigh = neighbors(neighIdx);
if(neigh != rootCandidate) {
Expand Down

0 comments on commit e9cb5cc

Please sign in to comment.