Unverified Commit 324bcbaa authored by trilinos-autotester's avatar trilinos-autotester Committed by GitHub
Browse files

Merge Pull Request #5032 from kyungjoo-kim/Trilinos/develop

Automatically Merged using Trilinos Pull Request AutoTester
PR Title: Ifpack2 kokkos promotion preparation
PR Author: kyungjoo-kim
parents b56e6b9f eb7c06ab
......@@ -331,15 +331,14 @@ namespace Ifpack2 {
int applyInverseJacobi (const mv_type& X, mv_type& Y,
const ApplyParameters& input) const;
/// \brief If a norm-based method was used, return a buffer containing the
/// norms, ordered by degrees of freedom, then RHS; otherwise, return a
/// null ArrayRCp.
const Teuchos::ArrayRCP<const magnitude_type> getNorms0 () const;
/// \brief If a norm-based method was used, return a buffer containing the
/// norms, ordered by degrees of freedom, then RHS; otherwise, return a
/// null ArrayRCp.
const Teuchos::ArrayRCP<const magnitude_type> getNormsFinal () const;
/// \brief If a norm-based method was used, return a L2 norm of all rhs
/// at the first iteration; otherwise return a minus one indicating
/// norm is not requested.
const magnitude_type getNorms0 () const;
/// \brief If a norm-based method was used, return a L2 norm of all rhs;
/// otherwise return zero.
const magnitude_type getNormsFinal () const;
//! Compute <tt>Y := (1 - a) Y + a D^{-1} (X - R*Y)</tt>. Not supported. Call
//! <tt>applyInverseJacobi</tt> instead.
......
......@@ -336,19 +336,17 @@ namespace Ifpack2 {
}
template <typename MatrixType>
const Teuchos::ArrayRCP<const typename BlockTriDiContainer<MatrixType, BlockTriDiContainerDetails::ImplSimdTag>::magnitude_type>
const typename BlockTriDiContainer<MatrixType, BlockTriDiContainerDetails::ImplSimdTag>::magnitude_type
BlockTriDiContainer<MatrixType, BlockTriDiContainerDetails::ImplSimdTag>
::getNorms0 () const {
const auto p = impl_->norm_manager.getNorms0();
return Teuchos::arcp(p, 0, p ? 1 : 0, false);
return impl_->norm_manager.getNorms0();
}
template <typename MatrixType>
const Teuchos::ArrayRCP<const typename BlockTriDiContainer<MatrixType, BlockTriDiContainerDetails::ImplSimdTag>::magnitude_type>
const typename BlockTriDiContainer<MatrixType, BlockTriDiContainerDetails::ImplSimdTag>::magnitude_type
BlockTriDiContainer<MatrixType, BlockTriDiContainerDetails::ImplSimdTag>
::getNormsFinal () const {
const auto p = impl_->norm_manager.getNormsFinal();
return Teuchos::arcp(p, 0, p ? 1 : 0, false);
return impl_->norm_manager.getNormsFinal();
}
template <typename MatrixType>
......
......@@ -212,14 +212,12 @@ static void run_performance_test (const Input& in) {
const auto n0 = T->getNorms0();
const auto nf = T->getNormsFinal();
bool ok = true;
if (n0.size() > 0) {
if (n0 > 0) {
std::stringstream ss;
ss << "Norm reduction:";
for (int i = 0; i < n0.size(); ++i) {
const auto r = nf[i] / n0[i];
ss << " " << r;
if (r > in.tol && sweep != in.iterations) ok = false;
}
const auto r = nf / n0;
ss << " " << r;
if (r > in.tol && sweep != in.iterations) ok = false;
ss << "\n";
if (in.verbose)
std::cout << ss.str();
......
......@@ -303,12 +303,9 @@ struct BlockTriDiContainerTester {
if (nits < num_sweeps) {
const auto n0 = T_bare_advanced->getNorms0();
const auto nf = T_bare_advanced->getNormsFinal();
bool ok = true;
Magnitude r = 0;
for (int i = 0; i < nvec; ++i) {
r = nf[i] / n0[i];
if (r > tol) { ok = false; break; }
}
const Magnitude r = nf/n0;
const bool ok = r <= tol;
if ( ! ok)
TEST_BR_BTDC_FAIL("FAIL: test_BR_BTDC (A = D + R, norm) " << details << " r " << r);
else
......@@ -341,10 +338,11 @@ struct BlockTriDiContainerTester {
T_bare_advanced->applyInverseJacobi(*B, *X, input);
// Check if X agrees with the manually computed X_true.
rd = bcmm::reldif(*X, X_true);
if (rd > 1e1*std::numeric_limits<Magnitude>::epsilon())
TEST_BR_BTDC_FAIL("FAIL: test_BR_BTDC (A = D + R, damping factor) " << details);
const auto eps = 1e1*std::numeric_limits<Magnitude>::epsilon();
if (rd > eps)
TEST_BR_BTDC_FAIL("FAIL: test_BR_BTDC (A = D + R, damping factor) " << details << " rd = " << rd << " eps = " << eps);
else
TEST_BR_BTDC_SUCCESS("SUCCESS: test_BR_BTDC (A = D + R, damping factor) " << details);
TEST_BR_BTDC_SUCCESS("SUCCESS: test_BR_BTDC (A = D + R, damping factor) " << details << " rd = " << rd << " eps = " << eps);
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment