Skip to content

Commit

Permalink
Use public APIs in STREAM_COMPACTION_NVBENCH (#11892)
Browse files Browse the repository at this point in the history
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: #11892
  • Loading branch information
Gregory Kimball authored Oct 11, 2022
1 parent 566b3d1 commit 9ba6142
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 19 deletions.
28 changes: 13 additions & 15 deletions cpp/benchmarks/stream_compaction/distinct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
#include <benchmarks/fixture/rmm_pool_raii.hpp>

#include <cudf/column/column_view.hpp>
#include <cudf/detail/stream_compaction.hpp>
#include <cudf/lists/list_view.hpp>
#include <cudf/stream_compaction.hpp>
#include <cudf/types.hpp>

#include <nvbench/nvbench.cuh>
Expand All @@ -41,14 +41,13 @@ void nvbench_distinct(nvbench::state& state, nvbench::type_list<Type>)
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);
});
}

Expand Down Expand Up @@ -84,14 +83,13 @@ void nvbench_distinct_list(nvbench::state& state, nvbench::type_list<Type>)
auto const table = create_random_table(
{dtype}, table_size_bytes{static_cast<size_t>(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);
});
}

Expand Down
7 changes: 3 additions & 4 deletions cpp/benchmarks/stream_compaction/unique.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <benchmarks/fixture/rmm_pool_raii.hpp>

#include <cudf/column/column_view.hpp>
#include <cudf/detail/stream_compaction.hpp>
#include <cudf/stream_compaction.hpp>
#include <cudf/types.hpp>

#include <nvbench/nvbench.cuh>
Expand Down Expand Up @@ -62,10 +62,9 @@ void nvbench_unique(nvbench::state& state, nvbench::type_list<Type, nvbench::enu
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::unique(input_table, {0}, Keep, cudf::null_equality::EQUAL, stream_view);
auto result = cudf::unique(input_table, {0}, Keep, cudf::null_equality::EQUAL);
});
}

Expand Down

0 comments on commit 9ba6142

Please sign in to comment.