Skip to content
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

Finalize BasicBoundingVolumeHierarchy #915

Merged
merged 3 commits into from
Oct 26, 2023

Conversation

aprokop
Copy link
Contributor

@aprokop aprokop commented Jul 24, 2023

I added a Wiki to document the current state (though, Wiki contains RangeTraits which are not part of this PR).

Generally, I think BasicBoundingVolumeHierarchy is close to done. The things that remain:

  • Use RangeAdaptor instead of AccessTraits
  • Figure out if we want an additional template parameter, Parameters, similar to boost:
template<typename Value,
         typename Parameters,
         typename IndexableGetter = index::indexable<Value>,
         typename EqualTo = index::equal_to<Value>,
         typename Allocator = boost::container::new_allocator<Value>>

Worth thinking if BVH<MemorySpace, Value, IndexableGetter, Parameters...> is what we want, where Parameters... could include bounding volume and other parameters governing tree structure in the future.

We may also want to consider providing some convenient way to build a hierarchy based on pairs index + geometry, as that is a common use case. Maybe, rename LegacyValues to something more palatable to a user.

test/CMakeLists.txt Outdated Show resolved Hide resolved
@aprokop aprokop added enhancement New feature or request refactoring Code reorganization labels Jul 25, 2023
@aprokop
Copy link
Contributor Author

aprokop commented Jul 25, 2023

Added wiki (see opening post).

@masterleinad
Copy link
Collaborator

Added wiki (see opening post).

Any reason not to create a pull request for the Wiki at this point?

@aprokop
Copy link
Contributor Author

aprokop commented Jul 26, 2023

Any reason not to create a pull request for the Wiki at this point?

Created. I found it inconvenient to browse a PR, but now anyone can edit.

@aprokop aprokop mentioned this pull request Jul 26, 2023
@aprokop aprokop marked this pull request as ready for review August 30, 2023 16:15
src/ArborX_LinearBVH.hpp Outdated Show resolved Hide resolved
src/details/ArborX_AccessTraits.hpp Outdated Show resolved Hide resolved
test/CMakeLists.txt Outdated Show resolved Hide resolved
@aprokop
Copy link
Contributor Author

aprokop commented Aug 30, 2023

OK, I removed RangeTraits changes, that was too much. Now it only changes the constructor.

@aprokop
Copy link
Contributor Author

aprokop commented Aug 31, 2023

Huge performance regressions, investigating.

@aprokop
Copy link
Contributor Author

aprokop commented Sep 21, 2023

Summit

MST HACC 37M

master (2d3c687)

ArborX version    : 1.5 (dev)
ArborX hash       : 2d3c6877
Kokkos version    : 4.0.99
algorithm         : mst
minpts            : 1
filename          : /ccs/home/aprokop/csc333/hacc_37M.arborx [binary, max_pts = -1]
samples           : -1
verbose           : true
Reading in "/ccs/home/aprokop/csc333/hacc_37M.arborx" in binary mode...done
Read in 36902719 3D points
-- construction     :      0.103
-- boruvka          :      0.523
total time          :      0.645

branch (e557644)

ArborX version    : 1.5 (dev)
ArborX hash       : e557644a
Kokkos version    : 4.0.99
algorithm         : mst
minpts            : 1
filename          : /ccs/home/aprokop/csc333/hacc_37M.arborx [binary, max_pts = -1]
samples           : -1
verbose           : true
Reading in "/ccs/home/aprokop/csc333/hacc_37M.arborx" in binary mode...done
Read in 36902719 3D points
-- construction     :      0.090
-- boruvka          :      0.491
total time          :      0.599

MST 5D VisualSim 10M

master (2d3c687)

ArborX hash       : 2d3c6877                                                                                                                                   [7/48167]
Kokkos version    : 4.0.99
algorithm         : mst
minpts            : 1
filename          : /ccs/home/aprokop/csc333/5D_VisualSim_10M.arborx [binary, max_pts = -1]
samples           : -1
verbose           : true
Reading in "/ccs/home/aprokop/csc333/5D_VisualSim_10M.arborx" in binary mode...done
Read in 10000000 5D points
-- construction     :      0.039
-- boruvka          :      0.381
total time          :      0.427

