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 contains_table with cuco::static_set #14064

Merged
merged 28 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
8f2294f
Refactor contains_table with cuco::static_set
PointKernel Sep 7, 2023
f2fd994
Refactor contains_table with cuco::static_set
PointKernel Sep 7, 2023
6c85572
Merge remote-tracking branch 'upstream/branch-23.10' into cuco-contai…
PointKernel Sep 8, 2023
40dfead
Merge remote-tracking branch 'upstream/branch-23.10' into cuco-contai…
PointKernel Sep 12, 2023
bec3cd6
Fix logic issues with hashset
PointKernel Sep 13, 2023
5ada788
Get rid of build_row_bitmask function
PointKernel Sep 13, 2023
204bd45
Minor cleanups: renaming
PointKernel Sep 13, 2023
6ae6f2a
Merge branch 'branch-23.10' into cuco-contains-table
PointKernel Sep 13, 2023
9c7f4f6
Use build_row_bitmmask instead of bitmask_and
PointKernel Sep 14, 2023
237fd70
Code formatting
PointKernel Sep 14, 2023
7283dd3
Merge branch 'branch-23.10' into cuco-contains-table
PointKernel Sep 18, 2023
0a8b678
Add comments back
PointKernel Sep 18, 2023
93ba686
Merge remote-tracking branch 'origin/cuco-contains-table' into cuco-c…
PointKernel Sep 18, 2023
eca017f
Rename contains benchmark file as contains_scalar
PointKernel Sep 18, 2023
fc0980f
Add contains_table benchmark
PointKernel Sep 18, 2023
b2934e5
Add peak memory usage in contains_table benchmark
PointKernel Sep 19, 2023
218ab4f
Minor doc cleanups
PointKernel Sep 19, 2023
6fcaa46
Merge remote-tracking branch 'upstream/branch-23.10' into cuco-contai…
PointKernel Sep 20, 2023
9553104
Distinguish probing scheme CG sizes between nested and flat types for…
PointKernel Sep 20, 2023
0b67f9b
Merge branch 'branch-23.10' into cuco-contains-table
PointKernel Sep 20, 2023
71a8793
Merge branch 'branch-23.10' into cuco-contains-table
PointKernel Sep 21, 2023
cd75057
Merge remote-tracking branch 'upstream/branch-23.10' into cuco-contai…
PointKernel Sep 22, 2023
e1125c3
Remove redundant docs
PointKernel Sep 22, 2023
37f7048
Throw if needles and haystack column types mismatch
PointKernel Sep 22, 2023
4f6af5d
Simplify nested column handling
PointKernel Sep 22, 2023
de99c48
Merge branch 'cuco-contains-table' of github.com:PointKernel/cudf int…
PointKernel Sep 22, 2023
cb9614d
Merge branch 'branch-23.10' into cuco-contains-table
PointKernel Sep 22, 2023
b848ada
Merge branch 'branch-23.10' into cuco-contains-table
PointKernel Sep 25, 2023
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
2 changes: 1 addition & 1 deletion cpp/benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ ConfigureBench(ITERATOR_BENCH iterator/iterator.cu)
# ##################################################################################################
# * search benchmark ------------------------------------------------------------------------------
ConfigureBench(SEARCH_BENCH search/search.cpp)
ConfigureNVBench(SEARCH_NVBENCH search/contains.cpp)
ConfigureNVBench(SEARCH_NVBENCH search/contains_scalar.cpp search/contains_table.cpp)

# ##################################################################################################
# * sort benchmark --------------------------------------------------------------------------------
Expand Down
73 changes: 73 additions & 0 deletions cpp/benchmarks/search/contains_table.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*
* 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/common/generate_input.hpp>
#include <benchmarks/fixture/benchmark_fixture.hpp>

#include <cudf/detail/search.hpp>
#include <cudf/lists/list_view.hpp>
#include <cudf/types.hpp>

#include <rmm/mr/device/per_device_resource.hpp>

#include <nvbench/nvbench.cuh>

auto constexpr num_unique_elements = 1000;

template <typename Type>
static void nvbench_contains_table(nvbench::state& state, nvbench::type_list<Type>)
{
auto const size = state.get_int64("table_size");
auto const dtype = cudf::type_to_id<Type>();
double const null_probability = state.get_float64("null_probability");

auto builder = data_profile_builder().null_probability(null_probability);
if (dtype == cudf::type_id::LIST) {
builder.distribution(dtype, distribution_id::UNIFORM, 0, num_unique_elements)
.distribution(cudf::type_id::INT32, distribution_id::UNIFORM, 0, num_unique_elements)
.list_depth(1);
} else {
builder.distribution(dtype, distribution_id::UNIFORM, 0, num_unique_elements);
}

auto const haystack = create_random_table(
{dtype}, table_size_bytes{static_cast<size_t>(size)}, data_profile{builder}, 0);
auto const needles = create_random_table(
{dtype}, table_size_bytes{static_cast<size_t>(size)}, data_profile{builder}, 1);

auto mem_stats_logger = cudf::memory_stats_logger();

state.exec(nvbench::exec_tag::sync, [&](nvbench::launch& launch) {
auto const stream_view = rmm::cuda_stream_view{launch.get_stream()};
[[maybe_unused]] auto const result =
cudf::detail::contains(haystack->view(),
needles->view(),
cudf::null_equality::EQUAL,
cudf::nan_equality::ALL_EQUAL,
stream_view,
rmm::mr::get_current_device_resource());
});

state.add_buffer_size(
mem_stats_logger.peak_memory_usage(), "peak_memory_usage", "peak_memory_usage");
}

NVBENCH_BENCH_TYPES(nvbench_contains_table,
NVBENCH_TYPE_AXES(nvbench::type_list<int32_t, cudf::list_view>))
.set_name("contains_table")
.set_type_axes_names({"type"})
.add_float64_axis("null_probability", {0.0, 0.1})
.add_int64_axis("table_size", {10'000, 100'000, 1'000'000, 10'000'000});
2 changes: 2 additions & 0 deletions cpp/include/cudf/detail/search.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ std::unique_ptr<column> contains(column_view const& haystack,
* output = { false, true, true }
* @endcode
*
* @throws cudf::logic_error If column types of haystack and needles don't match
*
* @param haystack The table containing the search space
* @param needles A table of rows whose existence to check in the search space
* @param compare_nulls Control whether nulls should be compared as equal or not
Expand Down
Loading