-
Notifications
You must be signed in to change notification settings - Fork 96
Add Distributed Multigrid. #1269
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
Conversation
a901141
to
6f6aa8f
Compare
225b9f9
to
54b2785
Compare
Would that allow to use Multigrid as a preconditioner without Schwarz? |
8274219
to
fc978a0
Compare
Right now, you use the partition only to get the local size of the matrix, which you can also get from the local matrix. The stored matrix data is not used at all. I would suggest removing these until they are actually necessary. |
cf7cbcf
to
de2adf6
Compare
@greole , Yes, but a coarse generation algorithm ( that is distributed capable) is necessary. Meaning we need to have the equivalent of AMGX which generates the triplet (R, A_c, P). |
@MarcelKoch, yes, I dont intend to merge this yet. I just wanted to show what changes could be necessary. At present we do not need the partition or the matrix_data. |
@pratikvn could you rebase it? I think some changes are related to the schwarz? |
55ad491
to
ce4d26a
Compare
core/solver/multigrid.cpp
Outdated
this->run_mg_cycle<VectorType>(cycle, level + 1, next_level_matrix, g.get(), | ||
e.get(), next_mode); |
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.
it can not be VectorType. Different layers may have different precision
core/solver/multigrid.cpp
Outdated
#endif | ||
|
||
|
||
template <typename VectorType> |
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 issue
3f09518
to
a3f7ba4
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.
some comments.
|
||
auto mg = mg_factory->generate(mtx); | ||
|
||
ASSERT_NO_THROW(mg->apply(b, x)); |
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.
Maybe also a test that shows that the result is the same as in the non-distrtibuted case would make sense ?
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 think distributed coarsening method usually different from the non-distributed one?
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.
As you are testing the solver here, I think checking if the two solutions are within some tolerance makes sense.
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.
ah, for this situation, I can not do it because we do not have actual distributed coarsening method.
I think the current test should be enough because the distributed multigrid actually only handle the vector allocation. These tests ensure the allocation is correct and the corresponding apply works correctly
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.
Ah, yes. Maybe make a note/TODO here for now, and it should be okay to add it later
* DistributedLocalSize is a feature class providing `get_local_size` which | ||
* return the size of local operator. | ||
*/ | ||
class DistributedLocalSize { |
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.
Why a separate interface class ? Can this not be in DistributedBase
?
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.
Additionally, the question arises what to do with the non_local_size
.
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 was also thinking about putting it into the DistributedBase
, but I wonder it is out of the scope because it only handles the communicator now.
non_local_size
can not go into this base because the vector does not have the idea about non_local_size.
Or, we just put non_local_size of vector is dim<2>(0, 0).
I do not have an idea about the usage of non_local_size out of the matrix
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 don't mean putting non_local_size
into the DistributedLocalSize
interface class, but if we have a DistributedLocalSize
we should probably also implement one to handle non_local_size
.
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.
No, I only mean the functionality but don't mean put it into the DistributedLocalSize.
I agree with user may expect something similar to get_local_size()
for non_local_matrix()
.
For me, if we need to get_non_local_size(), we need to put get_local_size()
into DistributedLocalSize
and get_non_local_size()
into DistributedNonLocalSize
because vector does not have non_local information such that we can not put them together into DistrbutedBase
. One in DistrbutedBase
and another in DistributedNonLocalSize
are also inconsistent in my mind. (unless we put non_local_size = 0 in vector cases)
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 think it should be okay to have only local_size in DistributedBase. A separate interface class is too clunky IMO. But given that this probably will be overwritten, I dont have a strong opinion, and we can discuss this later.
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 move it to DistributedBase now.
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 more comments from my side. Looks good to me in general. Maybe the tests can be simplified to avoid the implementation of the Dummy classes.
* DistributedLocalSize is a feature class providing `get_local_size` which | ||
* return the size of local operator. | ||
*/ | ||
class DistributedLocalSize { |
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.
Additionally, the question arises what to do with the non_local_size
.
@greole yes, the coarsening may affect the non_local_matrix, but coarsening method will take care of it not the multigrid itself. |
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 think from my side, this looks good to be merged.
Co-authored-by: Pratik Nayak <pratikvn@protonmail.com>
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.
due to github pr limitation, approve on behalf of @pratikvn
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.
LGTM! Just a final question, in order to use it we also need to merge a distributed coarsening method, like PGM?
e4387bc
to
95ead72
Compare
Co-authored-by: Gregor Olenik <gregor.olenik@web.de>
Co-authored-by: Gregor Olenik <gregor.olenik@web.de>
Co-authored-by: Pratik Nayak <pratikvn@protonmail.com>
This PR updates the multigrid class to handle distributed matrices and hence allows preconditioning and solution with distributed multigrid.
Major changes
Of course, as there is no coarse generation method, we cannot still use distributed multigrid automatically, but that will be added in a future PR.
Points of discussion
Issues