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

Add header-only cuspatial::join_quadtree_and_bounding_boxes #861

Conversation

trxcllnt
Copy link
Contributor

Contributes to #565. Add header-only cuspatial::join_quadtree_and_bounding_boxes.

@trxcllnt trxcllnt requested a review from a team as a code owner December 20, 2022 02:51
@github-actions github-actions bot added the libcuspatial Relates to the cuSpatial C++ library label Dec 20, 2022
@trxcllnt trxcllnt added 3 - Ready for Review Ready for review by team improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels Dec 20, 2022
rmm::device_uvector<uint32_t> out_node_idxs(num_pairs, stream, mr);
rmm::device_uvector<uint32_t> out_bbox_idxs(num_pairs, stream, mr);

auto make_current_level_iter = [&]() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason to use a lambda here? It seems we should create the iterator as a variable instead.

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, this lambda closes over variables that are updated each iteration of the loop.

Copy link
Contributor

Choose a reason for hiding this comment

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

Do you mean that the iterators gets invalidated after every iteration of the loop?

Copy link
Contributor Author

@trxcllnt trxcllnt Jan 26, 2023

Choose a reason for hiding this comment

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

make_current_level_iter() returns a zip iterator over the cur_{types,levels,node_idxs,bbox_idxs} vectors, which represent the current level in the tree descent. The descend_quadtree() call walks one level in the tree and returns vectors representing the next "current level."

Similarly, make_output_values_iter() returns a zip iterator of num_results + out_{node,bbox}_idxs. num_results is updated by the detail::find_intersections() call.

The iterators returned by these functions are used both in setting up the initial state of the the top-level quadrants, and in the loop that does the tree traversal. An earlier implementation tracked and updated these two iterators each iteration of the loop, but they were refactored into these lambdas in a cleanup PR.

@codecov-commenter
Copy link

codecov-commenter commented Jan 2, 2023

Codecov Report

Base: 92.55% // Head: 92.58% // Increases project coverage by +0.02% 🎉

Coverage data is based on head (33c184b) compared to base (a614265).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@               Coverage Diff                @@
##           branch-23.02     #861      +/-   ##
================================================
+ Coverage         92.55%   92.58%   +0.02%     
================================================
  Files                24       24              
  Lines              1008     1011       +3     
================================================
+ Hits                933      936       +3     
  Misses               75       75              
Impacted Files Coverage Δ
...ython/cuspatial/cuspatial/core/spatial/distance.py 94.54% <100.00%> (+0.10%) ⬆️
python/cuspatial/cuspatial/utils/gis_utils.py 62.96% <100.00%> (+2.96%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@harrism harrism linked an issue Jan 23, 2023 that may be closed by this pull request
@harrism harrism linked an issue Jan 23, 2023 that may be closed by this pull request
@harrism harrism requested review from harrism and removed request for cwharris and zhangjianting January 23, 2023 22:03
Copy link
Member

@harrism harrism left a comment

Choose a reason for hiding this comment

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

Looks good, thanks Paul! Please update all copyrights in new / modified files to 2023.

Couple of minor comments. There are some places with really long lambdas that you could consider turning into functor classes for tidyness, but I'm not going to press the issue.

Copy link
Contributor

@isVoid isVoid left a comment

Choose a reason for hiding this comment

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

Thanks!

rmm::device_uvector<uint32_t> out_node_idxs(num_pairs, stream, mr);
rmm::device_uvector<uint32_t> out_bbox_idxs(num_pairs, stream, mr);

auto make_current_level_iter = [&]() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you mean that the iterators gets invalidated after every iteration of the loop?

@trxcllnt trxcllnt force-pushed the fea/header-only-join-quadtree-and-bounding-boxes branch from a7fc335 to 57a7a1e Compare February 1, 2023 23:18
@harrism
Copy link
Member

harrism commented Feb 1, 2023

/merge

@rapids-bot rapids-bot bot merged commit e4e79a5 into rapidsai:branch-23.02 Feb 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 - Ready for Review Ready for review by team improvement Improvement / enhancement to an existing function libcuspatial Relates to the cuSpatial C++ library non-breaking Non-breaking change
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[FEA] Refactor Spatial Join APIs to header-only
4 participants