Closed michael-a-hansen closed 8 years ago
Hello Michael,
You actually don't need to use an InverseOperator with Tpetra. (A short explanation: Ifpack preconditioners are applied using the ApplyInverse method. Ifpack2 applies them with the apply method. That's why Ifpack preconditioners needed to be wrapped in the InverseOperator, and Ifpack2 ones don't.) This example uses TraceMin-Davidson rather than generalized Davidson, but it should give you the information you want: https://trilinos.org/docs/dev/packages/anasazi/doc/html/TraceMinDavidsonLaplacianEx_8cpp-example.html
This is helpful, thank you.
Unfortunately I observe that the HAVE_ANASAZI_IFPACK2
flag is never set to true. I have both Ifpack2 and Anasazi building, I'm sure of that. Grep tells me that on both origin/master and origin/develop, cmake never sets a HAVE_ANASAZI_IFPACK2
flag and that the only place it shows up is in the TraceMinDavidson example. When I remove the conditional on the flag, compilation fails as Ifpack2_Factory.hpp
doesn't exist - there are only _def.hpp
and _decl.hpp
variants.
Do I need to work off of a different remote branch? An Ifpack2 compilation error went away after I updated today (vs origin/master a few weeks ago), so there must be some relevant and recent changes.
Mike
Oops. There's a long story behind that HAVE_ANASAZI_IFPACK2 issue that I won't bore you with. It's an issue that I forgot about, so thanks for bringing it up.
Have you ever compiled your own examples/drivers against Trilinos? You could always copy that example, take out the offending lines, compile it against Trilinos, and run it. If you need an example of how to do that, I can dig one up for you.
I am running this as my own driver file (from inside the anasazi test directory to facilitate the build), and the issue with removing the flag is that the header it protects (Ifpack2_Factory.hpp
) doesn't exist. If I remove all of the Ifpack2 preconditioning lines I can run BKS or Generalized Davidson and they work fine. But GenDav is quite slow (relatively) on my unit test of a 1000x1000 diagonal matrix and I'd like to see if preconditioning can make much of a difference.
More fundamentally the issue is that I'm having difficulty converging some smallest eigenvalue calculations with BKS and I'd like to see if Generalized Davidson, which appears to need preconditioning to have a chance, can do any better than BKS there.
@trilinos/ifpack2 @trilinos/anasazi @mhoemmen
How are you compiling your driver? You are correct that the header Ifpack2_Factory.hpp
does not exist in the source directory, but it will get created and put into the install directory. The entire contents of that file are
`
so if you believe the nonexistence of that file is causing your problem, you can always replace the inclusion of
Ifpack2_Factory.hppwith
Ifpack2_Factory_decl.hpp`.
I think part of your problem is that this example was never supposed to live in Anasazi in the first place; that was a mistake on my part. (Sorry about that!) Anasazi is not able to depend on Ifpack2 because it would result in a circular dependency. That example cannot be built as part of Anasazi, since Anasazi gets built before Ifpack2. Please build the example after the rest of Trilinos has been built, as described here: https://github.com/trilinos/Trilinos/issues/348
I now have an external project compiling and running with Anasazi and an Ifpack2 preconditioner. Problem solved 👍
Thank you for your help! Mike
I would like to see an example of the generalized Davidson method in Anasazi being used with tpetra and a preconditioner from ifpack2. It's not clear how to incorporate a preconditioner because the examples I've found in Anasazi use epetra and its inverse operator class, which doesn't seem to exist in tpetra.