branch (e557644)

ArborX version    : 1.5 (dev)
ArborX hash       : e557644a
Kokkos version    : 4.0.99
algorithm         : mst
minpts            : 1
filename          : /ccs/home/aprokop/csc333/5D_VisualSim_10M.arborx [binary, max_pts = -1]
samples           : -1
verbose           : true
Reading in "/ccs/home/aprokop/csc333/5D_VisualSim_10M.arborx" in binary mode...done
Read in 10000000 5D points
-- construction     :      0.034
-- boruvka          :      0.397
total time          :      0.437

DBSCAN HACC 37M

master (2d3c687)

ArborX version    : 1.5 (dev)
ArborX hash       : 2d3c6877
Kokkos version    : 4.0.99
algorithm         : dbscan
eps               : 0.042000
cluster min size  : 1
implementation    : fdbscan
verify            : false
minpts            : 5
filename          : /ccs/home/aprokop/csc333/hacc_37M.arborx [binary, max_pts = -1]
samples           : -1
verbose           : true
Reading in "/ccs/home/aprokop/csc333/hacc_37M.arborx" in binary mode...done
Read in 36902719 3D points
-- construction     :      0.103
-- query+cluster    :      0.336
---- neigh          :      0.060
---- query          :      0.262
-- postprocess      :      0.018
total time          :      0.461

#clusters       : 363244
#cluster points : 16958096 [45.95%]
#noise   points : 19944623 [54.05%]

branch (e557644)

ArborX version    : 1.5 (dev)
ArborX hash       : e557644a
Kokkos version    : 4.0.99
algorithm         : dbscan
eps               : 0.042000
cluster min size  : 1
implementation    : fdbscan
verify            : false
minpts            : 5
filename          : /ccs/home/aprokop/csc333/hacc_37M.arborx [binary, max_pts = -1]
samples           : -1
verbose           : true
Reading in "/ccs/home/aprokop/csc333/hacc_37M.arborx" in binary mode...done
Read in 36902719 3D points
-- construction     :      0.092
-- query+cluster    :      0.290
---- neigh          :      0.057
---- query          :      0.221
-- postprocess      :      0.018
total time          :      0.405

#clusters       : 363244
#cluster points : 16958096 [45.95%]
#noise   points : 19944623 [54.05%]

@aprokop
Copy link
Contributor Author

aprokop commented Sep 21, 2023

@dalg24 OK, this should be ready. Please review.

Copy link
Collaborator

@masterleinad masterleinad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the biggest question is how to expose this new interface to users who are using BVH directly. Should we create a new class and deprecate BVH or rather a backward incompatible change?

examples/triangle_intersection/triangle_intersection.cpp Outdated Show resolved Hide resolved
src/ArborX_LinearBVH.hpp Outdated Show resolved Hide resolved
src/details/ArborX_DetailsLegacy.hpp Outdated Show resolved Hide resolved
test/tstKokkosToolsDistributedAnnotations.cpp Outdated Show resolved Hide resolved
@aprokop
Copy link
Contributor Author

aprokop commented Oct 5, 2023

I think the biggest question is how to expose this new interface to users who are using BVH directly. Should we create a new class and deprecate BVH or rather a backward incompatible change?

This is indeed the big question. I think in order to deprecate the old class, we would need to provide something new in the ArborX:: namespace. I think maybe rename BasicBoundingVolumeHierarchy to something more meaningful.

examples/triangle_intersection/triangle_intersection.cpp Outdated Show resolved Hide resolved
src/details/ArborX_IndexableGetter.hpp Show resolved Hide resolved
src/details/ArborX_DetailsLegacy.hpp Outdated Show resolved Hide resolved
src/details/ArborX_DetailsLegacy.hpp Outdated Show resolved Hide resolved
src/details/ArborX_DetailsLegacy.hpp Outdated Show resolved Hide resolved
test/tstQueryTreeDegenerate.cpp Outdated Show resolved Hide resolved
test/tstQueryTreeDegenerate.cpp Outdated Show resolved Hide resolved
test/tstKokkosToolsDistributedAnnotations.cpp Outdated Show resolved Hide resolved
test/tstQueryTreeCallbacks.cpp Outdated Show resolved Hide resolved
test/tstDetailsTreeConstruction.cpp Show resolved Hide resolved
@aprokop
Copy link
Contributor Author

