Skip to content

Commit

Permalink
Merge Pull Request trilinos#7254 from cgcgcg/Trilinos/phase2
Browse files Browse the repository at this point in the history
Automatically Merged using Trilinos Pull Request AutoTester
PR Title: MueLu Phase2a:  Include root node in aggregate
PR Author: cgcgcg
  • Loading branch information
trilinos-autotester authored Apr 30, 2020
2 parents 8d02048 + c9a45cf commit be3dbb3
Show file tree
Hide file tree
Showing 286 changed files with 783 additions and 12 deletions.
9 changes: 9 additions & 0 deletions packages/muelu/doc/UsersGuide/masterList.xml
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,15 @@
<comment-ML>parameter not existing in ML</comment-ML>
</parameter>

<parameter>
<name>aggregation: phase2a include root</name>
<type>bool</type>
<default>true</default>
<description>Whether the root node should be included in the aggregates formed in phase 2a.</description>
<visible>false</visible>
<comment-ML>parameter not existing in ML</comment-ML>
</parameter>

<parameter>
<name>aggregation: error on nodes with no on-rank neighbors</name>
<type>bool</type>
Expand Down
2 changes: 2 additions & 0 deletions packages/muelu/doc/UsersGuide/paramlist_hidden.tex
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@

\cbb{aggregation: enable phase 3}{bool}{true}{Turn on/off phase 3 of aggregation}

\cbb{aggregation: phase2a include root}{bool}{true}{Whether the root node should be included in the aggregates formed in phase 2a.}

