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

Add compile time check to ensure the counting_iterator type in counting_transform_iterator fits in size_type #17118

Next Next commit
Allow templated begin value to counting_transform_iterator
  • Loading branch information
mhaseeb123 committed Oct 17, 2024
commit db2b1d10a82ec63d4278feca9c92d96a586e51d6
4 changes: 2 additions & 2 deletions cpp/include/cudf/detail/iterator.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ namespace detail {
* @param f The unary function to apply to the counting iterator.
* @return A transform iterator that applies `f` to a counting iterator
*/
template <typename UnaryFunction>
CUDF_HOST_DEVICE inline auto make_counting_transform_iterator(cudf::size_type start,
template <typename CountingIterType, typename UnaryFunction>
CUDF_HOST_DEVICE inline auto make_counting_transform_iterator(CountingIterType start,
UnaryFunction f)
{
return thrust::make_transform_iterator(thrust::make_counting_iterator(start), f);
Expand Down
5 changes: 1 addition & 4 deletions cpp/src/io/parquet/reader_impl_preprocess.cu
Original file line number Diff line number Diff line change
Expand Up @@ -1629,10 +1629,7 @@ void reader::impl::allocate_columns(read_mode mode, size_t skip_rows, size_t num
get_page_nesting_size{
d_cols_info.data(), max_depth, subpass.pages.size(), subpass.pages.device_begin()});

// Manually create a int64_t `key_start` compatible counting_transform_iterator to avoid
// implicit casting to size_type.
auto const reduction_keys = thrust::make_transform_iterator(
thrust::make_counting_iterator<size_t>(key_start), get_reduction_key{subpass.pages.size()});
auto const reduction_keys = cudf::detail::make_counting_transform_iterator(key_start, get_reduction_key{subpass.pages.size()});

// Find the size of each column
thrust::reduce_by_key(rmm::exec_policy_nosync(_stream),
Expand Down
Loading