From 1354abdb7a4f9eb58bfc6e359c49d0baabacb4e1 Mon Sep 17 00:00:00 2001 From: David Wendt <45795991+davidwendt@users.noreply.github.com> Date: Fri, 31 May 2024 16:03:09 -0400 Subject: [PATCH] Fix url-decode benchmark to use offsetalator (#15871) Fixes the logic for generating URLs in the url-decoder benchmark to use the offsetalator instead of hardcoding `size_type`. This will allow benchmarking with large strings column in the future. Authors: - David Wendt (https://github.com/davidwendt) Approvers: - Vukasin Milovanovic (https://github.com/vuule) - Yunsong Wang (https://github.com/PointKernel) URL: https://github.com/rapidsai/cudf/pull/15871 --- cpp/benchmarks/string/url_decode.cu | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cpp/benchmarks/string/url_decode.cu b/cpp/benchmarks/string/url_decode.cu index b3aeb69e5ea..7720e585023 100644 --- a/cpp/benchmarks/string/url_decode.cu +++ b/cpp/benchmarks/string/url_decode.cu @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -43,7 +44,7 @@ struct url_string_generator { { } - __device__ void operator()(thrust::tuple str_begin_end) + __device__ void operator()(thrust::tuple str_begin_end) { auto begin = thrust::get<0>(str_begin_end); auto end = thrust::get<1>(str_begin_end); @@ -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(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(), - offset_col.begin() + 1), + thrust::make_zip_iterator(offset_itr, offset_itr + 1), num_rows, url_string_generator{chars_data, esc_seq_chance, engine}); return result_col;