Skip to content

Commit

Permalink
More CTAD
Browse files Browse the repository at this point in the history
  • Loading branch information
codereport committed Nov 24, 2021
1 parent dbc8b6d commit 7239a6d
Show file tree
Hide file tree
Showing 16 changed files with 37 additions and 57 deletions.
2 changes: 1 addition & 1 deletion cpp/include/cudf/strings/detail/gather.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ std::unique_ptr<cudf::column> gather(
d_out_offsets + output_count,
[] __device__(auto size) { return static_cast<size_t>(size); },
size_t{0},
thrust::plus<size_t>{});
thrust::plus{});
CUDF_EXPECTS(total_bytes < static_cast<std::size_t>(std::numeric_limits<size_type>::max()),
"total size of output strings is too large for a cudf column");
Expand Down
7 changes: 2 additions & 5 deletions cpp/include/cudf_test/column_wrapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1499,11 +1499,8 @@ class lists_column_wrapper : public detail::column_wrapper {

// concatenate them together, skipping children that are null.
std::vector<column_view> children;
thrust::copy_if(std::cbegin(cols),
std::cend(cols),
valids, // stencil
std::back_inserter(children),
thrust::identity{});
thrust::copy_if(
std::cbegin(cols), std::cend(cols), valids, std::back_inserter(children), thrust::identity{});

auto data = children.empty() ? cudf::empty_like(expected_hierarchy) : concatenate(children);

Expand Down
2 changes: 1 addition & 1 deletion cpp/src/copying/concatenate.cu
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ auto create_device_views(host_span<column_view const> views, rmm::cuda_stream_vi
device_views.cend(),
std::next(offsets.begin()),
[](auto const& col) { return col.size(); },
thrust::plus<size_t>{});
thrust::plus{});
auto d_offsets = make_device_uvector_async(offsets, stream);
auto const output_size = offsets.back();

Expand Down
2 changes: 1 addition & 1 deletion cpp/src/groupby/sort/group_rank_scan.cu
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ std::unique_ptr<column> rank_generator(column_view const& order_by,
group_labels.end(),
mutable_ranks.begin<size_type>(),
mutable_ranks.begin<size_type>(),
thrust::equal_to<size_type>{},
thrust::equal_to{},
scan_op);

return ranks;
Expand Down
6 changes: 3 additions & 3 deletions cpp/src/groupby/sort/group_scan_util.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ struct group_scan_functor<K, T, std::enable_if_t<is_group_scan_supported<K, T>()
group_labels.end(),
inp_iter,
out_iter,
thrust::equal_to<size_type>{},
thrust::equal_to{},
binop);
};

Expand Down Expand Up @@ -160,7 +160,7 @@ struct group_scan_functor<K,
group_labels.end(),
inp_iter,
out_iter,
thrust::equal_to<size_type>{},
thrust::equal_to{},
binop);
};

Expand Down Expand Up @@ -214,7 +214,7 @@ struct group_scan_functor<K,
group_labels.end(),
inp_iter,
out_iter,
thrust::equal_to<size_type>{},
thrust::equal_to{},
binop);
};

Expand Down
12 changes: 6 additions & 6 deletions cpp/src/groupby/sort/group_single_pass_reduction_util.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ struct group_reduction_functor<K, T, std::enable_if_t<is_group_reduction_support
inp_iter,
thrust::make_discard_iterator(),
out_iter,
thrust::equal_to<size_type>{},
thrust::equal_to{},
binop);
};

Expand All @@ -215,7 +215,7 @@ struct group_reduction_functor<K, T, std::enable_if_t<is_group_reduction_support
rmm::device_uvector<bool> validity(num_groups, stream);
do_reduction(cudf::detail::make_validity_iterator(*d_values_ptr),
validity.begin(),
thrust::logical_or<bool>{});
thrust::logical_or{});

auto [null_mask, null_count] =
cudf::detail::valid_if(validity.begin(), validity.end(), thrust::identity{}, stream, mr);
Expand Down Expand Up @@ -264,7 +264,7 @@ struct group_reduction_functor<
inp_iter,
thrust::make_discard_iterator(),
out_iter,
thrust::equal_to<size_type>{},
thrust::equal_to{},
binop);
};

