From f7c22ace531921522c4b6bc2a705c1269d70eb70 Mon Sep 17 00:00:00 2001 From: ptaylor Date: Wed, 21 Feb 2024 16:28:01 +0000 Subject: [PATCH 1/2] check result sizes to make test fail --- cpp/tests/join/quadtree_point_in_polygon_test_large.cu | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cpp/tests/join/quadtree_point_in_polygon_test_large.cu b/cpp/tests/join/quadtree_point_in_polygon_test_large.cu index 1be866afc..8776a4afc 100644 --- a/cpp/tests/join/quadtree_point_in_polygon_test_large.cu +++ b/cpp/tests/join/quadtree_point_in_polygon_test_large.cu @@ -159,10 +159,13 @@ TYPED_TEST(PIPRefineTestLarge, TestLarge) quadtree, point_indices.begin(), point_indices.end(), - points.begin(), + points_in.begin(), multipolygons, this->stream()); + EXPECT_GT(actual_point_indices.size(), 0); + EXPECT_GT(actual_poly_indices.size(), 0); + thrust::stable_sort_by_key(rmm::exec_policy(this->stream()), actual_point_indices.begin(), actual_point_indices.end(), @@ -208,6 +211,9 @@ TYPED_TEST(PIPRefineTestLarge, TestLarge) auto d_expected_poly_indices = rmm::device_vector(expected_poly_indices); auto d_expected_point_indices = rmm::device_vector(expected_point_indices); + EXPECT_GT(d_expected_poly_indices.size(), 0); + EXPECT_GT(d_expected_point_indices.size(), 0); + thrust::stable_sort_by_key(rmm::exec_policy(this->stream()), d_expected_point_indices.begin(), d_expected_point_indices.end(), From c27ea1041adf91e1d19b1980c5e6eb4163bb9cbe Mon Sep 17 00:00:00 2001 From: ptaylor Date: Wed, 21 Feb 2024 08:48:31 -0800 Subject: [PATCH 2/2] fix JOIN_POINT_IN_POLYGON_LARGE_TEST_EXP test --- .../quadtree_point_in_polygon_test_large.cu | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/cpp/tests/join/quadtree_point_in_polygon_test_large.cu b/cpp/tests/join/quadtree_point_in_polygon_test_large.cu index 8776a4afc..dbbe1d44d 100644 --- a/cpp/tests/join/quadtree_point_in_polygon_test_large.cu +++ b/cpp/tests/join/quadtree_point_in_polygon_test_large.cu @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, NVIDIA CORPORATION. + * Copyright (c) 2023-2024, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -52,18 +52,18 @@ template inline auto generate_points( std::vector> const& quads, uint32_t points_per_quad, + cuspatial::vec_2d v_min, + cuspatial::vec_2d v_max, std::size_t seed, rmm::cuda_stream_view stream, rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) { - auto engine = cuspatial::test::deterministic_engine(0); - auto uniform = cuspatial::test::make_normal_dist(0.0, 1.0); - auto pgen = cuspatial::test::point_generator(cuspatial::vec_2d{0.0, 0.0}, - cuspatial::vec_2d{1.0, 1.0}, - engine, - engine, - uniform, - uniform); + auto engine_x = cuspatial::test::deterministic_engine(42); + auto engine_y = cuspatial::test::deterministic_engine(137); + auto uniform_x = cuspatial::test::make_normal_dist(v_min.x, v_max.x); + auto uniform_y = cuspatial::test::make_normal_dist(v_min.y, v_max.y); + auto pgen = + cuspatial::test::point_generator(v_min, v_max, engine_x, engine_y, uniform_x, uniform_y); auto num_points = quads.size() * points_per_quad; rmm::device_uvector> points(num_points, stream, mr); @@ -96,12 +96,12 @@ TYPED_TEST(PIPRefineTestLarge, TestLarge) {7, 8, 3, 4}, {0, 4, 4, 8}}; - auto points_in = generate_points(quads, min_size, 0, this->stream()); + auto points_in = generate_points(quads, min_size, v_min, v_max, 0, this->stream()); - auto [point_indices, quadtree] = quadtree_on_points( + auto [point_indices, quadtree] = cuspatial::quadtree_on_points( points_in.begin(), points_in.end(), v_min, v_max, scale, max_depth, min_size, this->stream()); - auto points = rmm::device_uvector>(quads.size() * min_size, this->stream()); + auto points = rmm::device_uvector>(point_indices.size(), this->stream()); thrust::gather(rmm::exec_policy(this->stream()), point_indices.begin(), point_indices.end(), @@ -174,17 +174,17 @@ TYPED_TEST(PIPRefineTestLarge, TestLarge) { // verify rmm::device_uvector hits(points.size(), this->stream()); - auto points_range = make_multipoint_range( + auto points_range = cuspatial::make_multipoint_range( points.size(), thrust::make_counting_iterator(0), points.size(), points.begin()); - auto polygons_range = make_multipolygon_range(multipolygons.size(), - thrust::make_counting_iterator(0), - multipolygons.size(), - multipolygons.part_offset_begin(), - multipolygons.num_rings(), - multipolygons.ring_offset_begin(), - multipolygons.num_points(), - multipolygons.point_begin()); + auto polygons_range = cuspatial::make_multipolygon_range(multipolygons.size(), + thrust::make_counting_iterator(0), + multipolygons.size(), + multipolygons.part_offset_begin(), + multipolygons.num_rings(), + multipolygons.ring_offset_begin(), + multipolygons.num_points(), + multipolygons.point_begin()); auto hits_end = cuspatial::point_in_polygon(points_range, polygons_range, hits.begin(), this->stream());