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

Clean up distinct_count benchmark #13321

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
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
7 changes: 3 additions & 4 deletions cpp/benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ ConfigureBench(APPLY_BOOLEAN_MASK_BENCH stream_compaction/apply_boolean_mask.cpp
# ##################################################################################################
# * stream_compaction benchmark -------------------------------------------------------------------
ConfigureNVBench(
STREAM_COMPACTION_NVBENCH stream_compaction/distinct.cpp stream_compaction/unique.cpp
stream_compaction/unique_count.cpp
STREAM_COMPACTION_NVBENCH stream_compaction/distinct.cpp stream_compaction/distinct_count.cpp
stream_compaction/unique.cpp stream_compaction/unique_count.cpp
)

# ##################################################################################################
Expand Down Expand Up @@ -195,8 +195,7 @@ ConfigureBench(
reduction/reduce.cpp reduction/scan.cpp
)
ConfigureNVBench(
REDUCTION_NVBENCH reduction/distinct_count.cpp reduction/rank.cpp reduction/scan_structs.cpp
reduction/segmented_reduce.cpp
REDUCTION_NVBENCH reduction/rank.cpp reduction/scan_structs.cpp reduction/segmented_reduce.cpp
)

# ##################################################################################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
*/

#include <benchmarks/common/generate_input.hpp>
#include <benchmarks/fixture/rmm_pool_raii.hpp>
#include <benchmarks/fixture/benchmark_fixture.hpp>

#include <cudf/detail/stream_compaction.hpp>
#include <cudf/stream_compaction.hpp>

#include <nvbench/nvbench.cuh>

template <typename Type>
static void bench_reduction_distinct_count(nvbench::state& state, nvbench::type_list<Type>)
static void bench_distinct_count(nvbench::state& state, nvbench::type_list<Type>)
{
auto const dtype = cudf::type_to_id<Type>();
auto const size = static_cast<cudf::size_type>(state.get_int64("num_rows"));
Expand All @@ -40,16 +40,19 @@ static void bench_reduction_distinct_count(nvbench::state& state, nvbench::type_
auto const& data_column = data_table->get_column(0);
auto const input_table = cudf::table_view{{data_column, data_column, data_column}};

auto mem_stats_logger = cudf::memory_stats_logger(); // init stats logger
state.set_cuda_stream(nvbench::make_cuda_stream_view(cudf::get_default_stream().value()));
state.exec(nvbench::exec_tag::sync, [&](nvbench::launch& launch) {
rmm::cuda_stream_view stream{launch.get_stream()};
cudf::detail::distinct_count(input_table, cudf::null_equality::EQUAL, stream);
cudf::distinct_count(input_table, cudf::null_equality::EQUAL);
});
state.add_buffer_size(
mem_stats_logger.peak_memory_usage(), "peak_memory_usage", "peak_memory_usage");
}

using data_type = nvbench::type_list<int32_t, int64_t, float, double>;

NVBENCH_BENCH_TYPES(bench_reduction_distinct_count, NVBENCH_TYPE_AXES(data_type))
.set_name("reduction_distinct_count")
NVBENCH_BENCH_TYPES(bench_distinct_count, NVBENCH_TYPE_AXES(data_type))
.set_name("distinct_count")
.add_int64_axis("num_rows",
{
10000, // 10k
Expand Down