Expand All @@ -283,10 +283,10 @@ struct group_reduction_functor<
auto validity = rmm::device_uvector<bool>(num_groups, stream);
do_reduction(cudf::detail::make_validity_iterator(*d_values_ptr),
validity.begin(),
thrust::logical_or<bool>{});
thrust::logical_or{});

auto [null_mask, null_count] = cudf::detail::valid_if(
validity.begin(), validity.end(), thrust::identity<bool>{}, stream, mr);
auto [null_mask, null_count] =
cudf::detail::valid_if(validity.begin(), validity.end(), thrust::identity{}, stream, mr);
result->set_null_mask(std::move(null_mask), null_count);
} else {
auto const binop =
Expand Down
10 changes: 5 additions & 5 deletions cpp/src/groupby/sort/group_tdigest.cu
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ std::unique_ptr<column> compute_tdigests(int delta,
centroids_begin, // values
thrust::make_discard_iterator(), // key output
output, // output
thrust::equal_to<size_type>{}, // key equality check
thrust::equal_to{}, // key equality check
merge_centroids{});

// create final tdigest column
Expand Down Expand Up @@ -850,8 +850,8 @@ std::unique_ptr<column> group_merge_tdigest(column_view const& input,
min_iter,
thrust::make_discard_iterator(),
merged_min_col->mutable_view().begin<double>(),
thrust::equal_to<size_type>{}, // key equality check
thrust::minimum<double>{});
thrust::equal_to{}, // key equality check
thrust::minimum{});

auto merged_max_col = cudf::make_numeric_column(
data_type{type_id::FLOAT64}, num_groups, mask_state::UNALLOCATED, stream, mr);
Expand All @@ -864,8 +864,8 @@ std::unique_ptr<column> group_merge_tdigest(column_view const& input,
max_iter,
thrust::make_discard_iterator(),
merged_max_col->mutable_view().begin<double>(),
thrust::equal_to<size_type>{}, // key equality check
thrust::maximum<double>{});
thrust::equal_to{}, // key equality check
thrust::maximum{});

// for any empty groups, set the min and max to be 0. not technically necessary but it makes
// testing simpler.
Expand Down
7 changes: 2 additions & 5 deletions cpp/src/quantiles/tdigest/tdigest.cu
Original file line number Diff line number Diff line change
Expand Up @@ -348,11 +348,8 @@ std::unique_ptr<column> percentile_approx(tdigest_column_view const& input,
if (null_count == 0) {
return std::pair<rmm::device_buffer, size_type>{rmm::device_buffer{}, null_count};
}
return cudf::detail::valid_if(tdigest_is_empty,
tdigest_is_empty + tdv.size(),
thrust::logical_not<size_type>{},
stream,
mr);
return cudf::detail::valid_if(
tdigest_is_empty, tdigest_is_empty + tdv.size(), thrust::logical_not{}, stream, mr);
}();

