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

Refactor functions in join.py to accept GeoSeries Input #948

Merged
46 changes: 21 additions & 25 deletions python/cuspatial/benchmarks/api/bench_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ def bench_quadtree_on_points(benchmark, gpu_dataframe):


def bench_quadtree_point_in_polygon(benchmark, polygons):
df = polygons
polygons = polygons["geometry"].polygons
x_points = (cupy.random.random(50000000) - 0.5) * 360
y_points = (cupy.random.random(50000000) - 0.5) * 180
Expand Down Expand Up @@ -198,12 +199,8 @@ def bench_quadtree_point_in_polygon(benchmark, polygons):
intersections,
quadtree,
point_indices,
x_points,
y_points,
polygons.part_offset,
polygons.ring_offset,
polygons.x,
polygons.y,
points,
df["geometry"],
)


Expand All @@ -227,6 +224,14 @@ def bench_quadtree_point_to_nearest_linestring(benchmark):
points = cuspatial.GeoSeries.from_points_xy(
cudf.DataFrame({"x": points_x, "y": points_y}).interleave_columns()
)

linestrings = cuspatial.GeoSeries.from_linestrings_xy(
cudf.DataFrame(
{"x": polygons.x, "y": polygons.y}
).interleave_columns(),
polygons.ring_offset,
cupy.arange(len(polygons.ring_offset)),
)
point_indices, quadtree = cuspatial.quadtree_on_points(
points,
polygons.x.min(),
Expand Down Expand Up @@ -255,26 +260,17 @@ def bench_quadtree_point_to_nearest_linestring(benchmark):
intersections,
quadtree,
point_indices,
points_x,
points_y,
polygons.ring_offset,
polygons.x,
polygons.y,
points,
linestrings,
)


def bench_point_in_polygon(benchmark, gpu_dataframe):
x_points = (cupy.random.random(50000000) - 0.5) * 360
y_points = (cupy.random.random(50000000) - 0.5) * 180
short_dataframe = gpu_dataframe.iloc[0:32]
geometry = short_dataframe["geometry"]
polygon_offset = cudf.Series(geometry.polygons.geometry_offset[0:31])
benchmark(
cuspatial.point_in_polygon,
x_points,
y_points,
polygon_offset,
geometry.polygons.ring_offset,
geometry.polygons.x,
geometry.polygons.y,
def bench_point_in_polygon(benchmark, polygons):
x_points = (cupy.random.random(5000) - 0.5) * 360
y_points = (cupy.random.random(5000) - 0.5) * 180
points = cuspatial.GeoSeries.from_points_xy(
cudf.DataFrame({"x": x_points, "y": y_points}).interleave_columns()
)
short_dataframe = polygons.iloc[0:31]
geometry = short_dataframe["geometry"]
benchmark(cuspatial.point_in_polygon, points, geometry)
Loading