-
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
Experiment on pulling NVTX3 via CPM #1002
Draft
isVoid
wants to merge
79
commits into
rapidsai:branch-23.08
Choose a base branch
from
isVoid:benchmark/point_polygon_distance_dev
base: branch-23.08
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 69 commits
Commits
Show all changes
79 commits
Select commit
Hold shift + click to select a range
965b80a
initial
isVoid 38af8e6
Merge branch 'branch-23.04' of https://github.com/rapidsai/cuspatial …
isVoid 02f61fe
add pragma once for floating_point.cuh
isVoid 7bd797f
add polygon_ref structure
isVoid 0968c15
add multipolygon_ref class
isVoid a659eab
update multipolygon_range class
isVoid c274070
update multipoint_range class
isVoid 12ffa53
update is_point_in_polygon usage with polygon_ref
isVoid 7490333
update multilinestring_range
isVoid f665287
add point to polygon kernel
isVoid 291f6e6
add segment deduction guide
isVoid efa6883
add owning object type to vector factories
isVoid 23146ef
add tests
isVoid ead160a
add helper files
isVoid 09bd35f
add more tests
isVoid 92760d1
bug fixes
isVoid 8acb5dc
cleanups
isVoid a2b94fe
fix tests
isVoid 46a67fe
optimize single point range input
isVoid b725b52
docs, type checks in range ctor
isVoid cb5706a
Merge branch 'branch-23.04' into feature/polygon_distances
isVoid ab59e7d
use range based for loop in is_point_in_polygon
isVoid b136c0b
Apply suggestions from code review
isVoid 744f32f
add docs
isVoid bb6c637
style
isVoid 756650b
Merge branch 'branch-23.04' of https://github.com/rapidsai/cuspatial …
isVoid 8319e7c
fix bug in PiP tests
isVoid 86d36d9
updates with test docs and API docs, address review
isVoid 7bf8cbf
update offsets_to_keys
isVoid ff48dc7
update floating_point docs
isVoid b4420a7
use any_of
isVoid 44e2843
add large (multigrid) tests, address reviews
isVoid 57e6196
Merge branch 'branch-23.04' of https://github.com/rapidsai/cuspatial …
isVoid 49972d4
add upper_bound_index.cuh
isVoid f000e00
remove upper_bound_index
isVoid 57504e6
update geometry id factory
isVoid 4865922
add get gtest scripts in cmake
isVoid ab52bc2
Merge branch 'branch-23.04' of https://github.com/rapidsai/cuspatial …
isVoid eff0e43
add generators and generator tests
isVoid 6d14d69
add parameterized test fixture
isVoid 5f347fd
adopt single kernel launch device multipolygon generation
isVoid bd78dfd
Merge branch 'branch-23.04' of https://github.com/rapidsai/cuspatial …
isVoid 293ee0f
documentation
isVoid 00a6728
document function
isVoid d910a7c
enable value parameterized test
isVoid bd6a4eb
revert distance benchmark
isVoid 9e74468
mixin doc
isVoid fabc5ad
add point-polygon distance benchmark
isVoid de5a663
add benchmark file
isVoid 5c67a80
address review comments
isVoid 757057c
Merge branch 'benchmark/point_polygon_distance' into benchmark/point_…
isVoid 2b46f18
Merge branch 'branch-23.04' into benchmark/point_polygon_distance_dev
isVoid eab8089
update sides->edge
isVoid dea6568
Merge branch 'branch-23.04' of https://github.com/rapidsai/cuspatial …
isVoid 7b19c45
Merge branch 'benchmark/point_polygon_distance_dev' of github.com:isV…
isVoid 1143977
add nvtx range and fix fixtures
isVoid 72fc085
Merge branch 'branch-23.04' into benchmark/point_polygon_distance_dev
isVoid 1c1fbc4
rename plural->singular form
isVoid 4e56fe8
Merge branch 'branch-23.06' of https://github.com/rapidsai/cuspatial …
isVoid e662f1b
Merge branch 'benchmark/point_polygon_distance_dev' of github.com:isV…
isVoid 80d92e4
style
isVoid c2e4390
Merge branch 'branch-23.06' into benchmark/point_polygon_distance_dev
harrism 2ecb8d5
use cpm to pull nvtx
isVoid 79416e8
Merge branch 'benchmark/point_polygon_distance_dev' of github.com:isV…
isVoid 2688284
Merge branch 'branch-23.06' of https://github.com/rapidsai/cuspatial …
isVoid 76b26ab
fixes broken API usage
isVoid 8d34780
using rapids-cpm-find
isVoid 0e66450
style
isVoid b089297
add build export set arg
isVoid 172055e
Merge branch 'branch-23.06' of https://github.com/rapidsai/cuspatial …
isVoid 545fdc2
update cmakelists.txt
isVoid e8e2dbe
Merge branch 'branch-23.06' of https://github.com/rapidsai/cuspatial …
isVoid aa8169b
Move
isVoid db628be
Fix bad renames
isVoid cc6ff27
Record progress
isVoid ae9fe35
Merge branch 'branch-23.06' of https://github.com/rapidsai/cuspatial …
isVoid 4d4cf28
revert non nvtx3 cmake releated changes
isVoid 1b978cd
add file that got removed
isVoid 960d921
remove file
isVoid File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
/* | ||
* Copyright (c) 2023, NVIDIA CORPORATION. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#include <benchmarks/fixture/rmm_pool_raii.hpp> | ||
#include <nvbench/nvbench.cuh> | ||
|
||
#include <cuspatial_test/geometry_generator.cuh> | ||
|
||
#include <cuspatial/experimental/point_polygon_distance.cuh> | ||
#include <cuspatial/vec_2d.hpp> | ||
|
||
#include <rmm/cuda_stream_view.hpp> | ||
#include <rmm/exec_policy.hpp> | ||
|
||
using namespace cuspatial; | ||
using namespace cuspatial::test; | ||
|
||
template <typename T> | ||
void pairwise_point_polygon_distance_benchmark(nvbench::state& state, nvbench::type_list<T>) | ||
{ | ||
// TODO: to be replaced by nvbench fixture once it's ready | ||
cuspatial::rmm_pool_raii rmm_pool; | ||
rmm::cuda_stream_view stream{rmm::cuda_stream_default}; | ||
|
||
auto const num_pairs{static_cast<std::size_t>(state.get_int64("num_pairs"))}; | ||
|
||
auto const num_polygons_per_multipolygon{ | ||
static_cast<std::size_t>(state.get_int64("num_polygons_per_multipolygon"))}; | ||
auto const num_holes_per_polygon{ | ||
static_cast<std::size_t>(state.get_int64("num_holes_per_polygon"))}; | ||
auto const num_edges_per_ring{static_cast<std::size_t>(state.get_int64("num_edges_per_ring"))}; | ||
|
||
auto const num_points_per_multipoint{ | ||
static_cast<std::size_t>(state.get_int64("num_points_per_multipoint"))}; | ||
|
||
auto mpoly_generator_param = multipolygon_generator_parameter<T>{ | ||
num_pairs, num_polygons_per_multipolygon, num_holes_per_polygon, num_edges_per_ring}; | ||
|
||
auto mpoint_generator_param = multipoint_generator_parameter<T>{ | ||
num_pairs, num_points_per_multipoint, vec_2d<T>{-1, -1}, vec_2d<T>{0, 0}}; | ||
|
||
auto multipolygons = generate_multipolygon_array<T>(mpoly_generator_param, stream); | ||
auto multipoints = generate_multipoint_array<T>(mpoint_generator_param, stream); | ||
|
||
auto distances = rmm::device_vector<T>(num_pairs); | ||
auto out_it = distances.begin(); | ||
|
||
auto mpoly_view = multipolygons.range(); | ||
auto mpoint_view = multipoints.range(); | ||
|
||
state.add_element_count(num_pairs, "NumPairs"); | ||
state.add_element_count(mpoly_generator_param.num_polygons(), "NumPolygons"); | ||
state.add_element_count(mpoly_generator_param.num_rings(), "NumRings"); | ||
state.add_element_count(mpoly_generator_param.num_coords(), "NumPoints (in mpoly)"); | ||
state.add_element_count(static_cast<std::size_t>(mpoly_generator_param.num_coords() * | ||
mpoly_generator_param.num_rings() * | ||
mpoly_generator_param.num_polygons()), | ||
"Multipolygon Complexity"); | ||
state.add_element_count(mpoint_generator_param.num_points(), "NumPoints (in multipoints)"); | ||
|
||
state.add_global_memory_reads<T>( | ||
mpoly_generator_param.num_coords() + mpoint_generator_param.num_points(), | ||
"CoordinatesReadSize"); | ||
state.add_global_memory_reads<std::size_t>( | ||
(mpoly_generator_param.num_rings() + 1) + (mpoly_generator_param.num_polygons() + 1) + | ||
(mpoly_generator_param.num_multipolygons + 1) + (mpoint_generator_param.num_multipoints + 1), | ||
"OffsetsDataSize"); | ||
|
||
state.add_global_memory_writes<T>(num_pairs); | ||
|
||
state.exec(nvbench::exec_tag::sync, | ||
[&mpoly_view, &mpoint_view, &out_it, &stream](nvbench::launch& launch) { | ||
pairwise_point_polygon_distance(mpoint_view, mpoly_view, out_it, stream); | ||
}); | ||
} | ||
|
||
using floating_point_types = nvbench::type_list<float, double>; | ||
|
||
// Benchmark scalability with simple multipolygon (3 sides, 0 hole, 1 poly) | ||
NVBENCH_BENCH_TYPES(pairwise_point_polygon_distance_benchmark, | ||
NVBENCH_TYPE_AXES(floating_point_types)) | ||
.set_type_axes_names({"CoordsType"}) | ||
.add_int64_axis("num_pairs", {1, 1'00, 10'000, 1'000'000, 100'000'000}) | ||
.add_int64_axis("num_polygons_per_multipolygon", {1}) | ||
.add_int64_axis("num_holes_per_polygon", {0}) | ||
.add_int64_axis("num_edges_per_ring", {3}) | ||
.add_int64_axis("num_points_per_multipoint", {1}) | ||
.set_name("point_polygon_distance_benchmark_simple_polygon"); | ||
|
||
// Benchmark scalability with complex multipolygon (100 sides, 10 holes, 3 polys) | ||
NVBENCH_BENCH_TYPES(pairwise_point_polygon_distance_benchmark, | ||
NVBENCH_TYPE_AXES(floating_point_types)) | ||
.set_type_axes_names({"CoordsType"}) | ||
.add_int64_axis("num_pairs", {1'000, 10'000, 100'000, 1'000'000}) | ||
.add_int64_axis("num_polygons_per_multipolygon", {2}) | ||
.add_int64_axis("num_holes_per_polygon", {3}) | ||
.add_int64_axis("num_edges_per_ring", {50}) | ||
.add_int64_axis("num_points_per_multipoint", {1}) | ||
.set_name("point_polygon_distance_benchmark_complex_polygon"); | ||
|
||
// // Benchmark impact of rings (100K pairs, 1 polygon, 3 sides) | ||
NVBENCH_BENCH_TYPES(pairwise_point_polygon_distance_benchmark, | ||
NVBENCH_TYPE_AXES(floating_point_types)) | ||
.set_type_axes_names({"CoordsType"}) | ||
.add_int64_axis("num_pairs", {10'000}) | ||
.add_int64_axis("num_polygons_per_multipolygon", {1}) | ||
.add_int64_axis("num_holes_per_polygon", {0, 10, 100, 1000}) | ||
.add_int64_axis("num_edges_per_ring", {3}) | ||
.add_int64_axis("num_points_per_multipoint", {1}) | ||
.set_name("point_polygon_distance_benchmark_ring_numbers"); | ||
|
||
// Benchmark impact of rings (1M pairs, 1 polygon, 0 holes, 3 sides) | ||
NVBENCH_BENCH_TYPES(pairwise_point_polygon_distance_benchmark, | ||
NVBENCH_TYPE_AXES(floating_point_types)) | ||
.set_type_axes_names({"CoordsType"}) | ||
.add_int64_axis("num_pairs", {100}) | ||
.add_int64_axis("num_polygons_per_multipolygon", {1}) | ||
.add_int64_axis("num_holes_per_polygon", {0}) | ||
.add_int64_axis("num_edges_per_ring", {3}) | ||
.add_int64_axis("num_points_per_multipoint", {50, 5'00, 5'000, 50'000, 500'000}) | ||
.set_name("point_polygon_distance_benchmark_points_in_multipoint"); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This is a
PUBLIC
dependency not aPRIVATE
one. The nvtx3 headers are included by the cuspatial public headers and therefore consumers of cuspatial will also need nvtx3.This will resolve the test compilation failures.
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.
We expected to need PUBLIC here and tried it but it caused another issue. @isVoid Can you provide the logs?
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 nvtx3 project doesn't have have install / export rules for the targets they create it looks like. So you would get errors when trying to export the cuspatial targets as they now depend on targets that have no way to be exported.
What we should do is specify
DOWNLOAD_ONLY
when getting nvtx3 and directly includingnvtxImportedTargets.cmake
( https://github.com/NVIDIA/NVTX/blob/v3.1.0-c-cpp/CMakeLists.txt#L33 ).We will need to also setup install rules for this file and the nvtx3 headers, plus a custom
FINAL_CODE_BLOCK
I expect for therapids_export
.I expect that this is why previously cuspatial copied nvtx3 directly, as it dramatically simplified the build-system.
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.
This is exactly what we ran into. We tried setting it to
PUBLIC
and usedrapids_cpm_find
.Should we look into contributing to nvtx3 to provide install / export rules?
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.
Yes but don't hold your breath for it to be put in a release anytime soon. It took them about 2 years to release the last merged feature I was waiting on. So you will probably need to take Rob's
DOWNLOAD_ONLY
suggestion as well.