return cudf::make_lists_column(
Expand Down
6 changes: 3 additions & 3 deletions cpp/src/rolling/grouped_rolling.cu
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ std::unique_ptr<column> grouped_rolling_window(table_view const& group_keys,
preceding_window] __device__(size_type idx) {
auto group_label = d_group_labels[idx];
auto group_start = d_group_offsets[group_label];
return thrust::minimum<size_type>{}(preceding_window,
idx - group_start + 1); // Preceding includes current row.
return thrust::minimum{}(preceding_window,
idx - group_start + 1); // Preceding includes current row.
};

auto following_calculator = [d_group_offsets = group_offsets.data(),
Expand All @@ -152,7 +152,7 @@ std::unique_ptr<column> grouped_rolling_window(table_view const& group_keys,
auto group_label = d_group_labels[idx];
auto group_end = d_group_offsets[group_label + 1]; // Cannot fall off the end, since offsets
// is capped with `input.size()`.
return thrust::minimum<size_type>{}(following_window, (group_end - 1) - idx);
return thrust::minimum{}(following_window, (group_end - 1) - idx);
};

if (aggr.kind == aggregation::CUDA || aggr.kind == aggregation::PTX) {
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/rolling/rolling_collect_list.cu
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ std::unique_ptr<column> get_list_child_to_list_row_mapping(cudf::column_view con
per_row_mapping_begin,
per_row_mapping_begin + num_child_rows,
per_row_mapping_begin,
thrust::maximum<size_type>{});
thrust::maximum{});
return per_row_mapping;
}

Expand Down
2 changes: 1 addition & 1 deletion cpp/src/sort/rank.cu
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ void tie_break_ranks_transform(cudf::device_span<size_type const> dense_rank_sor
tie_iter,
thrust::make_discard_iterator(),
tie_sorted.begin(),
thrust::equal_to<size_type>{},
thrust::equal_to{},
tie_breaker);
auto sorted_tied_rank = thrust::make_transform_iterator(
dense_rank_sorted.begin(),
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/strings/copying/concatenate.cu
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ auto create_strings_device_views(host_span<column_view const> views, rmm::cuda_s
device_views_ptr + views.size(),
std::next(d_partition_offsets.begin()),
chars_size_transform{},
thrust::plus<size_t>{});
thrust::plus{});
auto const output_chars_size = d_partition_offsets.back_element(stream);
stream.synchronize(); // ensure copy of output_chars_size is complete before returning

Expand Down
7 changes: 2 additions & 5 deletions cpp/src/strings/findall.cu
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,8 @@ std::unique_ptr<table> findall_re(

std::vector<std::unique_ptr<column>> results;

size_type const columns = thrust::reduce(rmm::exec_policy(stream),
find_counts.begin(),
find_counts.end(),
0,
thrust::maximum<size_type>{});
size_type const columns = thrust::reduce(
rmm::exec_policy(stream), find_counts.begin(), find_counts.end(), 0, thrust::maximum{});
// boundary case: if no columns, return all nulls column (issue #119)
if (columns == 0)
results.emplace_back(std::make_unique<column>(
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/strings/repeat_strings.cu
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ std::pair<std::unique_ptr<column>, int64_t> repeat_strings_output_sizes(
thrust::make_counting_iterator<size_type>(strings_count),
fn,
int64_t{0},
thrust::plus<int64_t>{});
thrust::plus{});

return std::make_pair(std::move(output_sizes), total_bytes);
}
Expand Down
14 changes: 4 additions & 10 deletions cpp/src/strings/split/split.cu
Original file line number Diff line number Diff line change
Expand Up @@ -490,11 +490,8 @@ std::unique_ptr<table> split_fn(strings_column_view const& strings_column,
});

// the columns_count is the maximum number of tokens for any string
auto const columns_count = thrust::reduce(rmm::exec_policy(stream),
token_counts.begin(),
token_counts.end(),
0,
thrust::maximum<size_type>{});
auto const columns_count = thrust::reduce(
rmm::exec_policy(stream), token_counts.begin(), token_counts.end(), 0, thrust::maximum{});
// boundary case: if no columns, return one null column (custrings issue #119)
if (columns_count == 0) {
results.push_back(std::make_unique<column>(
Expand Down Expand Up @@ -748,11 +745,8 @@ std::unique_ptr<table> whitespace_split_fn(size_type strings_count,
[tokenizer] __device__(size_type idx) { return tokenizer.count_tokens(idx); });

// column count is the maximum number of tokens for any string
size_type const columns_count = thrust::reduce(rmm::exec_policy(stream),
token_counts.begin(),
token_counts.end(),
0,
thrust::maximum<size_type>{});
size_type const columns_count = thrust::reduce(
rmm::exec_policy(stream), token_counts.begin(), token_counts.end(), 0, thrust::maximum{});

std::vector<std::unique_ptr<column>> results;
// boundary case: if no columns, return one null column (issue #119)
Expand Down
11 changes: 3 additions & 8 deletions cpp/tests/iterator/iterator_tests.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,8 @@ struct IteratorTest : public cudf::test::BaseFixture {

// Get temporary storage size
size_t temp_storage_bytes = 0;
cub::DeviceReduce::Reduce(nullptr,
temp_storage_bytes,
d_in,
dev_result.begin(),
num_items,
thrust::minimum<T_output>{},
init);
cub::DeviceReduce::Reduce(
nullptr, temp_storage_bytes, d_in, dev_result.begin(), num_items, thrust::minimum{}, init);

// Allocate temporary storage
rmm::device_buffer d_temp_storage(temp_storage_bytes, rmm::cuda_stream_default);
Expand All @@ -67,7 +62,7 @@ struct IteratorTest : public cudf::test::BaseFixture {
d_in,
dev_result.begin(),
num_items,
thrust::minimum<T_output>{},
thrust::minimum{},
init);

evaluate(expected, dev_result, "cub test");
Expand Down

0 comments on commit 7239a6d

Please sign in to comment.