From 344328b81851c3994a4eeff82186d19a8404d199 Mon Sep 17 00:00:00 2001 From: Conor Hoekstra Date: Fri, 25 Jun 2021 20:34:56 -0400 Subject: [PATCH 1/7] Update conda env files --- conda/environments/cuspatial_dev_cuda11.0.yml | 4 ++-- conda/environments/cuspatial_dev_cuda11.1.yml | 4 ++-- conda/environments/cuspatial_dev_cuda11.2.yml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/conda/environments/cuspatial_dev_cuda11.0.yml b/conda/environments/cuspatial_dev_cuda11.0.yml index 4e5d63fc5..935b5b3e5 100644 --- a/conda/environments/cuspatial_dev_cuda11.0.yml +++ b/conda/environments/cuspatial_dev_cuda11.0.yml @@ -5,8 +5,8 @@ channels: - rapidsai-nightly - conda-forge dependencies: - - clang=8.0.1 - - clang-tools=8.0.1 + - clang=11.0.0 + - clang-tools=11.0.0 - cudf=21.08.* - cudatoolkit=11.0 - gdal>=3.0.2 diff --git a/conda/environments/cuspatial_dev_cuda11.1.yml b/conda/environments/cuspatial_dev_cuda11.1.yml index 9c54d48fb..f8f76eee5 100644 --- a/conda/environments/cuspatial_dev_cuda11.1.yml +++ b/conda/environments/cuspatial_dev_cuda11.1.yml @@ -5,8 +5,8 @@ channels: - rapidsai-nightly - conda-forge dependencies: - - clang=8.0.1 - - clang-tools=8.0.1 + - clang=11.0.0 + - clang-tools=11.0.0 - cudf=21.08.* - cudatoolkit=11.1 - gdal>=3.0.2 diff --git a/conda/environments/cuspatial_dev_cuda11.2.yml b/conda/environments/cuspatial_dev_cuda11.2.yml index c401b299f..65f3ed354 100644 --- a/conda/environments/cuspatial_dev_cuda11.2.yml +++ b/conda/environments/cuspatial_dev_cuda11.2.yml @@ -5,8 +5,8 @@ channels: - rapidsai-nightly - conda-forge dependencies: - - clang=8.0.1 - - clang-tools=8.0.1 + - clang=11.0.0 + - clang-tools=11.0.0 - cudf=21.08.* - cudatoolkit=11.2 - gdal>=3.0.2 From 8098ac43771c2272dbc8c54170d53edac1a32406 Mon Sep 17 00:00:00 2001 From: Conor Hoekstra Date: Fri, 25 Jun 2021 20:35:18 -0400 Subject: [PATCH 2/7] Update python script --- cpp/scripts/run-clang-format.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cpp/scripts/run-clang-format.py b/cpp/scripts/run-clang-format.py index 3a725f768..3fdd81325 100644 --- a/cpp/scripts/run-clang-format.py +++ b/cpp/scripts/run-clang-format.py @@ -22,7 +22,7 @@ import tempfile -EXPECTED_VERSION = "8.0.1" +EXPECTED_VERSION = "11.0.0" VERSION_REGEX = re.compile(r"clang-format version ([0-9.]+)") # NOTE: populate this list with more top-level dirs as we add more of them to the cuspatial repo DEFAULT_DIRS = ["cpp/include", @@ -140,4 +140,3 @@ def main(): if __name__ == "__main__": main() - From 4745fbfaa749ae3e3d5f6e1e5db882f7f3276f2c Mon Sep 17 00:00:00 2001 From: Conor Hoekstra Date: Fri, 25 Jun 2021 20:35:51 -0400 Subject: [PATCH 3/7] Update .clang-format --- cpp/.clang-format | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/cpp/.clang-format b/cpp/.clang-format index 6f48df58b..ec0ddcfa1 100644 --- a/cpp/.clang-format +++ b/cpp/.clang-format @@ -6,16 +6,22 @@ Language: Cpp AccessModifierOffset: -1 AlignAfterOpenBracket: Align AlignConsecutiveAssignments: true +AlignConsecutiveBitFields: true AlignConsecutiveDeclarations: false +AlignConsecutiveMacros: true AlignEscapedNewlines: Left AlignOperands: true AlignTrailingComments: true +AllowAllArgumentsOnNextLine: true +AllowAllConstructorInitializersOnNextLine: true AllowAllParametersOfDeclarationOnNextLine: true AllowShortBlocksOnASingleLine: true AllowShortCaseLabelsOnASingleLine: true +AllowShortEnumsOnASingleLine: true AllowShortFunctionsOnASingleLine: All AllowShortIfStatementsOnASingleLine: true -AllowShortLoopsOnASingleLine: true +AllowShortLambdasOnASingleLine: true +AllowShortLoopsOnASingleLine: false # This is deprecated AlwaysBreakAfterDefinitionReturnType: None AlwaysBreakAfterReturnType: None @@ -40,14 +46,15 @@ BraceWrapping: SplitEmptyFunction: false SplitEmptyRecord: false SplitEmptyNamespace: false +BreakAfterJavaFieldAnnotations: false BreakBeforeBinaryOperators: None BreakBeforeBraces: WebKit BreakBeforeInheritanceComma: false -BreakInheritanceList: BeforeColon +BreakBeforeTernaryOperators: true BreakBeforeTernaryOperators: true BreakConstructorInitializersBeforeComma: false BreakConstructorInitializers: BeforeColon -BreakAfterJavaFieldAnnotations: false +BreakInheritanceList: BeforeColon BreakStringLiterals: true ColumnLimit: 100 CommentPragmas: '^ IWYU pragma:' @@ -57,7 +64,7 @@ ConstructorInitializerAllOnOneLineOrOnePerLine: true ConstructorInitializerIndentWidth: 2 ContinuationIndentWidth: 2 Cpp11BracedListStyle: true -DerivePointerAlignment: true +DerivePointerAlignment: false DisableFormat: false ExperimentalAutoDetectBinPacking: false FixNamespaceComments: true @@ -139,18 +146,20 @@ SpaceBeforeCtorInitializerColon: true SpaceBeforeInheritanceColon: true SpaceBeforeParens: ControlStatements SpaceBeforeRangeBasedForLoopColon: true +SpaceBeforeSquareBrackets: false +SpaceInEmptyBlock: false SpaceInEmptyParentheses: false SpacesBeforeTrailingComments: 2 SpacesInAngles: false +SpacesInConditionalStatement: false SpacesInContainerLiterals: true SpacesInCStyleCastParentheses: false SpacesInParentheses: false SpacesInSquareBrackets: false -Standard: Cpp11 +Standard: c++17 StatementMacros: - Q_UNUSED - QT_REQUIRE_VERSION # Be consistent with indent-width, even for people who use tab for indentation! TabWidth: 2 UseTab: Never - From ef9971222cd37f621c7370ec8950e1a5b2234173 Mon Sep 17 00:00:00 2001 From: Conor Hoekstra Date: Fri, 25 Jun 2021 20:36:02 -0400 Subject: [PATCH 4/7] Temporary CI fix --- ci/checks/style.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ci/checks/style.sh b/ci/checks/style.sh index 0a92d4eb7..5ece641d6 100644 --- a/ci/checks/style.sh +++ b/ci/checks/style.sh @@ -14,6 +14,10 @@ LANG=C.UTF-8 . /opt/conda/etc/profile.d/conda.sh conda activate rapids +gpuci_conda_retry remove --force rapids-build-env rapids-notebook-env +gpuci_conda_retry install -y "clang=11.0.0" +gpuci_conda_retry install -y "clang-tools=11.0.0" + # Run isort and get results/return code ISORT=`isort --check-only python/**/*.py` ISORT_RETVAL=$? From 1373a05b4d182b97cb6e7660be30c98389561ba4 Mon Sep 17 00:00:00 2001 From: Conor Hoekstra Date: Fri, 25 Jun 2021 20:36:24 -0400 Subject: [PATCH 5/7] Formatting changes --- cpp/include/cuspatial/error.hpp | 2 +- cpp/include/cuspatial/types.hpp | 18 ++--- .../indexing/construction/detail/phase_1.cuh | 38 ++++----- .../indexing/construction/detail/phase_2.cuh | 36 ++++----- .../indexing/construction/point_quadtree.cu | 62 +++++++-------- cpp/src/interpolate/cubic_spline.cu | 4 +- cpp/src/join/detail/intersection.cuh | 14 ++-- cpp/src/join/detail/point.cuh | 2 +- cpp/src/join/detail/traversal.cuh | 8 +- cpp/src/join/quadtree_point_in_polygon.cu | 72 ++++++++--------- .../quadtree_point_to_nearest_polyline.cu | 78 +++++++++---------- cpp/src/join/quadtree_poly_filtering.cu | 30 +++---- cpp/src/spatial/polygon_bounding_box.cu | 46 +++++------ cpp/src/spatial/polyline_bounding_box.cu | 38 ++++----- cpp/src/utility/point_in_polygon.cuh | 10 +-- cpp/tests/indexing/point_quadtree_test.cu | 10 +-- .../join/point_in_polygon_test_large.cpp | 40 +++++----- .../join/point_in_polygon_test_small.cpp | 4 +- .../point_to_nearest_polyline_test_small.cpp | 4 +- .../join/quadtree_polygon_filtering_test.cu | 2 +- .../join/quadtree_polyline_filtering_test.cu | 2 +- ...esian_product_group_index_iterator_test.cu | 4 +- 22 files changed, 265 insertions(+), 259 deletions(-) diff --git a/cpp/include/cuspatial/error.hpp b/cpp/include/cuspatial/error.hpp index 60052fe56..1747bb08f 100644 --- a/cpp/include/cuspatial/error.hpp +++ b/cpp/include/cuspatial/error.hpp @@ -35,7 +35,7 @@ struct logic_error : public std::logic_error { } // namespace cuspatial -#define STRINGIFY_DETAIL(x) #x +#define STRINGIFY_DETAIL(x) #x #define CUSPATIAL_STRINGIFY(x) STRINGIFY_DETAIL(x) /**---------------------------------------------------------------------------* diff --git a/cpp/include/cuspatial/types.hpp b/cpp/include/cuspatial/types.hpp index a9fd8d225..bf1ca5bc9 100644 --- a/cpp/include/cuspatial/types.hpp +++ b/cpp/include/cuspatial/types.hpp @@ -46,15 +46,15 @@ struct coord_2d { * */ struct its_timestamp { - uint32_t y : 6; - uint32_t m : 4; - uint32_t d : 5; - uint32_t hh : 5; - uint32_t mm : 6; - uint32_t ss : 6; - uint32_t wd : 3; - uint32_t yd : 9; - uint32_t ms : 10; + uint32_t y : 6; + uint32_t m : 4; + uint32_t d : 5; + uint32_t hh : 5; + uint32_t mm : 6; + uint32_t ss : 6; + uint32_t wd : 3; + uint32_t yd : 9; + uint32_t ms : 10; uint32_t pid : 10; }; diff --git a/cpp/src/indexing/construction/detail/phase_1.cuh b/cpp/src/indexing/construction/detail/phase_1.cuh index 23917239e..0cd9fd6c9 100644 --- a/cpp/src/indexing/construction/detail/phase_1.cuh +++ b/cpp/src/indexing/construction/detail/phase_1.cuh @@ -51,8 +51,8 @@ namespace detail { */ template inline std::pair, std::unique_ptr> -compute_point_keys_and_sorted_indices(cudf::column_view const &x, - cudf::column_view const &y, +compute_point_keys_and_sorted_indices(cudf::column_view const& x, + cudf::column_view const& y, T x_min, T x_max, T y_min, @@ -60,14 +60,14 @@ compute_point_keys_and_sorted_indices(cudf::column_view const &x, T scale, int8_t max_depth, rmm::cuda_stream_view stream, - rmm::mr::device_memory_resource *mr) + rmm::mr::device_memory_resource* mr) { rmm::device_uvector keys(x.size(), stream); thrust::transform(rmm::exec_policy(stream), thrust::make_zip_iterator(x.begin(), y.begin()), thrust::make_zip_iterator(x.begin(), y.begin()) + x.size(), keys.begin(), - [=] __device__(auto const &point) { + [=] __device__(auto const& point) { T x, y; thrust::tie(x, y) = point; if (x < x_min || x > x_max || y < y_min || y > y_max) { @@ -187,11 +187,11 @@ inline std::tuple, rmm::device_uvector, rmm::device_uvector, rmm::device_uvector> -reverse_tree_levels(rmm::device_uvector const &quad_keys_in, - rmm::device_uvector const &quad_point_count_in, - rmm::device_uvector const &quad_child_count_in, - std::vector const &begin_pos, - std::vector const &end_pos, +reverse_tree_levels(rmm::device_uvector const& quad_keys_in, + rmm::device_uvector const& quad_point_count_in, + rmm::device_uvector const& quad_child_count_in, + std::vector const& begin_pos, + std::vector const& end_pos, int8_t max_depth, rmm::cuda_stream_view stream) { @@ -246,8 +246,8 @@ reverse_tree_levels(rmm::device_uvector const &quad_keys_in, * */ template -inline auto make_full_levels(cudf::column_view const &x, - cudf::column_view const &y, +inline auto make_full_levels(cudf::column_view const& x, + cudf::column_view const& y, T x_min, T x_max, T y_min, @@ -256,7 +256,7 @@ inline auto make_full_levels(cudf::column_view const &x, int8_t max_depth, cudf::size_type min_size, rmm::cuda_stream_view stream, - rmm::mr::device_memory_resource *mr) + rmm::mr::device_memory_resource* mr) { // Compute point keys and sort into bottom-level quadrants // (i.e. quads at level `max_depth - 1`) @@ -265,8 +265,8 @@ inline auto make_full_levels(cudf::column_view const &x, auto keys_and_indices = compute_point_keys_and_sorted_indices( x, y, x_min, x_max, y_min, y_max, scale, max_depth, stream, mr); - auto &point_keys = keys_and_indices.first; - auto &point_indices = keys_and_indices.second; + auto& point_keys = keys_and_indices.first; + auto& point_indices = keys_and_indices.second; rmm::device_uvector quad_keys(x.size(), stream); rmm::device_uvector quad_point_count(x.size(), stream); @@ -284,7 +284,7 @@ inline auto make_full_levels(cudf::column_view const &x, // Repurpose the `point_keys` vector now the points have been grouped into the // leaf quadrants - auto &quad_child_count = point_keys; + auto& quad_child_count = point_keys; quad_keys.resize(num_bottom_quads * (max_depth + 1), stream); quad_point_count.resize(num_bottom_quads * (max_depth + 1), stream); @@ -331,10 +331,10 @@ inline auto make_full_levels(cudf::column_view const &x, quad_child_count.begin(), stream); - auto const &num_parent_nodes = std::get<0>(quads); - auto const &quad_tree_size = std::get<1>(quads); - auto const &begin_pos = std::get<2>(quads); - auto const &end_pos = std::get<3>(quads); + auto const& num_parent_nodes = std::get<0>(quads); + auto const& quad_tree_size = std::get<1>(quads); + auto const& begin_pos = std::get<2>(quads); + auto const& end_pos = std::get<3>(quads); // Shrink vectors' underlying device allocations to reduce peak memory usage quad_keys.resize(quad_tree_size, stream); diff --git a/cpp/src/indexing/construction/detail/phase_2.cuh b/cpp/src/indexing/construction/detail/phase_2.cuh index 4a0c45b65..1a095582e 100644 --- a/cpp/src/indexing/construction/detail/phase_2.cuh +++ b/cpp/src/indexing/construction/detail/phase_2.cuh @@ -42,7 +42,7 @@ namespace cuspatial { namespace detail { -inline rmm::device_uvector compute_leaf_positions(cudf::column_view const &indicator, +inline rmm::device_uvector compute_leaf_positions(cudf::column_view const& indicator, cudf::size_type num_valid_nodes, rmm::cuda_stream_view stream) { @@ -60,9 +60,9 @@ inline rmm::device_uvector compute_leaf_positions(cudf::column_view co } inline rmm::device_uvector flatten_point_keys( - rmm::device_uvector const &quad_keys, - rmm::device_uvector const &quad_level, - cudf::column_view const &indicator, + rmm::device_uvector const& quad_keys, + rmm::device_uvector const& quad_level, + cudf::column_view const& indicator, cudf::size_type num_valid_nodes, int8_t max_depth, rmm::cuda_stream_view stream) @@ -74,7 +74,7 @@ inline rmm::device_uvector flatten_point_keys( keys_and_levels, keys_and_levels + num_valid_nodes, flattened_keys.begin(), - [last_level = max_depth - 1] __device__(auto const &val) { + [last_level = max_depth - 1] __device__(auto const& val) { bool is_quad{false}; uint32_t key{}, level{}; thrust::tie(key, level, is_quad) = val; @@ -93,10 +93,10 @@ inline rmm::device_uvector flatten_point_keys( * z-order keys */ inline rmm::device_uvector compute_flattened_first_point_positions( - rmm::device_uvector const &quad_keys, - rmm::device_uvector const &quad_level, - rmm::device_uvector &quad_point_count, - cudf::column_view const &indicator, + rmm::device_uvector const& quad_keys, + rmm::device_uvector const& quad_level, + rmm::device_uvector& quad_point_count, + cudf::column_view const& indicator, cudf::size_type num_valid_nodes, int8_t max_depth, rmm::cuda_stream_view stream) @@ -135,8 +135,8 @@ inline rmm::device_uvector compute_flattened_first_point_positions( return std::make_pair(std::move(initial_sort_indices), std::move(quad_point_count_tmp)); }(); - auto &initial_sort_indices = std::get<0>(sorted_order_and_point_counts); - auto &quad_point_count_tmp = std::get<1>(sorted_order_and_point_counts); + auto& initial_sort_indices = std::get<0>(sorted_order_and_point_counts); + auto& quad_point_count_tmp = std::get<1>(sorted_order_and_point_counts); auto leaf_offsets = compute_leaf_positions(indicator, num_valid_nodes, stream); @@ -177,7 +177,7 @@ inline rmm::device_uvector compute_flattened_first_point_positions( } inline rmm::device_uvector compute_parent_positions( - rmm::device_uvector const &quad_child_count, + rmm::device_uvector const& quad_child_count, cudf::size_type num_parent_nodes, cudf::size_type num_child_nodes, rmm::cuda_stream_view stream) @@ -227,10 +227,10 @@ inline rmm::device_uvector compute_parent_positions( * @return std::pair */ inline std::pair remove_unqualified_quads( - rmm::device_uvector &quad_keys, - rmm::device_uvector &quad_point_count, - rmm::device_uvector &quad_child_count, - rmm::device_uvector &quad_levels, + rmm::device_uvector& quad_keys, + rmm::device_uvector& quad_point_count, + rmm::device_uvector& quad_child_count, + rmm::device_uvector& quad_levels, cudf::size_type num_parent_nodes, cudf::size_type num_child_nodes, cudf::size_type min_size, @@ -300,11 +300,11 @@ inline std::pair remove_unqualified_quads( * @return std::unique_ptr */ inline std::unique_ptr construct_non_leaf_indicator( - rmm::device_uvector &quad_point_count, + rmm::device_uvector& quad_point_count, cudf::size_type num_parent_nodes, cudf::size_type num_valid_nodes, cudf::size_type min_size, - rmm::mr::device_memory_resource *mr, + rmm::mr::device_memory_resource* mr, rmm::cuda_stream_view stream) { // diff --git a/cpp/src/indexing/construction/point_quadtree.cu b/cpp/src/indexing/construction/point_quadtree.cu index 41e0821f3..67d7141a4 100644 --- a/cpp/src/indexing/construction/point_quadtree.cu +++ b/cpp/src/indexing/construction/point_quadtree.cu @@ -43,16 +43,16 @@ namespace { /** * @brief Constructs a complete quad tree */ -inline std::unique_ptr make_quad_tree(rmm::device_uvector &quad_keys, - rmm::device_uvector &quad_point_count, - rmm::device_uvector &quad_child_count, - rmm::device_uvector &quad_levels, +inline std::unique_ptr make_quad_tree(rmm::device_uvector& quad_keys, + rmm::device_uvector& quad_point_count, + rmm::device_uvector& quad_child_count, + rmm::device_uvector& quad_levels, cudf::size_type num_parent_nodes, int8_t max_depth, cudf::size_type min_size, cudf::size_type level_1_size, rmm::cuda_stream_view stream, - rmm::mr::device_memory_resource *mr) + rmm::mr::device_memory_resource* mr) { // count the number of child nodes auto num_child_nodes = thrust::reduce(rmm::exec_policy(stream), @@ -106,7 +106,7 @@ inline std::unique_ptr make_quad_tree(rmm::device_uvector quad_child_pos->mutable_view().begin(), level_1_size); - auto &offsets = quad_child_pos; + auto& offsets = quad_child_pos; auto offsets_iter = thrust::make_zip_iterator(is_quad->view().begin(), quad_child_pos->view().template begin(), quad_point_pos.begin()); @@ -118,7 +118,7 @@ inline std::unique_ptr make_quad_tree(rmm::device_uvector offsets_iter + num_valid_nodes, offsets->mutable_view().template begin(), // return bool ? lhs : rhs - [] __device__(auto const &t) { + [] __device__(auto const& t) { return thrust::get<0>(t) ? thrust::get<1>(t) : thrust::get<2>(t); }); @@ -137,7 +137,7 @@ inline std::unique_ptr make_quad_tree(rmm::device_uvector lengths_iter + num_valid_nodes, lengths->mutable_view().template begin(), // return bool ? lhs : rhs - [] __device__(auto const &t) { + [] __device__(auto const& t) { return thrust::get<0>(t) ? thrust::get<1>(t) : thrust::get<2>(t); }); @@ -173,11 +173,11 @@ inline std::unique_ptr make_quad_tree(rmm::device_uvector * @brief Constructs a leaf-only quadtree */ inline std::unique_ptr make_leaf_tree( - rmm::device_uvector const &quad_keys, - rmm::device_uvector const &quad_point_count, + rmm::device_uvector const& quad_keys, + rmm::device_uvector const& quad_point_count, cudf::size_type num_top_quads, rmm::cuda_stream_view stream, - rmm::mr::device_memory_resource *mr) + rmm::mr::device_memory_resource* mr) { auto keys = make_fixed_width_column(num_top_quads, stream, mr); auto levels = make_fixed_width_column(num_top_quads, stream, mr); @@ -235,18 +235,18 @@ inline std::unique_ptr make_leaf_tree( */ struct dispatch_construct_quadtree { template ::value> * = nullptr, + std::enable_if_t::value>* = nullptr, typename... Args> inline std::pair, std::unique_ptr> operator()( - Args &&...) + Args&&...) { CUSPATIAL_FAIL("Only floating-point types are supported"); } - template ::value> * = nullptr> + template ::value>* = nullptr> inline std::pair, std::unique_ptr> operator()( - cudf::column_view const &x, - cudf::column_view const &y, + cudf::column_view const& x, + cudf::column_view const& y, double x_min, double x_max, double y_min, @@ -255,7 +255,7 @@ struct dispatch_construct_quadtree { int8_t max_depth, cudf::size_type min_size, rmm::cuda_stream_view stream, - rmm::mr::device_memory_resource *mr) + rmm::mr::device_memory_resource* mr) { // Construct the full set of non-empty subquadrants starting from the lowest level. // Corresponds to "Phase 1" of quadtree construction in ref. @@ -271,14 +271,14 @@ struct dispatch_construct_quadtree { stream, mr); - auto &point_indices = std::get<0>(quads); - auto &quad_keys = std::get<1>(quads); - auto &quad_point_count = std::get<2>(quads); - auto &quad_child_count = std::get<3>(quads); - auto &quad_levels = std::get<4>(quads); - auto &num_top_quads = std::get<5>(quads); - auto &num_parent_nodes = std::get<6>(quads); - auto &level_1_size = std::get<7>(quads); + auto& point_indices = std::get<0>(quads); + auto& quad_keys = std::get<1>(quads); + auto& quad_point_count = std::get<2>(quads); + auto& quad_child_count = std::get<3>(quads); + auto& quad_levels = std::get<4>(quads); + auto& num_top_quads = std::get<5>(quads); + auto& num_parent_nodes = std::get<6>(quads); + auto& level_1_size = std::get<7>(quads); // Optimization: return early if the top level nodes are all leaves if (num_parent_nodes <= 0) { @@ -304,8 +304,8 @@ struct dispatch_construct_quadtree { } // namespace std::pair, std::unique_ptr> quadtree_on_points( - cudf::column_view const &x, - cudf::column_view const &y, + cudf::column_view const& x, + cudf::column_view const& y, double x_min, double x_max, double y_min, @@ -314,7 +314,7 @@ std::pair, std::unique_ptr> quadtree_ int8_t max_depth, cudf::size_type min_size, rmm::cuda_stream_view stream, - rmm::mr::device_memory_resource *mr) + rmm::mr::device_memory_resource* mr) { return cudf::type_dispatcher(x.type(), dispatch_construct_quadtree{}, @@ -334,8 +334,8 @@ std::pair, std::unique_ptr> quadtree_ } // namespace detail std::pair, std::unique_ptr> quadtree_on_points( - cudf::column_view const &x, - cudf::column_view const &y, + cudf::column_view const& x, + cudf::column_view const& y, double x_min, double x_max, double y_min, @@ -343,7 +343,7 @@ std::pair, std::unique_ptr> quadtree_ double scale, int8_t max_depth, cudf::size_type min_size, - rmm::mr::device_memory_resource *mr) + rmm::mr::device_memory_resource* mr) { CUSPATIAL_EXPECTS(x.size() == y.size(), "x and y columns must have the same length"); CUSPATIAL_EXPECTS(x_min < x_max && y_min < y_max, diff --git a/cpp/src/interpolate/cubic_spline.cu b/cpp/src/interpolate/cubic_spline.cu index 4a62a1524..6a5378e06 100644 --- a/cpp/src/interpolate/cubic_spline.cu +++ b/cpp/src/interpolate/cubic_spline.cu @@ -231,7 +231,9 @@ struct compute_spline_tridiagonals { p_d[h + ci + 1] = (p_h[h + ci + 1] + p_h[h + (n - 2) - ci]) * 2; p_u[h + ci + 1] = (p_i[h + ci + 1] - p_i[h + (n - 2) - ci]) * 6; } - for (ci = 0; ci < n - 3; ++ci) { p_dlu[h + ci + 1] = p_i[h + ci + 1]; } + for (ci = 0; ci < n - 3; ++ci) { + p_dlu[h + ci + 1] = p_i[h + ci + 1]; + } }); } template diff --git a/cpp/src/join/detail/intersection.cuh b/cpp/src/join/detail/intersection.cuh index e85a82326..f06a51d21 100644 --- a/cpp/src/join/detail/intersection.cuh +++ b/cpp/src/join/detail/intersection.cuh @@ -50,7 +50,7 @@ inline cudf::size_type copy_leaf_intersections(InputIterator input_begin, return thrust::distance( output_begin, thrust::copy_if( - rmm::exec_policy(stream), input_begin, input_end, output_begin, [] __device__(auto const &t) { + rmm::exec_policy(stream), input_begin, input_end, output_begin, [] __device__(auto const& t) { return thrust::get<0>(t) == leaf_indicator; })); } @@ -64,7 +64,7 @@ inline cudf::size_type remove_non_quad_intersections(InputIterator input_begin, return thrust::distance( output_begin, thrust::remove_if( - rmm::exec_policy(stream), input_begin, input_end, output_begin, [] __device__(auto const &t) { + rmm::exec_policy(stream), input_begin, input_end, output_begin, [] __device__(auto const& t) { return thrust::get<0>(t) != quad_indicator; })); } @@ -75,8 +75,8 @@ template inline std::pair find_intersections( - cudf::table_view const &quadtree, - cudf::table_view const &poly_bbox, + cudf::table_view const& quadtree, + cudf::table_view const& poly_bbox, NodeIndicesIterator node_indices, PolyIndicesIterator poly_indices, NodePairsIterator node_pairs, @@ -110,9 +110,9 @@ inline std::pair find_intersections( poly_x_mins = *d_poly_x_min, poly_y_mins = *d_poly_y_min, poly_x_maxs = *d_poly_x_max, - poly_y_maxs = *d_poly_y_max] __device__(auto const &node_and_poly) { - auto &node = thrust::get<0>(node_and_poly); - auto &poly = thrust::get<1>(node_and_poly); + poly_y_maxs = *d_poly_y_max] __device__(auto const& node_and_poly) { + auto& node = thrust::get<0>(node_and_poly); + auto& poly = thrust::get<1>(node_and_poly); auto key = keys.element(node); auto level = levels.element(node); auto poly_x_min = poly_x_mins.element(poly); diff --git a/cpp/src/join/detail/point.cuh b/cpp/src/join/detail/point.cuh index 199e9fe3d..a099523d1 100644 --- a/cpp/src/join/detail/point.cuh +++ b/cpp/src/join/detail/point.cuh @@ -23,7 +23,7 @@ namespace cuspatial { namespace detail { inline __device__ std::pair get_quad_poly_and_local_point_indices( - uint32_t const global_index, uint32_t const *point_offsets, uint32_t const *point_offsets_end) + uint32_t const global_index, uint32_t const* point_offsets, uint32_t const* point_offsets_end) { // Calculate the position in "point_offsets" that `global_index` falls between. // This position is the index of the poly/quad pair for this `global_index`. diff --git a/cpp/src/join/detail/traversal.cuh b/cpp/src/join/detail/traversal.cuh index 95d170f31..8e2de9414 100644 --- a/cpp/src/join/detail/traversal.cuh +++ b/cpp/src/join/detail/traversal.cuh @@ -58,10 +58,10 @@ inline std::tuple &parent_types, - rmm::device_uvector &parent_levels, - rmm::device_uvector &parent_node_indices, - rmm::device_uvector &parent_poly_indices, + rmm::device_uvector& parent_types, + rmm::device_uvector& parent_levels, + rmm::device_uvector& parent_node_indices, + rmm::device_uvector& parent_poly_indices, rmm::cuda_stream_view stream) { // Use the current parent node indices as the lookup into the global child counts diff --git a/cpp/src/join/quadtree_point_in_polygon.cu b/cpp/src/join/quadtree_point_in_polygon.cu index 138a515d0..44c1de44b 100644 --- a/cpp/src/join/quadtree_point_in_polygon.cu +++ b/cpp/src/join/quadtree_point_in_polygon.cu @@ -47,8 +47,8 @@ namespace { template struct compute_poly_and_point_indices { QuadOffsetsIter quad_point_offsets; - uint32_t const *point_offsets; - uint32_t const *point_offsets_end; + uint32_t const* point_offsets; + uint32_t const* point_offsets_end; cudf::column_device_view const poly_indices; thrust::tuple __device__ operator()(cudf::size_type const global_index) { @@ -69,10 +69,10 @@ struct test_poly_point_intersection { cudf::column_device_view const poly_points_x; cudf::column_device_view const poly_points_y; - bool __device__ operator()(thrust::tuple const &poly_point_idxs) + bool __device__ operator()(thrust::tuple const& poly_point_idxs) { - auto &poly_idx = thrust::get<0>(poly_point_idxs); - auto &point_idx = thrust::get<1>(poly_point_idxs); + auto& poly_idx = thrust::get<0>(poly_point_idxs); + auto& point_idx = thrust::get<1>(poly_point_idxs); auto point = points[point_idx]; return not is_point_in_polygon(thrust::get<0>(point), thrust::get<1>(point), @@ -87,24 +87,24 @@ struct test_poly_point_intersection { struct compute_quadtree_point_in_polygon { template std::enable_if_t::value, std::unique_ptr> operator()( - Args &&...) + Args&&...) { CUDF_FAIL("Non-floating point operation is not supported"); } template std::enable_if_t::value, std::unique_ptr> operator()( - cudf::table_view const &poly_quad_pairs, - cudf::table_view const &quadtree, - cudf::column_view const &point_indices, - cudf::column_view const &point_x, - cudf::column_view const &point_y, - cudf::column_view const &poly_offsets, - cudf::column_view const &ring_offsets, - cudf::column_view const &poly_points_x, - cudf::column_view const &poly_points_y, + cudf::table_view const& poly_quad_pairs, + cudf::table_view const& quadtree, + cudf::column_view const& point_indices, + cudf::column_view const& point_x, + cudf::column_view const& point_y, + cudf::column_view const& poly_offsets, + cudf::column_view const& ring_offsets, + cudf::column_view const& poly_points_x, + cudf::column_view const& poly_points_y, rmm::cuda_stream_view stream, - rmm::mr::device_memory_resource *mr) + rmm::mr::device_memory_resource* mr) { // Wrapped in an IIFE so `local_point_offsets` is freed on return auto [poly_idxs, point_idxs, num_total_points] = [&]() { @@ -218,17 +218,17 @@ struct compute_quadtree_point_in_polygon { } // namespace -std::unique_ptr quadtree_point_in_polygon(cudf::table_view const &poly_quad_pairs, - cudf::table_view const &quadtree, - cudf::column_view const &point_indices, - cudf::column_view const &point_x, - cudf::column_view const &point_y, - cudf::column_view const &poly_offsets, - cudf::column_view const &ring_offsets, - cudf::column_view const &poly_points_x, - cudf::column_view const &poly_points_y, +std::unique_ptr quadtree_point_in_polygon(cudf::table_view const& poly_quad_pairs, + cudf::table_view const& quadtree, + cudf::column_view const& point_indices, + cudf::column_view const& point_x, + cudf::column_view const& point_y, + cudf::column_view const& poly_offsets, + cudf::column_view const& ring_offsets, + cudf::column_view const& poly_points_x, + cudf::column_view const& poly_points_y, rmm::cuda_stream_view stream, - rmm::mr::device_memory_resource *mr) + rmm::mr::device_memory_resource* mr) { return cudf::type_dispatcher(point_x.type(), compute_quadtree_point_in_polygon{}, @@ -247,16 +247,16 @@ std::unique_ptr quadtree_point_in_polygon(cudf::table_view const &p } // namespace detail -std::unique_ptr quadtree_point_in_polygon(cudf::table_view const &poly_quad_pairs, - cudf::table_view const &quadtree, - cudf::column_view const &point_indices, - cudf::column_view const &point_x, - cudf::column_view const &point_y, - cudf::column_view const &poly_offsets, - cudf::column_view const &ring_offsets, - cudf::column_view const &poly_points_x, - cudf::column_view const &poly_points_y, - rmm::mr::device_memory_resource *mr) +std::unique_ptr quadtree_point_in_polygon(cudf::table_view const& poly_quad_pairs, + cudf::table_view const& quadtree, + cudf::column_view const& point_indices, + cudf::column_view const& point_x, + cudf::column_view const& point_y, + cudf::column_view const& poly_offsets, + cudf::column_view const& ring_offsets, + cudf::column_view const& poly_points_x, + cudf::column_view const& poly_points_y, + rmm::mr::device_memory_resource* mr) { CUSPATIAL_EXPECTS(poly_quad_pairs.num_columns() == 2, "a quadrant-polygon table must have 2 columns"); diff --git a/cpp/src/join/quadtree_point_to_nearest_polyline.cu b/cpp/src/join/quadtree_point_to_nearest_polyline.cu index aa8102fb6..41693daf7 100644 --- a/cpp/src/join/quadtree_point_to_nearest_polyline.cu +++ b/cpp/src/join/quadtree_point_to_nearest_polyline.cu @@ -69,8 +69,8 @@ inline __device__ std::pair get_local_poly_index_and_count( template inline __device__ std::pair get_transposed_point_and_pair_index( uint32_t const global_index, - uint32_t const *point_offsets, - uint32_t const *point_offsets_end, + uint32_t const* point_offsets, + uint32_t const* point_offsets_end, QuadOffsetsIter quad_offsets, QuadOffsetsIter quad_offsets_end, QuadLengthsIter quad_lengths) @@ -99,12 +99,12 @@ inline __device__ std::pair get_transposed_point_and_pair_in template struct compute_point_poly_indices_and_distances { PointIter points; - uint32_t const *point_offsets; - uint32_t const *point_offsets_end; + uint32_t const* point_offsets; + uint32_t const* point_offsets_end; QuadOffsetsIter quad_offsets; QuadOffsetsIter quad_offsets_end; QuadLengthsIter quad_lengths; - uint32_t const *poly_indices; + uint32_t const* poly_indices; cudf::column_device_view const poly_offsets; cudf::column_device_view const poly_points_x; cudf::column_device_view const poly_points_y; @@ -126,23 +126,23 @@ struct compute_point_poly_indices_and_distances { struct compute_quadtree_point_to_nearest_polyline { template std::enable_if_t::value, std::unique_ptr> operator()( - Args &&...) + Args&&...) { CUDF_FAIL("Non-floating point operation is not supported"); } template std::enable_if_t::value, std::unique_ptr> operator()( - cudf::table_view const &poly_quad_pairs, - cudf::table_view const &quadtree, - cudf::column_view const &point_indices, - cudf::column_view const &point_x, - cudf::column_view const &point_y, - cudf::column_view const &poly_offsets, - cudf::column_view const &poly_points_x, - cudf::column_view const &poly_points_y, + cudf::table_view const& poly_quad_pairs, + cudf::table_view const& quadtree, + cudf::column_view const& point_indices, + cudf::column_view const& point_x, + cudf::column_view const& point_y, + cudf::column_view const& poly_offsets, + cudf::column_view const& poly_points_x, + cudf::column_view const& poly_points_y, rmm::cuda_stream_view stream, - rmm::mr::device_memory_resource *mr) + rmm::mr::device_memory_resource* mr) { // Wrapped in an IIFE so `local_point_offsets` is freed on return auto const [point_idxs, poly_idxs, distances, num_distances] = [&]() { @@ -240,7 +240,7 @@ struct compute_quadtree_point_to_nearest_polyline { auto all_point_indices = thrust::make_transform_iterator(all_point_poly_indices_and_distances, - [] __device__(auto const &x) { return thrust::get<0>(x); }); + [] __device__(auto const& x) { return thrust::get<0>(x); }); // Allocate vectors for the distances min reduction rmm::device_uvector point_idxs(point_x.size(), stream); @@ -268,17 +268,17 @@ struct compute_quadtree_point_to_nearest_polyline { // comparator thrust::equal_to(), // binop to select the point/polyline pair with the smallest distance - [] __device__(auto const &lhs, auto const &rhs) { - T const &d_lhs = thrust::get<2>(lhs); - T const &d_rhs = thrust::get<2>(rhs); + [] __device__(auto const& lhs, auto const& rhs) { + T const& d_lhs = thrust::get<2>(lhs); + T const& d_rhs = thrust::get<2>(rhs); // If lhs distance is 0, choose rhs if (d_lhs == T{0}) { return rhs; } // if rhs distance is 0, choose lhs if (d_rhs == T{0}) { return lhs; } // If distances to lhs/rhs are the same, choose poly with smallest id if (d_lhs == d_rhs) { - auto const &i_lhs = thrust::get<1>(lhs); - auto const &i_rhs = thrust::get<1>(rhs); + auto const& i_lhs = thrust::get<1>(lhs); + auto const& i_rhs = thrust::get<1>(rhs); return i_lhs < i_rhs ? lhs : rhs; } // Otherwise choose poly with smallest distance @@ -322,16 +322,16 @@ struct compute_quadtree_point_to_nearest_polyline { } // namespace std::unique_ptr quadtree_point_to_nearest_polyline( - cudf::table_view const &poly_quad_pairs, - cudf::table_view const &quadtree, - cudf::column_view const &point_indices, - cudf::column_view const &point_x, - cudf::column_view const &point_y, - cudf::column_view const &poly_offsets, - cudf::column_view const &poly_points_x, - cudf::column_view const &poly_points_y, + cudf::table_view const& poly_quad_pairs, + cudf::table_view const& quadtree, + cudf::column_view const& point_indices, + cudf::column_view const& point_x, + cudf::column_view const& point_y, + cudf::column_view const& poly_offsets, + cudf::column_view const& poly_points_x, + cudf::column_view const& poly_points_y, rmm::cuda_stream_view stream, - rmm::mr::device_memory_resource *mr) + rmm::mr::device_memory_resource* mr) { return cudf::type_dispatcher(point_x.type(), compute_quadtree_point_to_nearest_polyline{}, @@ -350,15 +350,15 @@ std::unique_ptr quadtree_point_to_nearest_polyline( } // namespace detail std::unique_ptr quadtree_point_to_nearest_polyline( - cudf::table_view const &poly_quad_pairs, - cudf::table_view const &quadtree, - cudf::column_view const &point_indices, - cudf::column_view const &point_x, - cudf::column_view const &point_y, - cudf::column_view const &poly_offsets, - cudf::column_view const &poly_points_x, - cudf::column_view const &poly_points_y, - rmm::mr::device_memory_resource *mr) + cudf::table_view const& poly_quad_pairs, + cudf::table_view const& quadtree, + cudf::column_view const& point_indices, + cudf::column_view const& point_x, + cudf::column_view const& point_y, + cudf::column_view const& poly_offsets, + cudf::column_view const& poly_points_x, + cudf::column_view const& poly_points_y, + rmm::mr::device_memory_resource* mr) { CUSPATIAL_EXPECTS(poly_quad_pairs.num_columns() == 2, "a quadrant-polyline table must have 2 columns"); diff --git a/cpp/src/join/quadtree_poly_filtering.cu b/cpp/src/join/quadtree_poly_filtering.cu index 26d0bbbe2..5743de317 100644 --- a/cpp/src/join/quadtree_poly_filtering.cu +++ b/cpp/src/join/quadtree_poly_filtering.cu @@ -46,8 +46,8 @@ inline auto make_counting_transform_iterator(cudf::size_type start, UnaryFunctio } template -inline std::unique_ptr join_quadtree_and_bboxes(cudf::table_view const &quadtree, - cudf::table_view const &poly_bbox, +inline std::unique_ptr join_quadtree_and_bboxes(cudf::table_view const& quadtree, + cudf::table_view const& poly_bbox, T x_min, T x_max, T y_min, @@ -55,7 +55,7 @@ inline std::unique_ptr join_quadtree_and_bboxes(cudf::table_view co T scale, int8_t max_depth, rmm::cuda_stream_view stream, - rmm::mr::device_memory_resource *mr) + rmm::mr::device_memory_resource* mr) { auto const node_levels = quadtree.column(1); // uint8_t auto const node_counts = quadtree.column(3); // uint32_t @@ -211,9 +211,9 @@ inline std::unique_ptr join_quadtree_and_bboxes(cudf::table_view co } struct dispatch_quadtree_bounding_box_join { - template ::value> * = nullptr> - inline std::unique_ptr operator()(cudf::table_view const &quadtree, - cudf::table_view const &poly_bbox, + template ::value>* = nullptr> + inline std::unique_ptr operator()(cudf::table_view const& quadtree, + cudf::table_view const& poly_bbox, double x_min, double x_max, double y_min, @@ -221,7 +221,7 @@ struct dispatch_quadtree_bounding_box_join { double scale, int8_t max_depth, rmm::cuda_stream_view stream, - rmm::mr::device_memory_resource *mr) + rmm::mr::device_memory_resource* mr) { return join_quadtree_and_bboxes(quadtree, poly_bbox, @@ -235,17 +235,17 @@ struct dispatch_quadtree_bounding_box_join { mr); } template ::value> * = nullptr, + std::enable_if_t::value>* = nullptr, typename... Args> - inline std::unique_ptr operator()(Args &&...) + inline std::unique_ptr operator()(Args&&...) { CUSPATIAL_FAIL("Only floating-point types are supported"); } }; } // namespace -std::unique_ptr join_quadtree_and_bounding_boxes(cudf::table_view const &quadtree, - cudf::table_view const &poly_bbox, +std::unique_ptr join_quadtree_and_bounding_boxes(cudf::table_view const& quadtree, + cudf::table_view const& poly_bbox, double x_min, double x_max, double y_min, @@ -253,7 +253,7 @@ std::unique_ptr join_quadtree_and_bounding_boxes(cudf::table_view c double scale, int8_t max_depth, rmm::cuda_stream_view stream, - rmm::mr::device_memory_resource *mr) + rmm::mr::device_memory_resource* mr) { return cudf::type_dispatcher(poly_bbox.column(0).type(), dispatch_quadtree_bounding_box_join{}, @@ -271,15 +271,15 @@ std::unique_ptr join_quadtree_and_bounding_boxes(cudf::table_view c } // namespace detail -std::unique_ptr join_quadtree_and_bounding_boxes(cudf::table_view const &quadtree, - cudf::table_view const &poly_bbox, +std::unique_ptr join_quadtree_and_bounding_boxes(cudf::table_view const& quadtree, + cudf::table_view const& poly_bbox, double x_min, double x_max, double y_min, double y_max, double scale, int8_t max_depth, - rmm::mr::device_memory_resource *mr) + rmm::mr::device_memory_resource* mr) { CUSPATIAL_EXPECTS(quadtree.num_columns() == 5, "quadtree table must have 5 columns"); CUSPATIAL_EXPECTS(poly_bbox.num_columns() == 4, "polygon bbox table must have 4 columns"); diff --git a/cpp/src/spatial/polygon_bounding_box.cu b/cpp/src/spatial/polygon_bounding_box.cu index 92351c068..e647649da 100644 --- a/cpp/src/spatial/polygon_bounding_box.cu +++ b/cpp/src/spatial/polygon_bounding_box.cu @@ -45,7 +45,7 @@ namespace { template struct point_to_square { - inline __device__ thrust::tuple operator()(thrust::tuple const &point) + inline __device__ thrust::tuple operator()(thrust::tuple const& point) { return thrust::make_tuple(thrust::get<0>(point), // x thrust::get<1>(point), // y @@ -55,12 +55,12 @@ struct point_to_square { }; template -std::unique_ptr compute_polygon_bounding_boxes(cudf::column_view const &poly_offsets, - cudf::column_view const &ring_offsets, - cudf::column_view const &x, - cudf::column_view const &y, +std::unique_ptr compute_polygon_bounding_boxes(cudf::column_view const& poly_offsets, + cudf::column_view const& ring_offsets, + cudf::column_view const& x, + cudf::column_view const& y, rmm::cuda_stream_view stream, - rmm::mr::device_memory_resource *mr) + rmm::mr::device_memory_resource* mr) { auto num_polygons = poly_offsets.size(); // Wrapped in an IEFE so `first_ring_offsets` is freed on return @@ -120,7 +120,7 @@ std::unique_ptr compute_polygon_bounding_boxes(cudf::column_view co thrust::make_discard_iterator(), bboxes_iter, thrust::equal_to(), - [] __device__(auto const &a, auto const &b) { + [] __device__(auto const& a, auto const& b) { T min_x_a, min_y_a, max_x_a, max_y_a; T min_x_b, min_y_b, max_x_b, max_y_b; thrust::tie(min_x_a, min_y_a, max_x_a, max_y_a) = a; @@ -137,19 +137,19 @@ std::unique_ptr compute_polygon_bounding_boxes(cudf::column_view co struct dispatch_compute_polygon_bounding_boxes { template inline std::enable_if_t::value, std::unique_ptr> - operator()(Args &&...) + operator()(Args&&...) { CUSPATIAL_FAIL("Only floating-point types are supported"); } template inline std::enable_if_t::value, std::unique_ptr> - operator()(cudf::column_view const &poly_offsets, - cudf::column_view const &ring_offsets, - cudf::column_view const &x, - cudf::column_view const &y, + operator()(cudf::column_view const& poly_offsets, + cudf::column_view const& ring_offsets, + cudf::column_view const& x, + cudf::column_view const& y, rmm::cuda_stream_view stream, - rmm::mr::device_memory_resource *mr) + rmm::mr::device_memory_resource* mr) { return compute_polygon_bounding_boxes(poly_offsets, ring_offsets, x, y, stream, mr); } @@ -159,12 +159,12 @@ struct dispatch_compute_polygon_bounding_boxes { namespace detail { -std::unique_ptr polygon_bounding_boxes(cudf::column_view const &poly_offsets, - cudf::column_view const &ring_offsets, - cudf::column_view const &x, - cudf::column_view const &y, +std::unique_ptr polygon_bounding_boxes(cudf::column_view const& poly_offsets, + cudf::column_view const& ring_offsets, + cudf::column_view const& x, + cudf::column_view const& y, rmm::cuda_stream_view stream, - rmm::mr::device_memory_resource *mr) + rmm::mr::device_memory_resource* mr) { return cudf::type_dispatcher(x.type(), dispatch_compute_polygon_bounding_boxes{}, @@ -178,11 +178,11 @@ std::unique_ptr polygon_bounding_boxes(cudf::column_view const &pol } // namespace detail -std::unique_ptr polygon_bounding_boxes(cudf::column_view const &poly_offsets, - cudf::column_view const &ring_offsets, - cudf::column_view const &x, - cudf::column_view const &y, - rmm::mr::device_memory_resource *mr) +std::unique_ptr polygon_bounding_boxes(cudf::column_view const& poly_offsets, + cudf::column_view const& ring_offsets, + cudf::column_view const& x, + cudf::column_view const& y, + rmm::mr::device_memory_resource* mr) { CUSPATIAL_EXPECTS(ring_offsets.size() >= poly_offsets.size(), "number of rings must be greater than or equal to the number of polygons"); diff --git a/cpp/src/spatial/polyline_bounding_box.cu b/cpp/src/spatial/polyline_bounding_box.cu index efb4b40d9..0435770ee 100644 --- a/cpp/src/spatial/polyline_bounding_box.cu +++ b/cpp/src/spatial/polyline_bounding_box.cu @@ -44,7 +44,7 @@ namespace { template struct point_to_square { T expansion_radius{0}; - inline __device__ thrust::tuple operator()(thrust::tuple const &point) + inline __device__ thrust::tuple operator()(thrust::tuple const& point) { return thrust::make_tuple(thrust::get<0>(point) - expansion_radius, // x thrust::get<1>(point) - expansion_radius, // y @@ -54,12 +54,12 @@ struct point_to_square { }; template -std::unique_ptr compute_polyline_bounding_boxes(cudf::column_view const &poly_offsets, - cudf::column_view const &x, - cudf::column_view const &y, +std::unique_ptr compute_polyline_bounding_boxes(cudf::column_view const& poly_offsets, + cudf::column_view const& x, + cudf::column_view const& y, T expansion_radius, rmm::cuda_stream_view stream, - rmm::mr::device_memory_resource *mr) + rmm::mr::device_memory_resource* mr) { auto num_polygons = poly_offsets.size(); rmm::device_vector point_ids(x.size()); @@ -107,7 +107,7 @@ std::unique_ptr compute_polyline_bounding_boxes(cudf::column_view c thrust::make_discard_iterator(), bboxes_iter, thrust::equal_to(), - [] __device__(auto const &a, auto const &b) { + [] __device__(auto const& a, auto const& b) { T min_x_a, min_y_a, max_x_a, max_y_a; T min_x_b, min_y_b, max_x_b, max_y_b; thrust::tie(min_x_a, min_y_a, max_x_a, max_y_a) = a; @@ -124,19 +124,19 @@ std::unique_ptr compute_polyline_bounding_boxes(cudf::column_view c struct dispatch_compute_polyline_bounding_boxes { template inline std::enable_if_t::value, std::unique_ptr> - operator()(Args &&...) + operator()(Args&&...) { CUSPATIAL_FAIL("Only floating-point types are supported"); } template inline std::enable_if_t::value, std::unique_ptr> - operator()(cudf::column_view const &poly_offsets, - cudf::column_view const &x, - cudf::column_view const &y, + operator()(cudf::column_view const& poly_offsets, + cudf::column_view const& x, + cudf::column_view const& y, double expansion_radius, rmm::cuda_stream_view stream, - rmm::mr::device_memory_resource *mr) + rmm::mr::device_memory_resource* mr) { return compute_polyline_bounding_boxes( poly_offsets, x, y, static_cast(expansion_radius), stream, mr); @@ -147,12 +147,12 @@ struct dispatch_compute_polyline_bounding_boxes { namespace detail { -std::unique_ptr polyline_bounding_boxes(cudf::column_view const &poly_offsets, - cudf::column_view const &x, - cudf::column_view const &y, +std::unique_ptr polyline_bounding_boxes(cudf::column_view const& poly_offsets, + cudf::column_view const& x, + cudf::column_view const& y, double expansion_radius, rmm::cuda_stream_view stream, - rmm::mr::device_memory_resource *mr) + rmm::mr::device_memory_resource* mr) { return cudf::type_dispatcher(x.type(), dispatch_compute_polyline_bounding_boxes{}, @@ -166,11 +166,11 @@ std::unique_ptr polyline_bounding_boxes(cudf::column_view const &po } // namespace detail -std::unique_ptr polyline_bounding_boxes(cudf::column_view const &poly_offsets, - cudf::column_view const &x, - cudf::column_view const &y, +std::unique_ptr polyline_bounding_boxes(cudf::column_view const& poly_offsets, + cudf::column_view const& x, + cudf::column_view const& y, double expansion_radius, - rmm::mr::device_memory_resource *mr) + rmm::mr::device_memory_resource* mr) { CUSPATIAL_EXPECTS(x.type() == y.type(), "Data type mismatch"); CUSPATIAL_EXPECTS(x.size() == y.size(), "x and y must be the same size"); diff --git a/cpp/src/utility/point_in_polygon.cuh b/cpp/src/utility/point_in_polygon.cuh index 272750e6b..8070a3b09 100644 --- a/cpp/src/utility/point_in_polygon.cuh +++ b/cpp/src/utility/point_in_polygon.cuh @@ -34,16 +34,16 @@ inline __device__ bool is_point_in_polygon(T const x, bool in_polygon = false; uint32_t poly_begin = poly_offsets.element(poly_idx); uint32_t poly_end = poly_idx < poly_offsets.size() - 1 - ? poly_offsets.element(poly_idx + 1) - : ring_offsets.size(); + ? poly_offsets.element(poly_idx + 1) + : ring_offsets.size(); for (uint32_t ring_idx = poly_begin; ring_idx < poly_end; ring_idx++) // for each ring { auto ring_begin = ring_offsets.element(ring_idx); auto ring_end = ring_idx < ring_offsets.size() - 1 - ? ring_offsets.element(ring_idx + 1) - : poly_points_x.size(); - auto ring_len = ring_end - ring_begin; + ? ring_offsets.element(ring_idx + 1) + : poly_points_x.size(); + auto ring_len = ring_end - ring_begin; for (auto point_idx = 0; point_idx < ring_len; ++point_idx) { T x0 = poly_points_x.element(ring_begin + ((point_idx + 0) % ring_len)); T y0 = poly_points_y.element(ring_begin + ((point_idx + 0) % ring_len)); diff --git a/cpp/tests/indexing/point_quadtree_test.cu b/cpp/tests/indexing/point_quadtree_test.cu index 034614985..3a435dbfb 100644 --- a/cpp/tests/indexing/point_quadtree_test.cu +++ b/cpp/tests/indexing/point_quadtree_test.cu @@ -47,7 +47,7 @@ TYPED_TEST(QuadtreeOnPointIndexingTest, test_empty) auto quadtree_pair = cuspatial::quadtree_on_points(x, y, x_min, x_max, y_min, y_max, scale, max_depth, min_size); - auto &quadtree = std::get<1>(quadtree_pair); + auto& quadtree = std::get<1>(quadtree_pair); CUSPATIAL_EXPECTS( quadtree->num_columns() == 5, @@ -72,7 +72,7 @@ TYPED_TEST(QuadtreeOnPointIndexingTest, test_single) auto quadtree_pair = cuspatial::quadtree_on_points(x, y, x_min, x_max, y_min, y_max, scale, max_depth, min_size); - auto &quadtree = std::get<1>(quadtree_pair); + auto& quadtree = std::get<1>(quadtree_pair); CUSPATIAL_EXPECTS( quadtree->num_columns() == 5, @@ -106,7 +106,7 @@ TYPED_TEST(QuadtreeOnPointIndexingTest, test_two) auto quadtree_pair = cuspatial::quadtree_on_points(x, y, x_min, x_max, y_min, y_max, scale, max_depth, min_size); - auto &quadtree = std::get<1>(quadtree_pair); + auto& quadtree = std::get<1>(quadtree_pair); CUSPATIAL_EXPECTS( quadtree->num_columns() == 5, @@ -176,7 +176,7 @@ TYPED_TEST(QuadtreeOnPointIndexingTest, test_small) auto quadtree_pair = cuspatial::quadtree_on_points(x, y, x_min, x_max, y_min, y_max, scale, max_depth, min_size); - auto &quadtree = std::get<1>(quadtree_pair); + auto& quadtree = std::get<1>(quadtree_pair); CUSPATIAL_EXPECTS( quadtree->num_columns() == 5, @@ -211,7 +211,7 @@ TYPED_TEST(QuadtreeOnPointIndexingTest, test_all_lowest_level_quads) auto quadtree_pair = cuspatial::quadtree_on_points(x, y, x_min, x_max, y_min, y_max, scale, max_depth, min_size); - auto &quadtree = std::get<1>(quadtree_pair); + auto& quadtree = std::get<1>(quadtree_pair); CUSPATIAL_EXPECTS( quadtree->num_columns() == 5, diff --git a/cpp/tests/join/point_in_polygon_test_large.cpp b/cpp/tests/join/point_in_polygon_test_large.cpp index 9b424cb28..5d92e2912 100644 --- a/cpp/tests/join/point_in_polygon_test_large.cpp +++ b/cpp/tests/join/point_in_polygon_test_large.cpp @@ -56,7 +56,7 @@ struct PIPRefineTestLarge : public cudf::test::BaseFixture { TYPED_TEST_CASE(PIPRefineTestLarge, cudf::test::FloatingPointTypes); template -inline auto generate_points(std::vector> const &quads, uint32_t points_per_quad) +inline auto generate_points(std::vector> const& quads, uint32_t points_per_quad) { std::vector point_x(quads.size() * points_per_quad); std::vector point_y(quads.size() * points_per_quad); @@ -74,23 +74,25 @@ inline auto generate_points(std::vector> const &quads, uint32_t p } template -inline auto make_polygons_geometry(thrust::host_vector const &poly_offsets, - thrust::host_vector const &ring_offsets, - thrust::host_vector const &poly_x, - thrust::host_vector const &poly_y) +inline auto make_polygons_geometry(thrust::host_vector const& poly_offsets, + thrust::host_vector const& ring_offsets, + thrust::host_vector const& poly_x, + thrust::host_vector const& poly_y) { - std::vector polygons{}; + std::vector polygons{}; for (uint32_t poly_idx = 0, poly_end = poly_offsets.size(); poly_idx < poly_end; ++poly_idx) { auto ring_idx = static_cast(poly_offsets[poly_idx]); auto ring_end = static_cast( poly_idx < poly_offsets.size() - 1 ? poly_offsets[poly_idx + 1] : ring_offsets.size()); - auto polygon = static_cast(OGRGeometryFactory::createGeometry(wkbPolygon)); + auto polygon = static_cast(OGRGeometryFactory::createGeometry(wkbPolygon)); for (; ring_idx < ring_end; ++ring_idx) { auto seg_idx = static_cast(ring_offsets[ring_idx]); auto seg_end = static_cast( ring_idx < ring_offsets.size() - 1 ? ring_offsets[ring_idx + 1] : poly_x.size()); - auto ring = static_cast(OGRGeometryFactory::createGeometry(wkbLinearRing)); - for (; seg_idx < seg_end; ++seg_idx) { ring->addPoint(poly_x[seg_idx], poly_y[seg_idx]); } + auto ring = static_cast(OGRGeometryFactory::createGeometry(wkbLinearRing)); + for (; seg_idx < seg_end; ++seg_idx) { + ring->addPoint(poly_x[seg_idx], poly_y[seg_idx]); + } polygon->addRing(ring); } polygons.push_back(polygon); @@ -99,9 +101,9 @@ inline auto make_polygons_geometry(thrust::host_vector const &poly_off } template -auto geometry_to_poly_and_point_indices(std::vector const &polygons, - thrust::host_vector const &x, - thrust::host_vector const &y) +auto geometry_to_poly_and_point_indices(std::vector const& polygons, + thrust::host_vector const& x, + thrust::host_vector const& y) { std::vector poly_indices{}; std::vector point_lengths{}; @@ -147,16 +149,16 @@ TYPED_TEST(PIPRefineTestLarge, TestLarge) {0, 4, 4, 8}}; auto host_points = generate_points(quads, min_size); - auto &h_x = std::get<0>(host_points); - auto &h_y = std::get<1>(host_points); + auto& h_x = std::get<0>(host_points); + auto& h_y = std::get<1>(host_points); fixed_width_column_wrapper x(h_x.begin(), h_x.end()); fixed_width_column_wrapper y(h_y.begin(), h_y.end()); auto quadtree_pair = cuspatial::quadtree_on_points( x, y, x_min, x_max, y_min, y_max, scale, max_depth, min_size, this->mr()); - auto &quadtree = std::get<1>(quadtree_pair); - auto &point_indices = std::get<0>(quadtree_pair); + auto& quadtree = std::get<1>(quadtree_pair); + auto& point_indices = std::get<0>(quadtree_pair); auto points = cudf::gather( cudf::table_view{{x, y}}, *point_indices, cudf::out_of_bounds_policy::DONT_CHECK, this->mr()); @@ -241,9 +243,9 @@ TYPED_TEST(PIPRefineTestLarge, TestLarge) cudf::test::to_host(points->get_column(0)).first, cudf::test::to_host(points->get_column(1)).first); - auto &expected_poly_indices = std::get<0>(host_poly_and_point_indices); - auto &expected_point_indices = std::get<1>(host_poly_and_point_indices); - auto &expected_point_lengths = std::get<2>(host_poly_and_point_indices); + auto& expected_poly_indices = std::get<0>(host_poly_and_point_indices); + auto& expected_point_indices = std::get<1>(host_poly_and_point_indices); + auto& expected_point_lengths = std::get<2>(host_poly_and_point_indices); auto actual_poly_indices = cudf::test::to_host(poly_idx).first; auto actual_point_indices = cudf::test::to_host(point_idx).first; diff --git a/cpp/tests/join/point_in_polygon_test_small.cpp b/cpp/tests/join/point_in_polygon_test_small.cpp index 2f6543666..c64aa1397 100644 --- a/cpp/tests/join/point_in_polygon_test_small.cpp +++ b/cpp/tests/join/point_in_polygon_test_small.cpp @@ -97,8 +97,8 @@ TYPED_TEST(PIPRefineTestSmall, TestSmall) auto quadtree_pair = cuspatial::quadtree_on_points( x, y, x_min, x_max, y_min, y_max, scale, max_depth, min_size, this->mr()); - auto &quadtree = std::get<1>(quadtree_pair); - auto &point_indices = std::get<0>(quadtree_pair); + auto& quadtree = std::get<1>(quadtree_pair); + auto& point_indices = std::get<0>(quadtree_pair); fixed_width_column_wrapper poly_offsets({0, 1, 2, 3}); fixed_width_column_wrapper ring_offsets({0, 4, 10, 14}); diff --git a/cpp/tests/join/point_to_nearest_polyline_test_small.cpp b/cpp/tests/join/point_to_nearest_polyline_test_small.cpp index 3862a7091..5650cd75b 100644 --- a/cpp/tests/join/point_to_nearest_polyline_test_small.cpp +++ b/cpp/tests/join/point_to_nearest_polyline_test_small.cpp @@ -99,8 +99,8 @@ TYPED_TEST(PIPRefineTestSmall, TestSmall) auto quadtree_pair = cuspatial::quadtree_on_points( x, y, x_min, x_max, y_min, y_max, scale, max_depth, min_size, this->mr()); - auto &quadtree = std::get<1>(quadtree_pair); - auto &point_indices = std::get<0>(quadtree_pair); + auto& quadtree = std::get<1>(quadtree_pair); + auto& point_indices = std::get<0>(quadtree_pair); double const expansion_radius{2.0}; fixed_width_column_wrapper poly_offsets({0, 4, 10, 14}); diff --git a/cpp/tests/join/quadtree_polygon_filtering_test.cu b/cpp/tests/join/quadtree_polygon_filtering_test.cu index 2b6afed3a..d705a9ffd 100644 --- a/cpp/tests/join/quadtree_polygon_filtering_test.cu +++ b/cpp/tests/join/quadtree_polygon_filtering_test.cu @@ -177,7 +177,7 @@ TYPED_TEST(QuadtreePolygonFilteringTest, test_small) auto pair = cuspatial::quadtree_on_points( x, y, x_min, x_max, y_min, y_max, scale, max_depth, min_size, this->mr()); - auto &quadtree = std::get<1>(pair); + auto& quadtree = std::get<1>(pair); fixed_width_column_wrapper poly_offsets({0, 1, 2, 3}); fixed_width_column_wrapper ring_offsets({0, 3, 8, 12}); diff --git a/cpp/tests/join/quadtree_polyline_filtering_test.cu b/cpp/tests/join/quadtree_polyline_filtering_test.cu index ad3d13da6..b3997587a 100644 --- a/cpp/tests/join/quadtree_polyline_filtering_test.cu +++ b/cpp/tests/join/quadtree_polyline_filtering_test.cu @@ -90,7 +90,7 @@ TYPED_TEST(QuadtreePolylineBoundingBoxJoinTest, test_small) auto pair = cuspatial::quadtree_on_points( x, y, x_min, x_max, y_min, y_max, scale, max_depth, min_size, this->mr()); - auto &quadtree = std::get<1>(pair); + auto& quadtree = std::get<1>(pair); double const expansion_radius{2.0}; fixed_width_column_wrapper poly_offsets({0, 3, 8, 12}); diff --git a/cpp/tests/spatial/cartesian_product_group_index_iterator_test.cu b/cpp/tests/spatial/cartesian_product_group_index_iterator_test.cu index f4d2f1a58..bc49f7013 100644 --- a/cpp/tests/spatial/cartesian_product_group_index_iterator_test.cu +++ b/cpp/tests/spatial/cartesian_product_group_index_iterator_test.cu @@ -153,5 +153,7 @@ TYPED_TEST(CartesianProductTest, Traversal) std::vector h_actual(num_cartesian); thrust::copy(d_actual.begin(), d_actual.end(), h_actual.begin()); - for (auto i = 0; i < num_cartesian; i++) { test_equality(i, expected.at(i), h_actual.at(i)); } + for (auto i = 0; i < num_cartesian; i++) { + test_equality(i, expected.at(i), h_actual.at(i)); + } } From 8074c44f6bc08a5a19ae893c5b3f57fe7ec32968 Mon Sep 17 00:00:00 2001 From: Conor Hoekstra Date: Sun, 27 Jun 2021 22:14:49 -0400 Subject: [PATCH 6/7] Remove duplicate line --- cpp/.clang-format | 1 - 1 file changed, 1 deletion(-) diff --git a/cpp/.clang-format b/cpp/.clang-format index ec0ddcfa1..0c05436e9 100644 --- a/cpp/.clang-format +++ b/cpp/.clang-format @@ -51,7 +51,6 @@ BreakBeforeBinaryOperators: None BreakBeforeBraces: WebKit BreakBeforeInheritanceComma: false BreakBeforeTernaryOperators: true -BreakBeforeTernaryOperators: true BreakConstructorInitializersBeforeComma: false BreakConstructorInitializers: BeforeColon BreakInheritanceList: BeforeColon From 12b7f4e5d97a6244014959d404bea747ee1ff5c3 Mon Sep 17 00:00:00 2001 From: Conor Hoekstra Date: Mon, 28 Jun 2021 10:06:28 -0400 Subject: [PATCH 7/7] Remove temporary CI fix --- ci/checks/style.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/ci/checks/style.sh b/ci/checks/style.sh index 5ece641d6..0a92d4eb7 100644 --- a/ci/checks/style.sh +++ b/ci/checks/style.sh @@ -14,10 +14,6 @@ LANG=C.UTF-8 . /opt/conda/etc/profile.d/conda.sh conda activate rapids -gpuci_conda_retry remove --force rapids-build-env rapids-notebook-env -gpuci_conda_retry install -y "clang=11.0.0" -gpuci_conda_retry install -y "clang-tools=11.0.0" - # Run isort and get results/return code ISORT=`isort --check-only python/**/*.py` ISORT_RETVAL=$?