-
Notifications
You must be signed in to change notification settings - Fork 154
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
Header-only refactoring of points_in_spatial_window
#579
Header-only refactoring of points_in_spatial_window
#579
Conversation
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.
Only several minor comments. At first I find it striking to see the refactor breaks the original function into two kernel calls. Later I realized cudf::copy_if
does two kernel launches internally (one pass to count the output size and another pass to copy the result).
Yes that's what I explained here: #579 (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.
Just some doc related issue.
rmm::cuda_stream_view stream = rmm::cuda_stream_default); | ||
|
||
/** | ||
* @brief Find all points (x,y) that fall within a rectangular query window. |
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.
Specify cartesian coordinates, I think.
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.
Down the road this, along with pip, would be really effective if they took a coordinate system pair as arguments.
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.
Actually I don't think we have to limit this to cartesian coordinates. This is effectively a 2D range query. There's no reason you can't use lonlat points and a 2D lonlat range.
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.
(In the future we may want to replace this API with a generic ND range query API...)
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 think that's strictly true - lon/lat is not cartesian. There exist points along a line of longitude that fall inside of the spherical "rectangle" defined by a lower left and upper right pair of coordinates that do not fall inside of the cartesian rectangle that is defined by those same coordinates.
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.
The API doesn't specify that the points are in any projection -- they can be Cartesian, Lon/Lat, or anything else, as long as the query window and the points are coordinates in the same dimensions. This is a good reason to replace this with an API called "points_in_range" or something like that.
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've renamed the APIs and clarified the docs. See commit #88e7ee1 and after.
Co-authored-by: Michael Wang <isVoid@users.noreply.github.com>
@gpucibot merge |
Fixes #564
A couple of notes:
copy_points_in_range()
rather thanpoints_in_spatial_window()
. This is the reflect that it is a range filter, and we may want to enable constraining the dimensions of the range in the future.copy_points_in_range()
, this PR also adds a new function,cuspatial::count_points_in_range()
.Previously, the cuDF-based API used
cudf::copy_if
, which does the equivalent of both of the above functions and returns a properly sized pair of columns. The new column-based implementation callscount_points_in_range
, then allocates the result columns, and then callscuspatial::copy_points_in_range()
.