[Trilinos-Users] [EXTERNAL] Amesos2 Klu2 is not enabled or is not supported

Truman Ellis truman at ices.utexas.edu
Wed Mar 25 12:52:54 MDT 2015


Switching to CrsMatrix fixed the issue. My working code is
     Teuchos::RCP<Epetra_CrsMatrix> A = 
Teuchos::rcp(dynamic_cast<Epetra_CrsMatrix*>(problem().GetMatrix()), false);
     Teuchos::RCP<Epetra_MultiVector> X = 
Teuchos::rcp(problem().GetLHS(), false);
     Teuchos::RCP<Epetra_MultiVector> B = 
Teuchos::rcp(problem().GetRHS(), false);
Teuchos::RCP<Amesos2::Solver<Epetra_CrsMatrix,Epetra_MultiVector> > 
solver = Amesos2::create<Epetra_CrsMatrix,Epetra_MultiVector>("Klu2", A, 
X, B);
     solver->solve();

Thanks for the help.

Truman

On 3/25/15 9:45 AM, Eric Bavier wrote:
> Truman,
>
> It is generally not possible to pass virtual matrix classess as the template parameter for Amesos2::create<...>.  This is because Amesos2 needs to be able to instantiate new matrix objects of the specified type, which it can't do with virtual classes.
>
> So, as Siva said, you need to pass the actual matrix class and/or provide Amesos2 adapters for your custom matrix class.
>
> `~Eric
> ________________________________________
> From: trilinos-users-bounces at software.sandia.gov [trilinos-users-bounces at software.sandia.gov] on behalf of Siva Rajamanickam [srajama at sandia.gov]
> Sent: Tuesday, March 24, 2015 17:41
> To: trilinos-users at software.sandia.gov
> Subject: Re: [Trilinos-Users] [EXTERNAL] Amesos2 Klu2 is not enabled or is not supported
>
> Truman
>    What is the underlying concrete implementation you are passing to Amesos2 ? Is it an Epetra_CrsMatrix or is it your own matrix which derives from Epetra_RowMatrix. The concrete adapters for CrsMatrices are provided in Amesos2. If you have your matrices, then you need an adapter for those.
>
> Thanks
> Siva
>
> On 03/24/2015 02:47 PM, Truman Ellis wrote:
> I just upgraded to 11.14.1 and I no longer get the CMake warnings when building Trilinos, but I do get build errors originating from my line:
> Teuchos::RCP<Amesos2::Solver<Epetra_RowMatrix,Epetra_MultiVector> > solver = Amesos2::create<Epetra_RowMatrix,Epetra_MultiVector>(A, X, B);
>
> The build errors are extremely long, so I'm attaching the output as a text file. My theory is that somehow Epetra_RowMatrix and Epetra_MultiVector are not valid template arguments, but I don't know enough about Amesos2 at this point to know what to try next.
>
> Thanks,
> Truman
>
> On 3/24/15 2:26 PM, Siva Rajamanickam wrote:
> That explains it. You have two options. You could use 11.8.1 and use SuperLU as your solver (as that was the only one supported in that version of Trilinos) or upgrade to 11.14.1 and use either
>   Basker or KLU2.
>
> Thanks
> Siva
>
>
> On 03/24/2015 01:20 PM, Truman Ellis wrote:
> Siva,
> I am using version 11.8.1. Our stiffness matrix is symmetric positive definite. At one point we were using Cholesky, but for reasons I can't remember at the moment, we switched to KLU as the default.
>
> I tried
> Teuchos::RCP<Amesos2::Solver<Epetra_RowMatrix,Epetra_MultiVector> > solver = Amesos2::create<Epetra_RowMatrix,Epetra_MultiVector>("Basker",A, X, B);
>
> But got a similar error:
> Basker is not enabled or is not supported
> Aborted
>
> Thanks for the response,
> Truman
>
> On 3/24/15 2:15 PM, Siva Rajamanickam wrote:
> Truman,
>    The first one is expected as KLU2 is no enabled by default. I am not sure why enabling it will get ignored, so it would be nice to know which version of Trilinos you are using.
>
>   Also what is your problem domain ? You might be able to use Basker, a new templated solver easily, if you don't depend on specific features of KLU (like the block triangular form) for performance.
>
> Thanks
> Siva
>
> On 03/24/2015 01:03 PM, Truman Ellis wrote:
> We have a code built on Epetra and Amesos that we are gradually migrating to Tpetra and Amesos2 in order to add support for complex variables. My first step in the conversion is just getting Amesos2 to work with our Epetra objects. The old code declares an Amesos_klu solver
> Amesos_Klu klu(problem);
> where problem is an Epetra_LinearProblem.
> My new code uses the following:
>      Teuchos::RCP<Epetra_RowMatrix> A = Teuchos::rcp(problem.GetMatrix());
>      Teuchos::RCP<Epetra_MultiVector> X = Teuchos::rcp(problem.GetLHS());
>      Teuchos::RCP<Epetra_MultiVector> B = Teuchos::rcp(problem.GetRHS());
> Teuchos::RCP<Amesos2::Solver<Epetra_RowMatrix,Epetra_MultiVector> > solver = Amesos2::create<Epetra_RowMatrix,Epetra_MultiVector>(A, X, B);
>      solver->solve();
>
> This all compiles fine, but when I try to run it, I get the following error:
> terminate called after throwing an instance of 'std::invalid_argument'
>    what(): /workspace/truman/trilinos/lib/cmake/Trilinos/../../../include/Amesos2_Factory.hpp:565:
>
> Throw number = 1
>
> Throw test that evaluated to true: true
>
> Klu2 is not enabled or is not supported
> Aborted
>
> I tried explicitly adding the following line to my do-configure script for building Trilinos:
> -D Amesos2_ENABLE_KLU2:BOOL=ON \
>
> But I get a CMake warning:
> CMake Warning:
>    Manually-specified variables were not used by the project:
>
>      Amesos2_ENABLE_KLU2
>
> Any thoughts on how to fix this?
>
> Thanks,
> Truman Ellis
> _______________________________________________
> Trilinos-Users mailing list
> Trilinos-Users at software.sandia.gov<mailto:Trilinos-Users at software.sandia.gov>
> https://software.sandia.gov/mailman/listinfo/trilinos-users
>
> _______________________________________________
> Trilinos-Users mailing list
> Trilinos-Users at software.sandia.gov<mailto:Trilinos-Users at software.sandia.gov>
> https://software.sandia.gov/mailman/listinfo/trilinos-users
>
>
> _______________________________________________
> Trilinos-Users mailing list
> Trilinos-Users at software.sandia.gov<mailto:Trilinos-Users at software.sandia.gov>
> https://software.sandia.gov/mailman/listinfo/trilinos-users
>
> _______________________________________________
> Trilinos-Users mailing list
> Trilinos-Users at software.sandia.gov<mailto:Trilinos-Users at software.sandia.gov>
> https://software.sandia.gov/mailman/listinfo/trilinos-users
>
>
>
>
>
> _______________________________________________
> Trilinos-Users mailing list
> Trilinos-Users at software.sandia.gov<mailto:Trilinos-Users at software.sandia.gov>
> https://software.sandia.gov/mailman/listinfo/trilinos-users
>
>
> _______________________________________________
> Trilinos-Users mailing list
> Trilinos-Users at software.sandia.gov
> https://software.sandia.gov/mailman/listinfo/trilinos-users
>



More information about the Trilinos-Users mailing list