aprokop commented Oct 18, 2023

@masterleinad @dalg24 Addressed all your comments.

Copy link
Collaborator

@masterleinad masterleinad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine with me.

src/ArborX_LinearBVH.hpp Outdated Show resolved Hide resolved
src/ArborX_LinearBVH.hpp Outdated Show resolved Hide resolved
test/CMakeLists.txt Outdated Show resolved Hide resolved
@aprokop
Copy link
Contributor Author

aprokop commented Oct 24, 2023

@dalg24 Done.

If both DefaultIndexableGetter has const ref pair argument, and
Indexables have decltype(auto) return, this ends up in a wrong result
(likely to the handling of temporaries). This leads to a
default-initialized scene bounding box, which leads to same Morton
codes, which leads to f-d up hierarchy.

Providing a second operator()(PairIndexVolume<Geometry> &&pair) operator
in DefaultIndexableGetter fixes that.
Copy link
Contributor

@dalg24 dalg24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comments. Pretty good overall.

test/tstQueryTreeDegenerate.cpp Show resolved Hide resolved
test/Search_UnitTestHelpers.hpp Outdated Show resolved Hide resolved
test/CMakeLists.txt Outdated Show resolved Hide resolved
"using KDOP6 = ArborX::Experimental::KDOP<6>;\n"
"using KDOP14 = ArborX::Experimental::KDOP<14>;\n"
"using KDOP18 = ArborX::Experimental::KDOP<18>;\n"
"using KDOP26 = ArborX::Experimental::KDOP<26>;\n"
"template <class MemorySpace> using ArborX__BoundingVolumeHierarchy_${_bounding_volume} = ArborX::BasicBoundingVolumeHierarchy<MemorySpace, ArborX::Details::PairIndexVolume<${_bounding_volume}>, ArborX::Details::DefaultIndexableGetter, ${_bounding_volume}>;\n"
"template <class MemorySpace>\n"
"using ArborX__BoundingVolumeHierarchy_${_bounding_volume} =\n"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We only want to test the legacy code path here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. BVH only has MemorySpace, no bounding volume, so impossible to run KDOPs with.

@aprokop
Copy link
Contributor Author

aprokop commented Oct 26, 2023

The triangle example with mapping is unstable on SYCL (build, rebuild). Has nothing to do with the PR. Everything else is good.

"#define ARBORX_TEST_TREE_TYPES Tuple<ArborX::BVH>\n"
"#include \"ArborXTest_LegacyTree.hpp\"\n"
"template <class MemorySpace>\n"
"using ArborX_Legacy_BasicBVH_Box =\n"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit long mangled name would have done ArborX_LegacyBVH but not blocking

"template <class MemorySpace> using ArborX__BoundingVolumeHierarchy_${_bounding_volume} = ArborX::BasicBoundingVolumeHierarchy<MemorySpace, ArborX::Details::PairIndexVolume<${_bounding_volume}>, ArborX::Details::DefaultIndexableGetter, ${_bounding_volume}>;\n"
"#define ARBORX_TEST_TREE_TYPES Tuple<ArborX__BoundingVolumeHierarchy_${_bounding_volume}>\n"
"template <class MemorySpace>\n"
"using ArborX_Legacy_BasicBVH_${_bounding_volume} =\n"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would drop the "basic" and say ArborX_LegacyBVH_. also not blocking

@aprokop aprokop merged commit 2abcb6c into arborx:master Oct 26, 2023
2 checks passed
@aprokop aprokop deleted the 9-constructor_values branch October 26, 2023 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request refactoring Code reorganization
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants