-
Notifications
You must be signed in to change notification settings - Fork 277
[Core][MPI] Adding SpatialSearchResultContainer/SpatialSearchResultContainerVector and SearchWrapper (v.4.5)
#11719
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
base: master
Are you sure you want to change the base?
[Core][MPI] Adding SpatialSearchResultContainer/SpatialSearchResultContainerVector and SearchWrapper (v.4.5)
#11719
Conversation
|
|
||
| #ifndef KRATOS_BASE_DATA_COMMUNICATOR_DECLARE_ALLREDUCE_LOC_INTERFACE_FOR_TYPE | ||
| #define KRATOS_BASE_DATA_COMMUNICATOR_DECLARE_ALLREDUCE_LOC_INTERFACE_FOR_TYPE(...) \ | ||
| virtual std::pair<__VA_ARGS__, int> MinLocAll(const __VA_ARGS__& rLocalValue) const { return std::pair<__VA_ARGS__, int>(rLocalValue, 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.
just to be sure:
the data_communicator changes being reviewed in a different PR, am i correct?
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.
| const auto& r_local_min = r_local_bb.GetMinPoint(); | ||
|
|
||
| // Getting max values | ||
| r_max[0] = mrDataCommunicator.MaxAll(r_local_max[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.
unimportant question (just ignore if you feel) but, isn't there a vector version of this? i mean one that considers the vector of components instead of each component separately
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 know, if I can simplify the code that would be welcomed
| if (mrDataCommunicator.IsDistributed()) { | ||
| DistributedSearchInRadius(rPoint, Radius, rResults, SyncronizeResults); | ||
| } else { // Call serial version | ||
| SerialSearchInRadius(rPoint, Radius, rResults, SyncronizeResults); |
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 do you pass the "SyncronizeResults" flag to the serial version? in that case it can only be in sync
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.
Let me check if I can simplify code, originally this was supposed to be a derived class and when refactored the code maybe I copy pasted to much
RiccardoRossi
left a comment
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 the impression that this is really not ready for prime time.
@loumalouomega can we have a call to speak about this ?
|
After all PR are merged, this is ready for final review |
|
@pooyan-dadvand @RiccardoRossi I removed the shared_ptr |
|
@RiccardoRossi you mentioned a random pooyan instead of @pooyan-dadvand |
roigcarlo
left a comment
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.
Aside for the fact that I still find the search_wrapper odd, I see no other problem.
@RiccardoRossi for me this is ok to merge...
…est and SearchIsInside methods
…clarity in ParallelSpatialSearch
|
I think this is definetively ready @pooyan-dadvand |
…d improve MPI handling" This reverts commit 9726a34.
|
|
||
| // Remove the non lowest rank results | ||
| Timer::Start("ParallelSpatialSearch::KeepOnlyLowestRankResult"); | ||
| KeepOnlyLowestRankResult(rResults); |
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.
@pooyan-dadvand I reverted this, because I didn't remember, but search are locals, for performance reasons, and it is not possible to use a syncronous data communicator inside the search, otherwise it gets stuck, and thats why the last CI after 9726a34 was failing.
This is far more efficient than performing a global search with all partitions at once.
… with closest result filtering
📝 Description
#11416 + addressed comments
This PR introduces a new class named
SpatialSearchResultContainer,SpatialSearchResultContainerVectoras well asSearchWrapper. The two first classes provides storage and operations related to spatial search results. In additionSearchWrapperclass implements an interface for serial/MPI search for different search objects, in current PR addingGeometricalObjectBinsand the available trees.The
SpatialSearchResultContainerclass stores:PointerVectorSet)The class includes functions such as,
SynchronizeAll,HasResult,GetResultIndices,AddResult... The interesting part is that integrates a global pointer communicator, so it is possible to calculate anything passing a functor. The most common operations required are already implemented:GetResultShapeFunctions,GetResultIndicesandGetResultCoordinates,The
SynchronizeAllmethod synchronizes the container between partitions. TheAddResultmethod adds a result to the local pointers. There is apush_backwhich does the same.The
SpatialSearchResultContainerVectorclass stores a std::vector ofSpatialSearchResultContainerpointers. In theSearchWrapperclass the index of the vector corresponds with the node id when using nodes and just a counter when simply searching.Considering general data communicator instead of sub data communicator
TODO: Using coloring utilities instead of manual coloring
🆕 Changelog
spatial_search_result_container.cpp,spatial_search_result_container.hmspatial_search_result_container_vector.cppandspatial_search_result_container_vector.hfiles have been added, representing the implementation and header for theSpatialSearchResultContainerandSpatialSearchResultContainerVectorclasses.SpatialSearchResultContainerandSpatialSearchResultContainerVectorSpatialSearchResultContainerandSpatialSearchResultContainerVectorSearchWrapperclass, currently just implementedGeometricalObjectBins.SearchWrapper.MinLocAllandMaxLocAlltoDataCommunicator#11712PointObjectin different file #11725GetBoundingBoxinTreeclass. Plus adding documentation #11730ObjectTypeandPointTypeinGeometricalObjectsBins#11731ObjectTypeforPointObject#11735GetObjectTypeand defineObjectTypeinTree#11737GetObjectTypeintree.h#11739ObjectTypeinDynamicBins#11741SearchInRadiusinGeometricalObjectBins#11754SetRankmethod toGlobalPointer+ documentation #11762GetDataCommunicatortoGlobalPointerCommunicator#11794SynchronizePointsWithBoundingBoxmethod #11877Getmethod inSpatialSearchResult#12002SearchUtilities#13929SpatialSearchResultContaineraddingSpatialSearchCommunicatorenumSpatialSearchResultContainerVectoraddingSpatialSearchCommunicatorenumSearchWrapperconsistently