-
Notifications
You must be signed in to change notification settings - Fork 139
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
Safer distance table implementation #2177
Conversation
The name 'forward' for the flag seems like it could be more descriptive. For me it invokes images of mail forwarding or C++ move operations. Thinking through the flag, what it does, and when it is used: Perhaps 'partial_update' or 'partial_table_update'? |
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.
Overall change is a step forward. There are a few typos to fix and some missed opportunities to modernize/clarify naming. Some of these could be address in a future PR.
src/Particle/DistanceTableData.h
Outdated
using IndexType = QMCTraits::IndexType; | ||
using RealType = QMCTraits::RealType; | ||
using PosType = QMCTraits::PosType; | ||
using DistRowType = Vector<RealType, aligned_allocator<RealType>>; |
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.
Type does not seem needed, DistRow with the type formatting sufficient.
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.
Removed Type
suffix.
src/Particle/DistanceTableData.h
Outdated
|
||
/** Displacements[N_targets]x[3][N_sources] | ||
* Note: This is a memory view using the memory space allocated in memoryPool | ||
* Note: Derived classes decide if it is a memory view or the actaully storage |
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.
actually
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.
fixed.
src/Particle/SoaDistanceTableAA.h
Outdated
int Ntargets_padded; | ||
|
||
///actual memory for Displacements | ||
aligned_vector<RealType> memoryPool_displs_; |
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.
strangely named method or variable? memory_pool_displs_
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.
fixed.
src/Particle/DistanceTableData.h
Outdated
* @param P the target particle set | ||
* @param rnew proposed new position | ||
* @param iat the particle to be moved | ||
* @param prepare_old if true, prepare old distances and displacements for using getOldDists and getOldDispls functions 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.
hopefully temporary
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 old values should be temporarily used only.
src/Particle/DistanceTableData.h
Outdated
|
||
/** return the temporary distances when a move is proposed | ||
*/ | ||
const DistRowType& getTemporalDists() const { return Temp_r; } |
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.
getTempDists() is clearer to me. Temporal is not a common synonym of temporary.
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.
All changed.
@markdewing I changed DTD forward to partial_update and ParticleSet forward to partial_table_update as you suggested. |
This is moving in a good direction. It is clear that the design is still not right - it is too complex still, although this is definitely an improvement. Perhaps indicating where state is involved in the function names might help. |
This PR focuses on ParticleSet and DistanceTableData implementation.
Changes are:
Overall, less safe codepath for optimization are more tightly controlled. It allows to write working but non-optimal code easier because state machines are less exposed.
Since the base class DistanceTableData is more of an abstraction and actual data are moved to derived class. DistanceTable is a more appropriate name. I will do renaming in a separate PR.