-
Notifications
You must be signed in to change notification settings - Fork 707
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add SolverDirect for Tpetra Wrappers #16602
Conversation
Might help with #10414. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll eventually also have to add the .cc
and/or .templates.h
file.
That file is already in the works. I also looked at the Epetra tests for the direct solvers but they CG solver of AztecOO as a baseline. |
Yes definitely, there are multiple solvers that were at least not mentioned in the Epetra wrappers but partially also not in Amesos(1). SuperLU_MT is also wrapped in Amesos2. But looking at the documentation of the solver wrapper classes in Amesos2 I see that we should also give the option |
c24240a
to
d9af340
Compare
Working on the parameters a question would be whether we want some Utility classes or structs Especially for MUMPS a user would have to dig deep to find out what |
We usually do this via I think it would be great if we could make the majority of the tests in #16611 work by the end of April or so, so we can be sure that this can all be shipped with the next release. There will be things we want to improve later on, and making things convenient may fall in this category. |
The additional data would work if there is a nonempty intersection of all possible parameters for the solvers. Another option would be to write derived classes for each of the supported solvers with their data sets. |
e13a33f
to
f63c87e
Compare
In terms of staying in one ecosystem, i.e. all TpetraWrappers the SolverDirect wrapper is now feature complete. Considering testing we might think about also testing the |
I just had a look at the Ifpack1 preconditioners in deal.II and noticed that we basically do So I would propose to actually use the chance of reworking the interface to have the same structure for both. The structure would be as follows:
What do you think @bangerth, @kinnewig, @kronbichler, @masterleinad ? |
I would be very happy if we could have a class that can be set with parameter files alongside some generic classes that implement often-used options, exactly as you suggest. I think it often is desirable for more complex codes to switch between different options for solvers and preconditioners via a parameter file. Of course, one can address that by adding the necessary switches in the C++ code (via a base class or similar mechanisms) for cases where the code needs different implementations. But since Trilinos/Ifpack2/Amesos2 already does control via a single solver instance that for us, it would be a pity not to use it. So 👍 from my end to this suggestion. |
917f1d5
to
4fef4da
Compare
I have reworked the class layout as discussed. Additionally, we have We also have a test 01 to ensure setting a parameter sets works (here with KLU2 again) and to ensure that I have also finished a
but that might possibly stem from some 64bit vs. 32bit clash. |
4fef4da
to
ef166dd
Compare
I have undrafted it because I feel that any further work like supporting specific solvers could be done in separate PRs. |
Having the same problem with Ifpack2, I just noticed that we should check whether Amesos2 is actually part of Trilinos and added that to the CMake files. |
b55a6fc
to
3892b08
Compare
/rebuild |
3892b08
to
befa159
Compare
Okay figures out how to ensure amesos2 is set up. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just a few small issues.
template <typename Number, typename MemorySpace = dealii::MemorySpace::Host> | ||
class SolverDirect : public SolverDirectBase<Number, MemorySpace> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Each of the main classes in this file needs a brief documentation describing what it does.
// First set whether we want to print the solver information to screen | ||
// or not. | ||
ConditionalOStream verbose_cout(std::cout, output_solver_details); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here and elsewhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if this relates to the three lines rule or if you meant anything else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This related to a comment that must have gone lost. I don't think the verbose_cout
thing is very useful. Let's use the opportunity to get rid of it here and in all of the other places where we use it in these direct solvers, along with the flag that controls whether to output.
{} | ||
|
||
template <typename Number, typename MemorySpace> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our usual convention is 3 empty lines between functions. This whole file doesn't satisfy this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
{ | ||
deallog.push("DirectMEASLES"); | ||
LinearAlgebra::TpetraWrappers::SolverDirect<double>::AdditionalData data( | ||
"MEASLES", true); | ||
try | ||
{ | ||
LinearAlgebra::TpetraWrappers::SolverDirect<double> direct_solver( | ||
solver_control, data); | ||
} | ||
catch (dealii::ExceptionBase &exc) | ||
{ | ||
deallog << "Error: " << std::endl; | ||
exc.print_info(deallog.get_file_stream()); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is purposefully a non-existent solver, right? Perhaps add a comment in front of it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
befa159
to
d288eda
Compare
If have added the missing documentation for the classes and structs. |
d288eda
to
4034b6d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good with the exception of the output thing. Let's merge since it is ready; if you feel like addressing the output thing in a separate PR, go ahead -- or we can leave that as a follow-up and I can just open a github issue.
// First set whether we want to print the solver information to screen | ||
// or not. | ||
ConditionalOStream verbose_cout(std::cout, output_solver_details); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This related to a comment that must have gone lost. I don't think the verbose_cout
thing is very useful. Let's use the opportunity to get rid of it here and in all of the other places where we use it in these direct solvers, along with the flag that controls whether to output.
Ahh yes that must have gone missing. |
This will add support for (sparse) direct solvers implemented
or interfaced in Amesos2, which is part of the Tpetra stack.
Status:
Implementation itself (with A as LA::TpetraWrappers::SparseMatrix)