-
Notifications
You must be signed in to change notification settings - Fork 1
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
Refactoring GMGPolar #65
base: main
Are you sure you want to change the base?
Conversation
d55a6c9
to
e3c8bc7
Compare
1567c79
to
842c9bb
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.
- Smoother files were the most difficult to follow. Will you will be documenting them in your report? (colouring and outside/inside sections)
- A call graph can also be included in the appendix of your report
#include <array> | ||
#include <initializer_list> | ||
|
||
enum class StencilType |
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.
StencilType
may be a bit misleading name here. ( neighbour type ? )
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.
Good point! I find GridPosition or StencilPosition might be clearer. Do you think one of these works better?"
e.g. enum class StencilPosition{TopLeft, Top, TopRight, ...};
BottomRight, | ||
}; | ||
|
||
class Stencil |
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.
Stencil
is again misleading. When I think of stencil values I would assume they store something like [ 0 1 0 ; 1 -4 1; 0 1 0 ]
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.
While it's true that the term "stencil" is often associated with structures like convolution masks (e.g., [0, 1, 0; 1, -4, 1; 0, 1, 0]), its broader definition still fits the intended usage here.
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.
May be add a comment that this Stencil
class helps when building sparse matrices
|
||
class LevelCache; | ||
|
||
class Level |
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.
Consider renaming this class and use level
only for indicating multigrid level
const DensityProfileCoefficients& density_profile_coefficients, | ||
const bool DirBC_Interior, const int num_omp_threads, | ||
const StencilDistributionMethod stencil_distribution_method); | ||
void directSolveInPlace(Vector<double>& x) const; |
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.
Does InPlace
imply you overwrite the RHS with the solution? (maybe add a comment)
if (row == column) \ | ||
center_matrix.main_diagonal(row) += value; \ | ||
else if (row == column - 1) \ | ||
center_matrix.sub_diagonal(row) += value; \ | ||
else if (row == 0 && column == center_matrix.columns() - 1) \ | ||
center_matrix.cyclic_corner_element() += value; \ |
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 can use an inline function here instead of repeating this pattern (ex. update(matrix, value, row, col))
const int center_index = i_theta; \ | ||
const int left_index = i_theta; \ | ||
const int right_index = (i_r + 1 == numberSmootherCircles) ? 0 : i_theta; \ | ||
const int bottom_index = i_theta_M1; \ | ||
const int top_index = i_theta_P1; \ |
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.
Add a comment about these indices (row inside their local tridiagonal matrix as you explained)
else { | ||
auto& solverMatrix = circle_tridiagonal_solver_[circle_Asc_index]; | ||
|
||
solverMatrix = SymmetricTridiagonalSolver<double>(num_circle_nodes); | ||
solverMatrix.is_cyclic(true); | ||
solverMatrix.cyclic_corner_element() = 0.0; | ||
|
||
for (int i = 0; i < num_circle_nodes; i++) { | ||
solverMatrix.main_diagonal(i) = 0.0; | ||
if (i < num_circle_nodes - 1) { | ||
solverMatrix.sub_diagonal(i) = 0.0; | ||
} | ||
} | ||
} | ||
} |
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.
May be have a different function for zero initializations
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.
Comments/illustrations explaining node coloring should be very helpful
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.
Using GLOB can cause issues when changing or adding files. CMake files are usually recursive (ex. https://gitlab.com/CLIUtils/modern-cmake/-/tree/master/examples/extended-project)
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.
forget to submit them recently
# Mumps: Sparse Matrix Solver | ||
set(MUMPS_PREFIX_PATH "~/spack/opt/spack/linux-ubuntu20.04-icelake/gcc-9.4.0/mumps-5.6.2-m4xrhc4mshzrxmgptzbpult3nbf6qrzk") | ||
include_directories(${MUMPS_PREFIX_PATH}/include) | ||
link_directories(${MUMPS_PREFIX_PATH}/lib) |
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.
could you make the use of MUMPS optional? such that we can run it without the corresponding option in the CI? or how did you proceed?
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.
MUMPS is currently required for solving the system, as I have removed the custom matrix solver due to its inefficiency. Making MUMPS optional would involve reintroducing the factorization and solve methods into our COO-Matrix class. While this is technically feasible, it would require significant effort to implement and maintain.
If you'd like, I could reintroduce the custom solver to the codebase in March, but I don’t think it’s the best approach to resolve this issue.
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.
The current issue is that the tests are failing because the MUMPS library isn't being found, right? Wouldn't it be best to install MUMPS directly in the CI environment to ensure it's available during the test runs?
link_directories(${MUMPS_PREFIX_PATH}/lib) | ||
|
||
# Metis: Matrix reordering for Mumps | ||
set(METIS_PREFIX_PATH "~/spack/opt/spack/linux-ubuntu20.04-icelake/gcc-9.4.0/metis-5.1.0-bgoncx22w55soviybggl5ydjakvkm34v") |
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 know I also hardcoded MUMPS path but this should be avoided as much as possible. In particular with options activated by default. Or if it is not even an option.
|
||
git clone https://github.com/mknaranja/GMGPolar | ||
## Installing MUMPS using Spack |
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.
The new readme seems very nice and helpful but for CI MUMPS should be optional. Or is it included in CI too?
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.
At the moment it is required and MUMPS would need to be added to the CI pipeline.
README.md
Outdated
@@ -113,3 +125,67 @@ Release Notes | |||
|
|||
c. Non-default implicit extrapolation with smoothing of all nodes on the finest level [experimental, use with care, convergence cannot be observed with residual] (--extrapolation 2) | |||
6) Optimization of apply_A / build_rhs / apply_prolongation / build_Asc / apply_Asc_ortho | |||
|
|||
* GMGPolar 2.0 | |||
More points |
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.
???
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 more or less fixed now. There were some copy-paste oversights and the formatting wasn't very consistent with the Version 1.0.0 release notes.
Co-authored-by: Martin J. Kühn <[email protected]>
Co-authored-by: Martin J. Kühn <[email protected]>
Co-authored-by: Martin J. Kühn <[email protected]>
Co-authored-by: Martin J. Kühn <[email protected]>
Merge Request - GuideLine Checklist
Guideline to check code before resolve WIP and approval, respectively.
As many checkboxes as possible should be ticked.
Checks by code author:
Always to be checked:
If functions were changed or functionality was added:
If new functionality was added:
If new third party software is used:
If new mathematical methods or epidemiological terms are used:
[ ] The following questions are addressed in the documentation (if need be):
Developers (what did you do?, how can it be maintained?)
For users (how to use your work?)
For admins (how to install and configure your work?)
For documentation: Please write or update the Readme in the current working directory!
Checks by code reviewer(s):