-
Notifications
You must be signed in to change notification settings - Fork 156
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 API for Linestring-Polygon Distance #1011
Add Header Only API for Linestring-Polygon Distance #1011
Conversation
…ed to test more rigidly
…gon_distance_header
…al into feature/segment_iterators
…gon_distance_header
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/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
There is OOB error with compute sanitizer, hold on.. |
Fixed |
cpp/include/cuspatial/experimental/ranges/multipolygon_range.cuh
Outdated
Show resolved
Hide resolved
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.
Looks good!
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
// 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())); |
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.
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.
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.
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.
/merge |
Description
This PR adds
linestring-polygon
distance 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