From 9ba6142f6eb6a7d8f9903a5dfaf9af22cdd76b8a Mon Sep 17 00:00:00 2001 From: Gregory Kimball Date: Tue, 11 Oct 2022 08:18:10 -0700 Subject: [PATCH] Use public APIs in STREAM_COMPACTION_NVBENCH (#11892) Use `state.set_cuda_stream` to set the stream for the nvbench benchmark. Then run `state.exec` on the public API instead of the detail API, e.g. `cudf::distinct` instead of `cudf::detail::distinct`. Authors: - Gregory Kimball (https://github.com/GregoryKimball) Approvers: - Nghia Truong (https://github.com/ttnghia) - Karthikeyan (https://github.com/karthikeyann) URL: https://github.com/rapidsai/cudf/pull/11892 --- cpp/benchmarks/stream_compaction/distinct.cpp | 28 +++++++++---------- cpp/benchmarks/stream_compaction/unique.cpp | 7 ++--- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/cpp/benchmarks/stream_compaction/distinct.cpp b/cpp/benchmarks/stream_compaction/distinct.cpp index ad837bc4caa..23960b24b89 100644 --- a/cpp/benchmarks/stream_compaction/distinct.cpp +++ b/cpp/benchmarks/stream_compaction/distinct.cpp @@ -18,8 +18,8 @@ #include #include -#include #include +#include #include #include @@ -41,14 +41,13 @@ void nvbench_distinct(nvbench::state& state, nvbench::type_list) auto input_column = source_column->view(); auto input_table = cudf::table_view({input_column, input_column, input_column, input_column}); + state.set_cuda_stream(nvbench::make_cuda_stream_view(cudf::default_stream_value.value())); state.exec(nvbench::exec_tag::sync, [&](nvbench::launch& launch) { - rmm::cuda_stream_view stream_view{launch.get_stream()}; - auto result = cudf::detail::distinct(input_table, - {0}, - cudf::duplicate_keep_option::KEEP_ANY, - cudf::null_equality::EQUAL, - cudf::nan_equality::ALL_EQUAL, - stream_view); + auto result = cudf::distinct(input_table, + {0}, + cudf::duplicate_keep_option::KEEP_ANY, + cudf::null_equality::EQUAL, + cudf::nan_equality::ALL_EQUAL); }); } @@ -84,14 +83,13 @@ void nvbench_distinct_list(nvbench::state& state, nvbench::type_list) auto const table = create_random_table( {dtype}, table_size_bytes{static_cast(size)}, data_profile{builder}, 0); + state.set_cuda_stream(nvbench::make_cuda_stream_view(cudf::default_stream_value.value())); state.exec(nvbench::exec_tag::sync, [&](nvbench::launch& launch) { - rmm::cuda_stream_view stream_view{launch.get_stream()}; - auto result = cudf::detail::distinct(*table, - {0}, - cudf::duplicate_keep_option::KEEP_ANY, - cudf::null_equality::EQUAL, - cudf::nan_equality::ALL_EQUAL, - stream_view); + auto result = cudf::distinct(*table, + {0}, + cudf::duplicate_keep_option::KEEP_ANY, + cudf::null_equality::EQUAL, + cudf::nan_equality::ALL_EQUAL); }); } diff --git a/cpp/benchmarks/stream_compaction/unique.cpp b/cpp/benchmarks/stream_compaction/unique.cpp index 6b586581408..bcf9628b19f 100644 --- a/cpp/benchmarks/stream_compaction/unique.cpp +++ b/cpp/benchmarks/stream_compaction/unique.cpp @@ -18,7 +18,7 @@ #include #include -#include +#include #include #include @@ -62,10 +62,9 @@ void nvbench_unique(nvbench::state& state, nvbench::type_listview(); auto input_table = cudf::table_view({input_column, input_column, input_column, input_column}); + state.set_cuda_stream(nvbench::make_cuda_stream_view(cudf::default_stream_value.value())); state.exec(nvbench::exec_tag::sync, [&](nvbench::launch& launch) { - rmm::cuda_stream_view stream_view{launch.get_stream()}; - auto result = - cudf::detail::unique(input_table, {0}, Keep, cudf::null_equality::EQUAL, stream_view); + auto result = cudf::unique(input_table, {0}, Keep, cudf::null_equality::EQUAL); }); }