-
Notifications
You must be signed in to change notification settings - Fork 279
[Core][Future] Including linear operators to future environment #14119
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
base: master
Are you sure you want to change the base?
Conversation
| ///@{ | ||
|
|
||
| /** | ||
| * @brief |
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.
Repeated and empty
| * @brief |
| TMatrixType& GetMatrix() | ||
| { | ||
| KRATOS_ERROR_IF(this->IsMatrixFree()) << "Trying to access matrix from a matrix-free LinearOperator." << std::endl; | ||
| auto r_matrix = this->GetMatrixImpl(); // Get the underlying matrix as std::any |
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.
&?
| auto r_matrix = this->GetMatrixImpl(); // Get the underlying matrix as std::any | |
| auto& r_matrix = this->GetMatrixImpl(); // Get the underlying matrix as std::any |
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.
Okay, you do a cast later, remove the r?
| const TMatrixType& GetMatrix() const | ||
| { | ||
| KRATOS_ERROR_IF(this->IsMatrixFree()) << "Trying to access matrix from a matrix-free LinearOperator." << std::endl; | ||
| const auto r_matrix = this->GetMatrixImpl(); // Get the underlying matrix as const std::any |
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.
Idem
| * AMGCL is a header-only C++ library for solving large sparse linear systems with algebraic multigrid (AMG) method. AMG is one of the most effective iterative methods for solution of equation systems arising, for example, from discretizing PDEs on unstructured grids. The method can be used as a black-box solver for various computational problems, since it does not require any information about the underlying geometry. AMG is often used not as a standalone solver but as a preconditioner within an iterative solver (e.g. Conjugate Gradients, BiCGStab, or GMRES). | ||
| * AMGCL builds the AMG hierarchy on a CPU and then transfers it to one of the provided backends. This allows for transparent acceleration of the solution phase with help of OpenCL, CUDA, or OpenMP technologies. Users may provide their own backends which enables tight integration between AMGCL and the user code. | ||
| * @author Denis Demidov | ||
| * @author Pooyan Dadvand |
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.
And Denis?
| @@ -23,6 +22,7 @@ | |||
| // Project includes | |||
| #include "includes/define.h" | |||
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 can be safely removed
| #include "includes/define.h" |
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.
Any case now with C++20 we can use the modules to reduce compilations times and avoid the infinite nested includes
| @@ -22,6 +22,7 @@ | |||
| // Project includes | |||
| #include "includes/define.h" | |||
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.
| #include "includes/define.h" |
| @@ -22,6 +22,7 @@ | |||
| // Project includes | |||
| #include "includes/define.h" | |||
| #include "includes/model_part.h" | |||
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.
| #include "includes/model_part.h" |
Linear operator already includes it
|
|
||
| // Project includes | ||
| #include "future/linear_solvers/direct_solver.h" | ||
| #include "includes/define.h" |
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.
| #include "includes/define.h" |
| #include "containers/csr_matrix.h" | ||
| #include "containers/system_vector.h" | ||
| #include "containers/sparse_contiguous_row_graph.h" | ||
| #include "includes/define.h" |
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.
| #include "includes/define.h" |
| #include "containers/csr_matrix.h" | ||
| #include "containers/system_vector.h" | ||
| #include "containers/sparse_contiguous_row_graph.h" | ||
| #include "includes/define.h" |
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.
| #include "includes/define.h" |
| { | ||
| public: | ||
|
|
||
| // FIXME: Does not work... ask @Charlie |
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.
loumalouomega
left a comment
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.
Some comments
|
This looks cool. In fact I was also looking into this lately. Matrix free only works with iterative solvers right? Does amgcl support it? |
yes, it only works with krylov solvers. The problem is that typically it is impossible to mount a preconditioner. No ... AMGCL does not support it... cool thing is that you can also use to mount a GMRES-krylov solver for nonlinear problem |
is it worth it then? Seems that you are doing substantial changes to accommodate it. (I have no idea, just curious) |
|
Linear Operators are a nice thing to have, but they are not the reason of being of the reorganization we are doing. rather we are revamping the strategy/solver design to be more modular and to better consider parallelism (for exampel mpi will now be native) and the application of constraints |
📝 Description
In this PR I'm introducing the
LinearOperatorclasses in #14110 to the future environment, namely strategies, schemes, builders and linear solvers.Note that I also took the chance to rename the
LinearSystemContainertoImplicitStrategyDataContainer, something that is much more self-descriptive IMO.This requires #14108 and #14110 to be merged first but I'd like to create it as a draft PR to start the discussion and triggering the CI.