Skip to content

Commit

Permalink
Merge Pull Request #7775 from trilinos/Trilinos/master_merge_20200804…
Browse files Browse the repository at this point in the history
…_000613

Automatically Merged using Trilinos Master Merge AutoTester
PR Title: Trilinos Master Merge PR Generator: Auto PR created to promote from master_merge_20200804_000613 branch to master
PR Author: trilinos-autotester
  • Loading branch information
trilinos-autotester authored Aug 4, 2020
2 parents e0447b5 + 0641399 commit 05ff8ea
Show file tree
Hide file tree
Showing 384 changed files with 121,478 additions and 6,834 deletions.
3 changes: 3 additions & 0 deletions packages/ifpack2/src/Ifpack2_Details_Chebyshev_decl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,9 @@ class Chebyshev : public Teuchos::Describable {
//! Number of power method iterations for estimating the max eigenvalue.
int eigMaxIters_;

//! Frequency of normalization in the power method.
int eigNormalizationFreq_;

//! Whether to assume that the X input to apply() is always zero.
bool zeroStartingSolution_;

Expand Down
59 changes: 43 additions & 16 deletions packages/ifpack2/src/Ifpack2_Details_Chebyshev_def.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ Chebyshev (Teuchos::RCP<const row_matrix_type> A) :
minDiagVal_ (STS::eps ()),
numIters_ (1),
eigMaxIters_ (10),
eigNormalizationFreq_(1),
zeroStartingSolution_ (true),
assumeMatrixUnchanged_ (false),
textbookAlgorithm_ (false),
Expand Down Expand Up @@ -317,6 +318,7 @@ Chebyshev (Teuchos::RCP<const row_matrix_type> A,
minDiagVal_ (STS::eps ()),
numIters_ (1),
eigMaxIters_ (10),
eigNormalizationFreq_(1),
zeroStartingSolution_ (true),
assumeMatrixUnchanged_ (false),
textbookAlgorithm_ (false),
Expand Down Expand Up @@ -359,6 +361,7 @@ setParameters (Teuchos::ParameterList& plist)
const ST defaultMinDiagVal = STS::eps ();
const int defaultNumIters = 1;
const int defaultEigMaxIters = 10;
const int defaultEigNormalizationFreq = 1;
const bool defaultZeroStartingSolution = true; // Ifpack::Chebyshev default
const bool defaultAssumeMatrixUnchanged = false;
const bool defaultTextbookAlgorithm = false;
Expand All @@ -377,6 +380,7 @@ setParameters (Teuchos::ParameterList& plist)
ST minDiagVal = defaultMinDiagVal;
int numIters = defaultNumIters;
int eigMaxIters = defaultEigMaxIters;
int eigNormalizationFreq = defaultEigNormalizationFreq;
bool zeroStartingSolution = defaultZeroStartingSolution;
bool assumeMatrixUnchanged = defaultAssumeMatrixUnchanged;
bool textbookAlgorithm = defaultTextbookAlgorithm;
Expand Down Expand Up @@ -581,6 +585,13 @@ setParameters (Teuchos::ParameterList& plist)
"\" parameter (also called \"eigen-analysis: iterations\") must be a "
"nonnegative integer. You gave a value of " << eigMaxIters << ".");

eigNormalizationFreq = plist.get ("chebyshev: eigenvalue normalization frequency", eigNormalizationFreq);
TEUCHOS_TEST_FOR_EXCEPTION(
eigNormalizationFreq < 0, std::invalid_argument,
"Ifpack2::Chebyshev::setParameters: \"chebyshev: eigenvalue normalization frequency"
"\" parameter must be a "
"nonnegative integer. You gave a value of " << eigNormalizationFreq << ".")

zeroStartingSolution = plist.get ("chebyshev: zero starting solution",
zeroStartingSolution);
assumeMatrixUnchanged = plist.get ("chebyshev: assume matrix does not change",
Expand Down Expand Up @@ -643,6 +654,7 @@ setParameters (Teuchos::ParameterList& plist)
minDiagVal_ = minDiagVal;
numIters_ = numIters;
eigMaxIters_ = eigMaxIters;
eigNormalizationFreq_ = eigNormalizationFreq_;
zeroStartingSolution_ = zeroStartingSolution;
assumeMatrixUnchanged_ = assumeMatrixUnchanged;
textbookAlgorithm_ = textbookAlgorithm;
Expand Down Expand Up @@ -1350,7 +1362,7 @@ powerMethodWithInitGuess (const op_type& A,
const ST zero = static_cast<ST> (0.0);
const ST one = static_cast<ST> (1.0);
ST lambdaMax = zero;
ST RQ_top, RQ_bottom, norm;
ST RQ_top, RQ_bottom = one, norm;

V y (A.getRangeMap ());
norm = x.norm2 ();
Expand All @@ -1373,31 +1385,45 @@ powerMethodWithInitGuess (const op_type& A,
*out_ << " norm1(x.scale(one/norm)): " << x.norm1 () << endl;
}

for (int iter = 0; iter < numIters; ++iter) {
for (int iter = 0; iter < numIters-1; ++iter) {
if (debug_) {
*out_ << " Iteration " << iter << endl;
}
A.apply (x, y);
solve (y, D_inv, y);
RQ_top = y.dot (x);
RQ_bottom = x.dot (x);
if (debug_) {
*out_ << " RQ_top: " << RQ_top
<< ", RQ_bottom: " << RQ_bottom << endl;
}
lambdaMax = RQ_top / RQ_bottom;
norm = y.norm2 ();
if (norm == zero) { // Return something reasonable.
if (debug_) {
*out_ << " norm is zero; returning zero" << endl;
solve (x, D_inv, y);

if (((iter+1) % eigNormalizationFreq_ == 0) && (iter < numIters-2)) {
norm = x.norm2 ();
if (norm == zero) { // Return something reasonable.
if (debug_) {
*out_ << " norm is zero; returning zero" << endl;
}
return zero;
}
return zero;
x.scale (one / norm);
}
x.update (one / norm, y, zero);
}
if (debug_) {
*out_ << " lambdaMax: " << lambdaMax << endl;
}

norm = x.norm2 ();
if (norm == zero) { // Return something reasonable.
if (debug_) {
*out_ << " norm is zero; returning zero" << endl;
}
return zero;
}
x.scale (one / norm);
A.apply (x, y);
solve (y, D_inv, y);
RQ_top = y.dot (x);
RQ_bottom = one;
if (debug_) {
*out_ << " RQ_top: " << RQ_top
<< ", RQ_bottom: " << RQ_bottom << endl;
}
lambdaMax = RQ_top / RQ_bottom;
return lambdaMax;
}

Expand Down Expand Up @@ -1649,6 +1675,7 @@ describe (Teuchos::FancyOStream& out,
<< "userEigRatio_: " << userEigRatio_ << endl
<< "numIters_: " << numIters_ << endl
<< "eigMaxIters_: " << eigMaxIters_ << endl
<< "eigNormalizationFreq_: " << eigNormalizationFreq_ << endl
<< "zeroStartingSolution_: " << zeroStartingSolution_ << endl
<< "assumeMatrixUnchanged_: " << assumeMatrixUnchanged_ << endl
<< "textbookAlgorithm_: " << textbookAlgorithm_ << endl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ IF (${PACKAGE_NAME}_ENABLE_Tpetra AND ${PACKAGE_NAME}_ENABLE_Amesos2)
amg_3dof_rebalance.xml
coarse_smoother.xml
structured_1dof.xml
structured_linear_1dof_comp.xml
structured_1dof_3level.xml
structured_1dof-complex.xml
structured_linear_1dof.xml
structured_linear_R_1dof.xml
structured_linear_3dof.xml
structured_unstructured_1dof.xml
compare_residual_history.py
Expand Down Expand Up @@ -158,6 +160,22 @@ IF (${PACKAGE_NAME}_ENABLE_Tpetra AND ${PACKAGE_NAME}_ENABLE_Amesos2)
NUM_MPI_PROCS 4
)

TRIBITS_ADD_TEST(
StructuredRegionDriver
NAME "Structured_Region_Linear_R_Brick3D_Tpetra"
ARGS "--linAlgebra=Tpetra --xml=structured_linear_R_1dof.xml --matrixType=Brick3D --nx=10 --ny=10 --nz=10 --smootherIts=2 --convergence-log=Brick3D_linear_R_1.log"
COMM serial mpi
NUM_MPI_PROCS 1
)

TRIBITS_ADD_TEST(
StructuredRegionDriver
NAME "Structured_Region_Linear_R_Brick3D_Tpetra"
ARGS "--linAlgebra=Tpetra --xml=structured_linear_R_1dof.xml --matrixType=Brick3D --nx=19 --ny=19 --nz=10 --smootherIts=2 --convergence-log=Brick3D_linear_R_4.log"
COMM serial mpi
NUM_MPI_PROCS 4
)

TRIBITS_ADD_TEST(
StructuredRegionDriver
NAME "Structured_Unstructured_Laplace3D_Tpetra"
Expand Down Expand Up @@ -239,6 +257,25 @@ TRIBITS_ADD_TEST(
OVERALL_NUM_MPI_PROCS 4
)

TRIBITS_ADD_ADVANCED_TEST(
Structured_Region_Linear_R_Tpetra_MPI_4_regression
TEST_0
EXEC StructuredRegionDriver
ARGS --linAlgebra=Tpetra --xml=structured_linear_1dof_comp.xml --matrixType=Brick3D --nx=19 --ny=19 --nz=10 --smootherIts=2 --convergence-log=Brick3D_linear_4_comp.log
NUM_MPI_PROCS 4
TEST_1
EXEC StructuredRegionDriver
ARGS --linAlgebra=Tpetra --xml=structured_linear_R_1dof.xml --matrixType=Brick3D --nx=19 --ny=19 --nz=10 --smootherIts=2 --convergence-log=Brick3D_linear_R_4_comp.log
NUM_MPI_PROCS 4
TEST_2
CMND ${PYTHON_EXECUTABLE}
ARGS compare_residual_history.py Brick3D_linear_4_comp.log Brick3D_linear_R_4_comp.log 1.0e-12
STANDARD_PASS_OUTPUT
FAIL_FAST
COMM serial mpi
OVERALL_NUM_MPI_PROCS 4
)

ENDIF()

ENDIF()
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
<ParameterList name="MueLu">

<!-- Configuration of the Xpetra operator (fine level) -->
<ParameterList name="Matrix">
<Parameter name="PDE equations" type="int" value="1"/> <!-- Number of PDE equations at each grid node.-->
</ParameterList>

<!-- Factory collection -->
<ParameterList name="Factories">

<ParameterList name="myAmalgamationFact">
<Parameter name="factory" type="string" value="AmalgamationFactory"/>
</ParameterList>

<ParameterList name="myCoalesceDropFact">
<Parameter name="factory" type="string" value="CoalesceDropFactory"/>
<Parameter name="lightweight wrap" type="bool" value="true"/>
<Parameter name="aggregation: drop tol" type="double" value="0.00"/>
<Parameter name="UnAmalgamationInfo" type="string" value="myAmalgamationFact"/>
</ParameterList>

<ParameterList name="myAggregationFact">
<Parameter name="factory" type="string" value="StructuredAggregationFactory"/>
<Parameter name="aggregation: coupling" type="string" value="uncoupled"/>
<Parameter name="aggregation: output type" type="string" value="CrsGraph"/>
<Parameter name="aggregation: coarsening order" type="int" value="1"/>
<Parameter name="aggregation: coarsening rate" type="string" value="{3}"/>
<Parameter name="Graph" type="string" value="myCoalesceDropFact"/>
</ParameterList>

<ParameterList name="myCoarseMapFact">
<Parameter name="factory" type="string" value="CoarseMapFactory"/>
<Parameter name="Aggregates" type="string" value="myAggregationFact"/>
</ParameterList>

<!-- Note that ParameterLists must be defined prior to being used -->
<ParameterList name="myProlongatorFact">
<Parameter name="factory" type="string" value="GeometricInterpolationPFactory"/>
<Parameter name="interp: build coarse coordinates" type="bool" value="true"/>
<Parameter name="interp: interpolation order" type="int" value="1"/>
<Parameter name="prolongatorGraph" type="string" value="myAggregationFact"/>
<Parameter name="coarseCoordinatesFineMap" type="string" value="myAggregationFact"/>
<Parameter name="coarseCoordinatesMap" type="string" value="myAggregationFact"/>
</ParameterList>

<ParameterList name="myCoordTransferFact">
<Parameter name="factory" type="string" value="CoordinatesTransferFactory"/>
<Parameter name="structured aggregation" type="bool" value="true"/>
<Parameter name="numDimensions" type="string" value="myAggregationFact"/>
<Parameter name="lCoarseNodesPerDim" type="string" value="myAggregationFact"/>
</ParameterList>

<ParameterList name="myNullspaceFact">
<Parameter name="factory" type="string" value="NullspaceFactory"/>
<Parameter name="Nullspace" type="string" value="myProlongatorFact"/>
</ParameterList>

<ParameterList name="myRestrictorFact">
<Parameter name="factory" type="string" value="TransPFactory"/>
</ParameterList>

<!-- <ParameterList name="myAggExport"> -->
<!-- <Parameter name="factory" type="string" value="AggregationExportFactory"/> -->
<!-- <Parameter name="Aggregates" type="string" value="myAggregationFact"/> -->
<!-- <Parameter name="aggregation: output filename" type="string" value="structured_aggs"/> -->
<!-- <Parameter name="aggregation: output file: agg style" type="string" value="Jacks"/> -->
<!-- <Parameter name="aggregation: output file: agg style" type="string" value="Convex Hulls"/> -->
<!-- </ParameterList> -->

<ParameterList name="myRAPFact">
<Parameter name="factory" type="string" value="RAPFactory"/>
<Parameter name="P" type="string" value="myProlongatorFact"/>
<Parameter name="R" type="string" value="myRestrictorFact"/>
<ParameterList name="TransferFactories">
<Parameter name="CoordinateTransfer" type="string" value="myCoordTransferFact"/>
<!-- <Parameter name="AggregationExportFactory" type="string" value="myAggExport"/> -->
</ParameterList>
</ParameterList>

<ParameterList name="myILU">
<Parameter name="factory" type="string" value="TrilinosSmoother"/>
<Parameter name="type" type="string" value="RILUK"/>
<ParameterList name="ParameterList">
<Parameter name="schwarz: overlap level" type="int" value="1"/>
<Parameter name="schwarz: combine mode" type="string" value="Zero"/>
<Parameter name="schwarz: use reordering" type="bool" value="false"/>
<Parameter name="fact: iluk level-of-fill" type="int" value="0"/>
<Parameter name="fact: absolute threshold" type="double" value="0."/>
<Parameter name="fact: relative threshold" type="double" value="1."/>
<Parameter name="fact: relax value" type="double" value="0."/>
</ParameterList>
</ParameterList>

</ParameterList>


<!-- Definition of the multigrid preconditioner -->
<ParameterList name="Hierarchy">

<Parameter name="max levels" type="int" value="6"/> <!-- Max number of levels -->
<Parameter name="cycle type" type="string" value="W"/>
<Parameter name="coarse: max size" type="int" value="40"/> <!-- Min number of rows on coarsest level -->
<Parameter name="verbosity" type="string" value="High"/>

<ParameterList name="All">
<Parameter name="PreSmoother" type="string" value="NoSmoother"/>
<Parameter name="PostSmoother" type="string" value="NoSmoother"/>
<Parameter name="Nullspace" type="string" value="myNullspaceFact"/>
<Parameter name="Aggregates" type="string" value="myAggregationFact"/>
<Parameter name="lCoarseNodesPerDim" type="string" value="myAggregationFact"/>
<Parameter name="P" type="string" value="myProlongatorFact"/>
<Parameter name="R" type="string" value="myRestrictorFact"/>
<Parameter name="A" type="string" value="myRAPFact"/>
<!-- <Parameter name="CoarseSolver" type="string" value="DirectSolver"/> -->
<Parameter name="CoarseSolver" type="string" value="myILU"/>
<Parameter name="Coordinates" type="string" value="myProlongatorFact"/>
<Parameter name="lNodesPerDim" type="string" value="myCoordTransferFact"/>
<Parameter name="numDimensions" type="string" value="myCoordTransferFact"/>
</ParameterList>
</ParameterList>

</ParameterList>
Loading

0 comments on commit 05ff8ea

Please sign in to comment.