From 8a5a1f46641f15dabd1b17b8eb63cdb4cb3a325c Mon Sep 17 00:00:00 2001 From: Yunsong Wang Date: Thu, 11 May 2023 10:10:19 -0700 Subject: [PATCH] Clean up `distinct_count` benchmark (#13321) This PR moves the `distinct_count` benchmark to the `stream_compaction` folder. It also adds peak memory usage information and targets the public API for performance evaluation. Authors: - Yunsong Wang (https://github.com/PointKernel) Approvers: - Nghia Truong (https://github.com/ttnghia) - Karthikeyan (https://github.com/karthikeyann) URL: https://github.com/rapidsai/cudf/pull/13321 --- cpp/benchmarks/CMakeLists.txt | 7 +++---- .../distinct_count.cpp | 17 ++++++++++------- 2 files changed, 13 insertions(+), 11 deletions(-) rename cpp/benchmarks/{reduction => stream_compaction}/distinct_count.cpp (75%) diff --git a/cpp/benchmarks/CMakeLists.txt b/cpp/benchmarks/CMakeLists.txt index 90225b8537a..dcc70a4b6d9 100644 --- a/cpp/benchmarks/CMakeLists.txt +++ b/cpp/benchmarks/CMakeLists.txt @@ -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 ) # ################################################################################################## @@ -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 ) # ################################################################################################## diff --git a/cpp/benchmarks/reduction/distinct_count.cpp b/cpp/benchmarks/stream_compaction/distinct_count.cpp similarity index 75% rename from cpp/benchmarks/reduction/distinct_count.cpp rename to cpp/benchmarks/stream_compaction/distinct_count.cpp index d2218c270a8..2b2c901b90f 100644 --- a/cpp/benchmarks/reduction/distinct_count.cpp +++ b/cpp/benchmarks/stream_compaction/distinct_count.cpp @@ -15,14 +15,14 @@ */ #include -#include +#include -#include +#include #include template -static void bench_reduction_distinct_count(nvbench::state& state, nvbench::type_list) +static void bench_distinct_count(nvbench::state& state, nvbench::type_list) { auto const dtype = cudf::type_to_id(); auto const size = static_cast(state.get_int64("num_rows")); @@ -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; -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