This repository was archived by the owner on Jul 28, 2025. It is now read-only.
Add Header Only API for Linestring-Polygon Distance#1011
Merged
rapids-bot[bot] merged 42 commits intorapidsai:branch-23.04from Apr 6, 2023
Merged
Conversation
…ed to test more rigidly
…gon_distance_header
…al into feature/segment_iterators
…gon_distance_header
isVoid
commented
Apr 3, 2023
cpp/include/cuspatial/experimental/detail/linestring_polygon_distance.cuh
Outdated
Show resolved
Hide resolved
cpp/include/cuspatial/experimental/detail/linestring_polygon_distance.cuh
Outdated
Show resolved
Hide resolved
cpp/include/cuspatial/experimental/detail/linestring_polygon_distance.cuh
Outdated
Show resolved
Hide resolved
cpp/include/cuspatial/experimental/detail/linestring_polygon_distance.cuh
Show resolved
Hide resolved
cpp/include/cuspatial/experimental/detail/linestring_polygon_distance.cuh
Outdated
Show resolved
Hide resolved
cpp/include/cuspatial/experimental/detail/linestring_polygon_distance.cuh
Outdated
Show resolved
Hide resolved
cpp/include/cuspatial/experimental/detail/linestring_polygon_distance.cuh
Outdated
Show resolved
Hide resolved
cpp/include/cuspatial/experimental/detail/linestring_polygon_distance.cuh
Outdated
Show resolved
Hide resolved
cpp/include/cuspatial/experimental/detail/ranges/multipolygon_range.cuh
Outdated
Show resolved
Hide resolved
…om:isVoid/cuspatial into feature/linestring_polygon_distance_header
Contributor
Author
|
There is OOB error with compute sanitizer, hold on.. |
Contributor
Author
Fixed |
thomcom
reviewed
Apr 4, 2023
harrism
approved these changes
Apr 5, 2023
cpp/include/cuspatial/experimental/detail/linestring_polygon_distance.cuh
Outdated
Show resolved
Hide resolved
cpp/include/cuspatial/experimental/detail/linestring_polygon_distance.cuh
Outdated
Show resolved
Hide resolved
…into feature/linestring_polygon_distance_header
thomcom
reviewed
Apr 5, 2023
Comment on lines
+128
to
+144
| // Compute the "boundary" of threads. Threads are partitioned based on the number of linestrings | ||
| // times the number of polygons in a multipoint-multipolygon pair. | ||
| auto segment_count_product_it = thrust::make_transform_iterator( | ||
| thrust::make_zip_iterator(multilinestrings.multilinestring_segment_count_begin(), | ||
| multipolygons.multipolygon_segment_count_begin()), | ||
| thrust::make_zip_function(thrust::multiplies<index_t>{})); | ||
|
|
||
| // Computes the "thread boundary" of each pair. This array partitions the thread range by | ||
| // geometries. E.g. threadIdx within [thread_bounds[i], thread_bounds[i+1]) computes distances of | ||
| // the ith pair. | ||
| auto thread_bounds = rmm::device_uvector<index_t>(multilinestrings.size() + 1, stream); | ||
| detail::zero_data_async(thread_bounds.begin(), thread_bounds.end(), stream); | ||
|
|
||
| thrust::inclusive_scan(rmm::exec_policy(stream), | ||
| segment_count_product_it, | ||
| segment_count_product_it + thread_bounds.size() - 1, | ||
| thrust::next(thread_bounds.begin())); |
Contributor
There was a problem hiding this comment.
You've probably already thought of this but I see you wanting to have the thread partitioning code here and above refactored into a utility space for reuse in other algorithms.
Contributor
Author
There was a problem hiding this comment.
Yeah, this will come pretty handy when I start applying this parallel modality to other algorithms. I'm writing a refactor plan to st_distance and this will be factored out as part of that.
thomcom
approved these changes
Apr 5, 2023
Contributor
Author
|
/merge |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds
linestring-polygondistance API. This API divides up the work into two parts: point-in-polygon test and a load-balanced all-pairs segment-segment distance compute kernel.Closes #1027
Depends on #1026
Contributes to #757
Checklist