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

Create pairwise_point_in_polygon to be used by pairwise GeoSeries #750

Merged
Rate limit · GitHub

Access has been restricted

You have triggered a rate limit.

Please wait a few minutes before you try again;
in some cases this may take up to an hour.

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Improve grid stride loop computations.
Rate limit · GitHub

Access has been restricted

You have triggered a rate limit.

Please wait a few minutes before you try again;
in some cases this may take up to an hour.

thomcom committed Nov 29, 2022
commit 1c02f3ca0df6163c40891777e2318b1499e69dd1
Original file line number Diff line number Diff line change
@@ -16,6 +16,7 @@

#pragma once

#include <cuspatial/cuda_utils.hpp>
#include <cuspatial/error.hpp>
#include <cuspatial/experimental/detail/is_point_in_polygon.cuh>
#include <cuspatial/traits.hpp>
@@ -52,9 +53,7 @@ __global__ void pairwise_point_in_polygon_kernel(Cart2dItA test_points_first,
{
using Cart2d = iterator_value_type<Cart2dItA>;
using OffsetType = iterator_value_type<OffsetIteratorA>;
for (auto idx = threadIdx.x + blockIdx.x * blockDim.x;
idx <
std::distance(test_points_first, thrust::prev(test_points_first + num_test_points + 1));
for (auto idx = threadIdx.x + blockIdx.x * blockDim.x; idx < num_test_points;
idx += gridDim.x * blockDim.x) {
Cart2d const test_point = test_points_first[idx];
// for the matching polygon
@@ -118,10 +117,8 @@ OutputIt pairwise_point_in_polygon(Cart2dItA test_points_first,
// TODO: introduce a validation function that checks the rings of the polygon are
// actually closed. (i.e. the first and last vertices are the same)

auto constexpr block_size = 256;
auto const num_blocks = (num_test_points + block_size - 1) / block_size;

detail::pairwise_point_in_polygon_kernel<<<num_blocks, block_size, 0, stream.value()>>>(
auto [threads_per_block, num_blocks] = grid_1d(num_test_points);
detail::pairwise_point_in_polygon_kernel<<<num_blocks, threads_per_block, 0, stream.value()>>>(
test_points_first,
num_test_points,
polygon_offsets_first,