[Trilinos-Users] Unexpected Error In Amesos2 After Upgrading Trilinos

Corey A. Henderson cahenderson at wisc.edu
Sat Dec 15 14:42:10 EST 2018


Any chance I could get some feedback on this error?

On Sun, Dec 2, 2018 at 11:59 AM Corey A. Henderson <cahenderson at wisc.edu>
wrote:

> Hello,
>
> I am struggling to debug an error being thrown by Amesos2 in v12.12.1
> (Release), when using Belos & MueLu for a GMRES solve. The identical code
> run against v12.10.1 (Debug) does not throw an error. Furthermore, the
> error does not happen for small matrix sizes. It works for N=1000 and
> N=2000 but fails for N=3000.
>
> The error I get is:
> MueLu::TpetraOperator::apply : detected an exception
>
> /dev/shm/Trilinos-trilinos-release-12-12-1/packages/amesos2/src/Amesos2_KLU2_def.hpp:144:
> Throw number = 39
> Throw test that evaluated to true: sp_colind == nullptr
> Amesos2 Runtime Error: sp_colind returned null
> terminate called after throwing an instance of 'std::runtime_error'
>   what():
> /dev/shm/Trilinos-trilinos-release-12-12-1/packages/amesos2/src/Amesos2_KLU2_def.hpp:144:
> Throw number = 39
> Throw test that evaluated to true: sp_colind == nullptr
> Amesos2 Runtime Error: sp_colind returned null
> Aborted
>
> In my simple test code I believe I am correctly setting column indices
> when I set up my matrix (A should be the identity matrix). I've pasted code
> below that reproduces the error. I'd appreciate help identifying where my
> mistake is, please.
>
> --
> Corey A. Henderson
> PhD Candidate and NSF Graduate Fellow
> Dept. of Engineering Physics
> Univ. of Wisconsin - Madison
>
> ********
>
> #include <iostream>
> #include "BelosTpetraAdapter.hpp"
> #include "Tpetra_CrsMatrix.hpp"
> #include "MueLu_CreateTpetraPreconditioner.hpp"
> #include "BelosSolverFactory.hpp"
> const bool testIt(const ulong numEntries) {
>  bool success = false;
>   Teuchos::RCP<const Teuchos::Comm<int> > localComm(new
> Teuchos::SerialComm<int>());
>   Teuchos::RCP<Tpetra::Map<int, long long> > testMap(
>     new Tpetra::Map<int, long long>(static_cast<long long>(numEntries),
> 0LL, localComm, Tpetra::GloballyDistributed));
>   Teuchos::RCP<Tpetra::CrsMatrix<double, int, long long> > testA(
>     new Tpetra::CrsMatrix<double, int, long long>(testMap, 1UL,
> Tpetra::StaticProfile));
>   Teuchos::Array<double> rowDataArray(1UL, 1.0);
>   Teuchos::Array<long long> columnIndicesArray(1UL, 1LL);
>   for (long long row=0; row < static_cast<long long>(numEntries); ++row) {
>    columnIndicesArray[0] = row;
>    testA->insertGlobalValues(row, columnIndicesArray(), rowDataArray());
>   }
>   testA->fillComplete();
>   Teuchos::RCP<Tpetra::MultiVector<double, int, long long> > testB(
>     new Tpetra::MultiVector<double, int, long long>(testMap, 1, false));
>   for (long long row=0; row < static_cast<long long>(numEntries); ++row)
>    testB->replaceGlobalValue(row, 0, static_cast<double>(row));
>   Teuchos::RCP<Tpetra::MultiVector<double, int, long long> > testX(
>     new Tpetra::MultiVector<double, int, long long>(testMap, 1, false));
>   testX->putScalar(0.0);
>   Teuchos::RCP<Tpetra::Operator<double, int, long long> > testAOperator =
>     Teuchos::rcp_dynamic_cast<Tpetra::Operator<double, int, long long>
> >(testA, true);
>   Teuchos::ParameterList mueLuParameterList;
>   mueLuParameterList.set("verbosity", "none");
>   mueLuParameterList.set("problem: type", "Poisson-2D");
>   Teuchos::RCP<MueLu::TpetraOperator<double, int, long long> >
> mueLuPreconditioner =
>     MueLu::CreateTpetraPreconditioner(testAOperator, mueLuParameterList);
>  Belos::SolverFactory<double, Tpetra::MultiVector<double, int, long long>,
> Tpetra::Operator<double, int, long long> > factory;
>  Teuchos::RCP<Teuchos::ParameterList> solverParams =
> Teuchos::parameterList();
>  solverParams->set ("Num Blocks", 100);
>  solverParams->set ("Maximum Iterations", 1000);
>  solverParams->set ("Convergence Tolerance", 10e-6);
>  Teuchos::RCP< Belos::SolverManager<double, Tpetra::MultiVector<double,
> int, long long>, Tpetra::Operator<double, int, long long> > >
>   testSolver = factory.create("GMRES", solverParams);
>  Teuchos::RCP<Belos::LinearProblem<double, Tpetra::MultiVector<double,
> int, long long>, Tpetra::Operator<double, int, long long> > > problem
>   = Teuchos::rcp(new Belos::LinearProblem<double,
> Tpetra::MultiVector<double, int, long long>, Tpetra::Operator<double, int,
> long long> >(testAOperator, testX, testB));
>  problem->setLeftPrec(mueLuPreconditioner);
>  success = problem->setProblem();
>  if (success) testSolver->setProblem(problem);
>  if (success) {
>   Belos::ReturnType result = testSolver->solve();
>   success = (result == Belos::Converged);
>  }
>  if (success) {
>   for (long long int row=0; row<static_cast<long long int>(numEntries);
> ++row) {
>    double thisValue = testX->getData(0)[row];
>    long long int longValue = round(thisValue);
>    if (longValue != row) {
>     success = false;
>    }
>   }
>  }
>  return success;
> }
> int main(int argc, char **argv) {
>     bool result = false;
>     result = testIt(1000); //works
>     std::cout << "Result for 1000: " << (result ? "True" : "False") <<
> std::endl;
>     result = testIt(2000);  //works
>     std::cout << "Result for 2000: " << (result ? "True" : "False") <<
> std::endl;
>     result = testIt(3000);  //fails
>     std::cout << "Result for 3000: " << (result ? "True" : "False") <<
> std::endl;
>
>     return 0;
> }
>
>

-- 
Corey A. Henderson
PhD Candidate and NSF Graduate Fellow
Dept. of Engineering Physics
Univ. of Wisconsin - Madison
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://trilinos.org/pipermail/trilinos-users/attachments/20181215/9b9e39bb/attachment-0001.html>


More information about the Trilinos-Users mailing list