\cbb{aggregation: error on nodes with no on-rank neighbors}{bool}{false}{Causes phase 3 aggregation to throw an error for
non-Dirichlet nodes that have no on-rank neighbors. This only
works for Uncoupled Aggregation.}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ namespace MueLu {
SET_VALID_ENTRY("aggregation: preserve Dirichlet points");
SET_VALID_ENTRY("aggregation: allow user-specified singletons");
SET_VALID_ENTRY("aggregation: error on nodes with no on-rank neighbors");
SET_VALID_ENTRY("aggregation: phase2a include root");
SET_VALID_ENTRY("aggregation: phase3 avoid singletons");

// From StructuredAggregationFactory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ namespace MueLu {

int minNodesPerAggregate = params.get<int>("aggregation: min agg size");
int maxNodesPerAggregate = params.get<int>("aggregation: max agg size");
bool includeRootInAgg = params.get<bool>("aggregation: phase2a include root");

const LO numRows = graph.GetNodeNumVertices();
const int myRank = graph.GetComm()->getRank();
Expand All @@ -92,6 +93,8 @@ namespace MueLu {
continue;

aggSize = 0;
if (includeRootInAgg)
aggList[aggSize++] = rootCandidate;

ArrayView<const LocalOrdinal> neighOfINode = graph.getNeighborVertices(rootCandidate);

Expand All @@ -116,7 +119,8 @@ namespace MueLu {

// NOTE: ML uses a hardcoded value 3 instead of MinNodesPerAggregate
if (aggSize > as<size_t>(minNodesPerAggregate) &&
aggSize > factor*numNeighbors) {
((includeRootInAgg && aggSize-1 > factor*numNeighbors) ||
(!includeRootInAgg && aggSize > factor*numNeighbors))) {
// Accept new aggregate
// rootCandidate becomes the root of the newly formed aggregate
aggregates.SetIsRoot(rootCandidate);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ namespace MueLu {
{
const int minNodesPerAggregate = params.get<int>("aggregation: min agg size");
const int maxNodesPerAggregate = params.get<int>("aggregation: max agg size");
bool includeRootInAgg = params.get<bool>("aggregation: phase2a include root");

const LO numRows = graph.GetNodeNumVertices();
const int myRank = graph.GetComm()->getRank();
Expand Down Expand Up @@ -128,18 +129,16 @@ namespace MueLu {
if(aggStat(rootCandidate) == READY &&
colors(rootCandidate) == color) {

LO aggSize = 0;
LO aggSize;
if (includeRootInAgg)
aggSize = 1;
else
aggSize = 0;

auto neighbors = graph.getNeighborVertices(rootCandidate);

// 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);
Expand All @@ -155,16 +154,25 @@ 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) {
((includeRootInAgg && aggSize-1 > factor*numNeighbors) ||
(!includeRootInAgg && aggSize > factor*numNeighbors))) {

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

LO numAggregated = 0;

if (includeRootInAgg) {
// 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
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ namespace MueLu {
SET_VALID_ENTRY("aggregation: enable phase 2a");
SET_VALID_ENTRY("aggregation: enable phase 2b");
SET_VALID_ENTRY("aggregation: enable phase 3");
SET_VALID_ENTRY("aggregation: phase2a include root");
SET_VALID_ENTRY("aggregation: preserve Dirichlet points");
SET_VALID_ENTRY("aggregation: allow user-specified singletons");
SET_VALID_ENTRY("aggregation: use interface aggregation");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ namespace MueLu {
SET_VALID_ENTRY("aggregation: enable phase 2a");
SET_VALID_ENTRY("aggregation: enable phase 2b");
SET_VALID_ENTRY("aggregation: enable phase 3");
SET_VALID_ENTRY("aggregation: phase2a include root");
SET_VALID_ENTRY("aggregation: phase3 avoid singletons");
SET_VALID_ENTRY("aggregation: error on nodes with no on-rank neighbors");
SET_VALID_ENTRY("aggregation: preserve Dirichlet points");
Expand Down
3 changes: 3 additions & 0 deletions packages/muelu/src/MueCentral/MueLu_MasterList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ namespace MueLu {
"<Parameter name=\"aggregation: enable phase 2a\" type=\"bool\" value=\"true\"/>"
"<Parameter name=\"aggregation: enable phase 2b\" type=\"bool\" value=\"true\"/>"
"<Parameter name=\"aggregation: enable phase 3\" type=\"bool\" value=\"true\"/>"
"<Parameter name=\"aggregation: phase2a include root\" type=\"bool\" value=\"true\"/>"
"<Parameter name=\"aggregation: error on nodes with no on-rank neighbors\" type=\"bool\" value=\"false\"/>"
"<Parameter name=\"aggregation: phase3 avoid singletons\" type=\"bool\" value=\"false\"/>"
"<Parameter name=\"aggregation: allow empty prolongator columns\" type=\"bool\" value=\"false\"/>"
Expand Down Expand Up @@ -606,6 +607,8 @@ namespace MueLu {

("aggregation: enable phase 3","aggregation: enable phase 3")

("aggregation: phase2a include root","aggregation: phase2a include root")

("aggregation: error on nodes with no on-rank neighbors","aggregation: error on nodes with no on-rank neighbors")

("aggregation: phase3 avoid singletons","aggregation: phase3 avoid singletons")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ aggregation: enable phase 1 = 1 [default]
aggregation: enable phase 2a = 1 [default]
aggregation: enable phase 2b = 1 [default]
aggregation: enable phase 3 = 1 [default]
aggregation: phase2a include root = 1 [default]
aggregation: preserve Dirichlet points = 0 [unused]
aggregation: allow user-specified singletons = 0 [default]
aggregation: use interface aggregation = 0 [default]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ aggregation: enable phase 1 = 1 [default]
aggregation: enable phase 2a = 1 [default]
aggregation: enable phase 2b = 1 [default]
aggregation: enable phase 3 = 1 [default]
aggregation: phase2a include root = 1 [default]
aggregation: preserve Dirichlet points = 0 [unused]
aggregation: allow user-specified singletons = 0 [default]
aggregation: use interface aggregation = 0 [default]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ aggregation: enable phase 1 = 1 [default]
aggregation: enable phase 2a = 1 [default]
aggregation: enable phase 2b = 1 [default]
aggregation: enable phase 3 = 1 [default]
aggregation: phase2a include root = 1 [default]
aggregation: preserve Dirichlet points = 0 [unused]
aggregation: allow user-specified singletons = 0 [default]
aggregation: use interface aggregation = 0 [default]
Expand Down Expand Up @@ -119,6 +120,7 @@ aggregation: enable phase 1 = 1 [default]
aggregation: enable phase 2a = 1 [default]
aggregation: enable phase 2b = 1 [default]
aggregation: enable phase 3 = 1 [default]
aggregation: phase2a include root = 1 [default]
aggregation: preserve Dirichlet points = 0 [unused]
aggregation: allow user-specified singletons = 0 [default]
aggregation: use interface aggregation = 0 [default]
Expand Down Expand Up @@ -203,6 +205,7 @@ aggregation: enable phase 1 = 1 [default]
aggregation: enable phase 2a = 1 [default]
aggregation: enable phase 2b = 1 [default]
aggregation: enable phase 3 = 1 [default]
aggregation: phase2a include root = 1 [default]
aggregation: preserve Dirichlet points = 0 [unused]
aggregation: allow user-specified singletons = 0 [default]
aggregation: use interface aggregation = 0 [default]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ aggregation: enable phase 1 = 1 [default]
aggregation: enable phase 2a = 1 [default]
aggregation: enable phase 2b = 1 [default]
aggregation: enable phase 3 = 1 [default]
aggregation: phase2a include root = 1 [default]
aggregation: preserve Dirichlet points = 0 [unused]
aggregation: allow user-specified singletons = 0 [default]
aggregation: use interface aggregation = 0 [default]
Expand Down Expand Up @@ -145,6 +146,7 @@ aggregation: enable phase 1 = 1 [default]
aggregation: enable phase 2a = 1 [default]
aggregation: enable phase 2b = 1 [default]
aggregation: enable phase 3 = 1 [default]
aggregation: phase2a include root = 1 [default]
aggregation: preserve Dirichlet points = 0 [unused]
aggregation: allow user-specified singletons = 0 [default]
aggregation: use interface aggregation = 0 [default]
Expand Down Expand Up @@ -242,6 +244,7 @@ aggregation: enable phase 1 = 1 [default]
aggregation: enable phase 2a = 1 [default]
aggregation: enable phase 2b = 1 [default]
aggregation: enable phase 3 = 1 [default]
aggregation: phase2a include root = 1 [default]
aggregation: preserve Dirichlet points = 0 [unused]
aggregation: allow user-specified singletons = 0 [default]
aggregation: use interface aggregation = 0 [default]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ aggregation: enable phase 1 = 1 [default]
aggregation: enable phase 2a = 1 [default]
aggregation: enable phase 2b = 1 [default]
aggregation: enable phase 3 = 1 [default]
aggregation: phase2a include root = 1 [default]
aggregation: preserve Dirichlet points = 0 [default]
aggregation: allow user-specified singletons = 0 [default]
aggregation: use interface aggregation = 0 [default]
Expand Down Expand Up @@ -132,6 +133,7 @@ aggregation: enable phase 1 = 1 [default]
aggregation: enable phase 2a = 1 [default]
aggregation: enable phase 2b = 1 [default]
aggregation: enable phase 3 = 1 [default]
aggregation: phase2a include root = 1 [default]
aggregation: preserve Dirichlet points = 0 [default]
aggregation: allow user-specified singletons = 0 [default]
aggregation: use interface aggregation = 0 [default]
Expand Down Expand Up @@ -221,6 +223,7 @@ aggregation: enable phase 1 = 1 [default]
aggregation: enable phase 2a = 1 [default]
aggregation: enable phase 2b = 1 [default]
aggregation: enable phase 3 = 1 [default]
aggregation: phase2a include root = 1 [default]
aggregation: preserve Dirichlet points = 0 [default]
aggregation: allow user-specified singletons = 0 [default]
aggregation: use interface aggregation = 0 [default]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ aggregation: enable phase 1 = 1 [default]
aggregation: enable phase 2a = 1 [default]
aggregation: enable phase 2b = 1 [default]
aggregation: enable phase 3 = 1 [default]
aggregation: phase2a include root = 1 [default]
aggregation: preserve Dirichlet points = 0 [unused]
aggregation: allow user-specified singletons = 0 [default]
aggregation: use interface aggregation = 0 [default]
Expand Down Expand Up @@ -119,6 +120,7 @@ aggregation: enable phase 1 = 1 [default]
aggregation: enable phase 2a = 1 [default]
aggregation: enable phase 2b = 1 [default]
aggregation: enable phase 3 = 1 [default]
aggregation: phase2a include root = 1 [default]
aggregation: preserve Dirichlet points = 0 [unused]
aggregation: allow user-specified singletons = 0 [default]
aggregation: use interface aggregation = 0 [default]
Expand Down Expand Up @@ -203,6 +205,7 @@ aggregation: enable phase 1 = 1 [default]
aggregation: enable phase 2a = 1 [default]
aggregation: enable phase 2b = 1 [default]
aggregation: enable phase 3 = 1 [default]
aggregation: phase2a include root = 1 [default]
aggregation: preserve Dirichlet points = 0 [unused]
aggregation: allow user-specified singletons = 0 [default]
aggregation: use interface aggregation = 0 [default]
Expand Down Expand Up @@ -287,6 +290,7 @@ aggregation: enable phase 1 = 1 [default]
aggregation: enable phase 2a = 1 [default]
aggregation: enable phase 2b = 1 [default]
aggregation: enable phase 3 = 1 [default]
aggregation: phase2a include root = 1 [default]
aggregation: preserve Dirichlet points = 0 [unused]
aggregation: allow user-specified singletons = 0 [default]
aggregation: use interface aggregation = 0 [default]
Expand Down Expand Up @@ -371,6 +375,7 @@ aggregation: enable phase 1 = 1 [default]
aggregation: enable phase 2a = 1 [default]
aggregation: enable phase 2b = 1 [default]
aggregation: enable phase 3 = 1 [default]
aggregation: phase2a include root = 1 [default]
aggregation: preserve Dirichlet points = 0 [unused]
aggregation: allow user-specified singletons = 0 [default]
aggregation: use interface aggregation = 0 [default]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ aggregation: enable phase 1 = 1 [default]
aggregation: enable phase 2a = 1 [default]
aggregation: enable phase 2b = 1 [default]
aggregation: enable phase 3 = 1 [default]
aggregation: phase2a include root = 1 [default]
aggregation: preserve Dirichlet points = 0 [unused]
aggregation: allow user-specified singletons = 0 [default]
aggregation: use interface aggregation = 0 [default]
Expand Down Expand Up @@ -145,6 +146,7 @@ aggregation: enable phase 1 = 1 [default]
aggregation: enable phase 2a = 1 [default]
aggregation: enable phase 2b = 1 [default]
aggregation: enable phase 3 = 1 [default]
aggregation: phase2a include root = 1 [default]
aggregation: preserve Dirichlet points = 0 [unused]
aggregation: allow user-specified singletons = 0 [default]
aggregation: use interface aggregation = 0 [default]
Expand Down Expand Up @@ -242,6 +244,7 @@ aggregation: enable phase 1 = 1 [default]
aggregation: enable phase 2a = 1 [default]
aggregation: enable phase 2b = 1 [default]
aggregation: enable phase 3 = 1 [default]
aggregation: phase2a include root = 1 [default]
aggregation: preserve Dirichlet points = 0 [unused]
aggregation: allow user-specified singletons = 0 [default]
aggregation: use interface aggregation = 0 [default]
Expand Down Expand Up @@ -339,6 +342,7 @@ aggregation: enable phase 1 = 1 [default]
aggregation: enable phase 2a = 1 [default]
aggregation: enable phase 2b = 1 [default]
aggregation: enable phase 3 = 1 [default]
aggregation: phase2a include root = 1 [default]
aggregation: preserve Dirichlet points = 0 [unused]
aggregation: allow user-specified singletons = 0 [default]
aggregation: use interface aggregation = 0 [default]
Expand Down Expand Up @@ -436,6 +440,7 @@ aggregation: enable phase 1 = 1 [default]
aggregation: enable phase 2a = 1 [default]
aggregation: enable phase 2b = 1 [default]
aggregation: enable phase 3 = 1 [default]
aggregation: phase2a include root = 1 [default]
aggregation: preserve Dirichlet points = 0 [unused]
aggregation: allow user-specified singletons = 0 [default]
aggregation: use interface aggregation = 0 [default]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ aggregation: enable phase 1 = 1 [default]
aggregation: enable phase 2a = 1 [default]
aggregation: enable phase 2b = 1 [default]
aggregation: enable phase 3 = 1 [default]
aggregation: phase2a include root = 1 [default]
aggregation: preserve Dirichlet points = 0 [default]
aggregation: allow user-specified singletons = 0 [default]
aggregation: use interface aggregation = 0 [default]
Expand Down Expand Up @@ -132,6 +133,7 @@ aggregation: enable phase 1 = 1 [default]
aggregation: enable phase 2a = 1 [default]
aggregation: enable phase 2b = 1 [default]
aggregation: enable phase 3 = 1 [default]
aggregation: phase2a include root = 1 [default]
aggregation: preserve Dirichlet points = 0 [default]
aggregation: allow user-specified singletons = 0 [default]
aggregation: use interface aggregation = 0 [default]
Expand Down Expand Up @@ -221,6 +223,7 @@ aggregation: enable phase 1 = 1 [default]
aggregation: enable phase 2a = 1 [default]
aggregation: enable phase 2b = 1 [default]
aggregation: enable phase 3 = 1 [default]
aggregation: phase2a include root = 1 [default]
aggregation: preserve Dirichlet points = 0 [default]
aggregation: allow user-specified singletons = 0 [default]
aggregation: use interface aggregation = 0 [default]
Expand Down Expand Up @@ -310,6 +313,7 @@ aggregation: enable phase 1 = 1 [default]
aggregation: enable phase 2a = 1 [default]
aggregation: enable phase 2b = 1 [default]
aggregation: enable phase 3 = 1 [default]
aggregation: phase2a include root = 1 [default]
aggregation: preserve Dirichlet points = 0 [default]
aggregation: allow user-specified singletons = 0 [default]
aggregation: use interface aggregation = 0 [default]
Expand Down Expand Up @@ -399,6 +403,7 @@ aggregation: enable phase 1 = 1 [default]
aggregation: enable phase 2a = 1 [default]
aggregation: enable phase 2b = 1 [default]
aggregation: enable phase 3 = 1 [default]
aggregation: phase2a include root = 1 [default]
aggregation: preserve Dirichlet points = 0 [default]
aggregation: allow user-specified singletons = 0 [default]
aggregation: use interface aggregation = 0 [default]
Expand Down
Loading

0 comments on commit be3dbb3

Please sign in to comment.