Skip to content

Commit

Permalink
MueLu: refactor of Dirichlet conditions handling and changes in Uncou…
Browse files Browse the repository at this point in the history
…pledAggregation see issue trilinos#6269

Three main changes are made in this commit:
    1. the Dirichlet phase of aggregation is refactored and associted
    utilities in UncoupledAggregation are refactored using Kokkos.
    A related bug in AggregationPhase1_kokkos is fixed.

    2. the default behavior of UncoupledAggregation is changed.
    The BuildSerialAggregates method is removed from Phase 1
    which means that now aggregation will always be performed in
    parallel and on device if possible. It simplifies slightly the
    input parameters for aggregation.

    3. some preparations are made to change the coloring
    algorithm selection for UncoupledAggregation, ultiately it
    is desireable to run with something else than the host serial
    implementation of distance 2 coloring but more tests with the
    different coloring algorithms will be needed first.
  • Loading branch information
lucbv committed Nov 20, 2019
1 parent 91fe8e3 commit f8614f7
Show file tree
Hide file tree
Showing 11 changed files with 425 additions and 484 deletions.
6 changes: 3 additions & 3 deletions packages/muelu/doc/UsersGuide/masterList.xml
Original file line number Diff line number Diff line change
Expand Up @@ -462,10 +462,10 @@
</parameter>

<parameter>
<name>aggregation: phase 1 algorithm</name>
<name>aggregation: coloring algorithm</name>
<type>string</type>
<default>Serial</default>
<description>Choice of algorithm for aggregation phase 1.</description>
<default>default</default>
<description>Choice of distance 2 coloring algorithm used by Uncoupled Aggregation. Currently always set to COLORING_D2_SERIAL.</description>
<comment-ML>parameter not existing in ML</comment-ML>
</parameter>

Expand Down
2 changes: 1 addition & 1 deletion packages/muelu/doc/UsersGuide/options_aggregation.tex
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

\cbb{aggregation: deterministic}{bool}{false}{Boolean indicating whether or not aggregation will be run deterministically in the kokkos refactored path (only used in uncoupled aggregation).}

\cbb{aggregation: phase 1 algorithm}{string}{Serial}{Choice of algorithm for aggregation phase 1.}
\cbb{aggregation: coloring algorithm}{string}{default}{Choice of distance 2 coloring algorithm used by Uncoupled Aggregation. Currently always set to COLORING_D2_SERIAL.}

\cbb{aggregation: export visualization data}{bool}{false}{Export data for visualization post-processing.}

Expand Down
2 changes: 1 addition & 1 deletion packages/muelu/doc/UsersGuide/paramlist.tex
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@

\cbb{aggregation: deterministic}{bool}{false}{Boolean indicating whether or not aggregation will be run deterministically in the kokkos refactored path (only used in uncoupled aggregation).}

\cbb{aggregation: phase 1 algorithm}{string}{Serial}{Choice of algorithm for aggregation phase 1.}
\cbb{aggregation: coloring algorithm}{string}{default}{Choice of distance 2 coloring algorithm used by Uncoupled Aggregation. Currently always set to COLORING_D2_SERIAL.}

\cbb{aggregation: export visualization data}{bool}{false}{Export data for visualization post-processing.}

Expand Down
2 changes: 1 addition & 1 deletion packages/muelu/doc/UsersGuide/paramlist_hidden.tex
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@

\cbb{aggregation: deterministic}{bool}{false}{Boolean indicating whether or not aggregation will be run deterministically in the kokkos refactored path (only used in uncoupled aggregation).}

\cbb{aggregation: phase 1 algorithm}{string}{Serial}{Choice of algorithm for aggregation phase 1.}
\cbb{aggregation: coloring algorithm}{string}{default}{Choice of distance 2 coloring algorithm used by Uncoupled Aggregation. Currently always set to COLORING_D2_SERIAL.}

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,11 @@ namespace MueLu {
Kokkos::View<unsigned*, memory_space>& aggStat,
LO& numNonAggregatedNodes) const;

void BuildAggregatesSerial(const LWGraph_kokkos& graph, Aggregates_kokkos& aggregates,
std::vector<unsigned>& aggStat, LO& numNonAggregatedNodes,
LO minNodesPerAggregate, LO maxNodesPerAggregate,
LO maxNeighAlreadySelected, std::string& orderingStr) const;

void BuildAggregatesDistance2(const LO maxAggSize,
const LWGraph_kokkos& graph,
Aggregates_kokkos& aggregates,
Kokkos::View<unsigned*, memory_space>& aggStat,
LO& numNonAggregatedNodes) const;
void BuildAggregatesRandom(const LO maxAggSize,
const LWGraph_kokkos& graph,
Aggregates_kokkos& aggregates,
Kokkos::View<unsigned*, memory_space>& aggStat,
LO& numNonAggregatedNodes) const;

void BuildAggregatesDeterministic(const LO maxAggSize,
const LWGraph_kokkos& graph,
Expand All @@ -137,30 +132,6 @@ namespace MueLu {

std::string description() const { return "Phase 1 (main)"; }

enum struct Algorithm
{
Serial,
Distance2
};

static Algorithm algorithmFromName(const std::string& name)
{
if(name == "Distance2")
return Algorithm::Distance2;
return Algorithm::Serial;
}

private:

/*! @brief Utility to take a list of integers and reorder them randomly (by using a local permutation).
@param list On input, a bunch of integers. On output, the same integers in a different order
that is determined randomly.
*/
void RandomReorder(ArrayRCP<LO> list) const;

/*! @brief Generate a random number in the range [min, max] */
int RandomOrdinal(int min, int max) const;

};

} //namespace MueLu
Expand Down
Loading

0 comments on commit f8614f7

Please sign in to comment.