-
Notifications
You must be signed in to change notification settings - Fork 185
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
Refactor MGR coarse level matrix computation #1102
Conversation
{ | ||
AP = hypre_ParCSRMatMat(A, P); | ||
RAP = hypre_ParCSRMatMat(R, AP); | ||
hypre_CSRMatrixReorder(hypre_ParCSRMatrixDiag(RAP)); |
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.
Remind me why we are reordering 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.
This is from some time ago and I'm not 100% sure, but I believe it's because hypre_ParCSRMatMat
doesn't guarantee that the diagonal entry goes first. So the reorder is to guarantee that. @liruipeng is this correct?
#include <math.h> | ||
|
||
/*-------------------------------------------------------------------- | ||
* hypre_IntSequence |
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.
Can you add a description of what this function is doing?
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 in f6cfb03
|
||
/* Destroy temporary variables */ | ||
hypre_ParCSRMatrixDestroy(A_FC), A_FC = NULL; | ||
hypre_ParCSRMatrixDestroy(A_CF), A_CF = NULL; | ||
hypre_ParCSRMatrixDestroy(A_CC), A_CF = NULL; | ||
hypre_ParCSRMatrixDestroy(A_CC), A_CC = NULL; |
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 catch!
@@ -617,7 +612,7 @@ hypre_MGRSetup( void *mgr_vdata, | |||
/* Allocate memory for level structure */ | |||
if (A_array == NULL) | |||
{ | |||
A_array = hypre_CTAlloc(hypre_ParCSRMatrix*, max_num_coarse_levels, HYPRE_MEMORY_HOST); | |||
A_array = hypre_CTAlloc(hypre_ParCSRMatrix*, max_num_coarse_levels + 1, HYPRE_MEMORY_HOST); |
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.
Still wrapping my head around this one vs using the RAP_ptr, but it is not a big deal.
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 saves me some lines of code for computing MGR statistics in par_mgr_stats.c
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.
@victorapm, this looks good to me, thanks!
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 to me. Thanks!
Main changes are:
hypre_MGRSetup
implementationHYPRE_MGRSetNonGalerkinMaxElmts
to control truncation in MGR's non-galerkin optionmax_elmts == 0
(no truncation)par_mgr_rap.c
for coarse level matrix computation routinesAdditional changes that follow up:
hypre_CSRMatrixTruncateDiag
to truncate a matrix to its diagonalutilities/stl_ops.c
for STL-like operations valid for host and device.