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

Fix url-decode benchmark to use offsetalator #15871

Merged
Merged
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: 4 additions & 3 deletions cpp/benchmarks/string/url_decode.cu
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <cudf_test/column_wrapper.hpp>

#include <cudf/column/column_view.hpp>
#include <cudf/detail/offsets_iterator_factory.cuh>
#include <cudf/filling.hpp>
#include <cudf/strings/convert/convert_urls.hpp>
#include <cudf/strings/strings_column_view.hpp>
Expand All @@ -43,7 +44,7 @@ struct url_string_generator {
{
}

__device__ void operator()(thrust::tuple<cudf::size_type, cudf::size_type> str_begin_end)
__device__ void operator()(thrust::tuple<int64_t, int64_t> str_begin_end)
{
auto begin = thrust::get<0>(str_begin_end);
auto end = thrust::get<1>(str_begin_end);
Expand All @@ -69,11 +70,11 @@ auto generate_column(cudf::size_type num_rows, cudf::size_type chars_per_row, do
auto result_col = std::move(table_a->release()[0]); // string column with num_rows aaa...
auto chars_data = static_cast<char*>(result_col->mutable_view().head());
auto offset_col = result_col->child(cudf::strings_column_view::offsets_column_index).view();
auto offset_itr = cudf::detail::offsetalator_factory::make_input_iterator(offset_col);

auto engine = thrust::default_random_engine{};
thrust::for_each_n(thrust::device,
thrust::make_zip_iterator(offset_col.begin<cudf::size_type>(),
offset_col.begin<cudf::size_type>() + 1),
thrust::make_zip_iterator(offset_itr, offset_itr + 1),
num_rows,
url_string_generator{chars_data, esc_seq_chance, engine});
return result_col;
Expand Down
Loading