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
Implement AlignedVector::shrink_to_fit() #15974
Conversation
/rebuild |
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 make sure this function is not called if someone had previously called replicate_across_communicator()
?
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 once you have addressed @bangerth's comment and have added a change-log entry.
Sure, see the last commit. @bangerth But wouldn't this logic apply to every non- |
/** | ||
* Flag indicating if replicate_across_communicator() has been called. | ||
*/ | ||
bool replicated_across_communicator; |
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.
Should we guard this with ifdef. Similar as we do in FEEval?
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.
In FEEvaluationData
we don't guard the declaration of the variables but all occurrences in definitions (also in asserts, initialization in constructors). Done.
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.
Odd that the compiler does not warn that the variable is not initialized.
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 would leave it like this if the compiler does not complain, otherwise, the size of the vector is different for release and debug because of the additional member.
dbe653f
to
bb17bfb
Compare
DeclExceptionMsg(ExcAlignedVectorChangeAfterReplication, | ||
"Changing the vector after a call to " | ||
"replicate_across_communicator() is not allowed."); |
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 have introduced this exception message which we can use for all non-const functions in a follow-up.
# ifdef DEBUG | ||
Assert(replicated_across_communicator == false, | ||
ExcAlignedVectorChangeAfterReplication()); | ||
# endif |
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 guess we don't need to guard this. Assert is only performed in debug 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.
In FEEvaluationData
the Assert
s are also guarded by #ifdef DEBUG
. I can remove it if it is not necessary.
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.
OK. Let's keep it this way to be consistent.
@bangerth Any final comments? The requested assert has been added. |
Ping I want to use this to release memory after mapping compression in |
No description provided.